-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend Operator to PSQL-HA #199
Open
justinorringer
wants to merge
72
commits into
nutanix-cloud-native:main
Choose a base branch
from
irion4686:dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
a182070
Initial commit with work from previous semester
irion4686 b18fc0e
Fixed ReadMe formatting
irion4686 04b6e17
Added back optional tags on IsHighAvailability field
irion4686 917228a
Added node struct to allow setting of properties for individual nodes
irion4686 b937355
Added implementation for the getInstanceNodes method
irion4686 5ba62b8
Implemented dynamically setting of nodes and basic validation of node…
irion4686 0d43f84
Dynamically setting all arguments
kpatel0923 7ed55c9
Changed Node struct to have new NodeProperties struct
irion4686 77d9f67
Fixed unit tests and added default nodes settings
irion4686 6cc94b7
cleaning up
irion4686 d2d16a0
cleaning up
irion4686 af1bce2
Updated dynamic nodes format
irion4686 5134ca5
Merge pull request #4 from irion4686/dynamic-nodes
justinorringer c326980
Added omitempty to nodes to fix existing unit tests
irion4686 a1b6dd7
Merge pull request #5 from irion4686/dynamic-nodes
irion4686 ec0daa8
Moved default logic to map and new function
justinorringer 83a0bce
Changed clone to dynamically build Nodes
justinorringer f3d3d62
Set NodeCount based on actual nodes
justinorringer 16caf1a
Add changes for end-to-end high availability tests
ArcZz ddd0d6e
edit folder name
ArcZz ff1f6d9
Update automation/tests/provisioning/pg-ha_test_2/pg-ha_test.go
justinorringer 383ad7b
Added default cluster_name when none given
irion4686 d4057bf
fixed unit test
irion4686 108572d
fixed unit test
irion4686 933a405
Separated postgres HA additional arguments and fixed isHighAvailabili…
irion4686 ce9e102
moved the appendProvisioningRequest for PostgresHA to be near others
irion4686 9238fcb
Merge branch 'dev' into ete_ha_test
justinorringer 731a1de
Moving folder, cleanup
justinorringer ee127e5
Uncommit spacing change
justinorringer 707cb29
Newline
justinorringer 835a1ac
webhook test updates
kpatel0923 233de04
syntax errors
kpatel0923 667a9f2
more syntax errors
kpatel0923 ee2a1e1
Naming issue
kpatel0923 708b4cf
VmName
kpatel0923 5886293
properties name
kpatel0923 c81b5aa
properties
kpatel0923 95857e4
Node change
kpatel0923 9f24ced
testing a new change for creating nodes
kpatel0923 de3903b
Validation for clone and provision
justinorringer c71d1a0
Correct variable declaration
justinorringer 5879c22
Type errors
justinorringer 5032fbc
Default should run prior to Validate
justinorringer a087217
Validation for clone and provision
justinorringer 6e753d0
Correct variable declaration
justinorringer 6b108e6
Type errors
justinorringer 666abfd
Default should run prior to Validate
justinorringer 66c9069
Updated tests
irion4686 20a725d
Updated required nodes to 3 database nodes
irion4686 31b0234
Merge pull request #12 from irion4686/update-nodes
justinorringer 760ddb2
Adding back the Make changes
justinorringer 1da557a
Merge branch 'dev' into ete_ha_test
justinorringer 4db5552
Merge pull request #8 from irion4686/ete_ha_test
ArcZz 3dcbcd1
Revert "end to end test with custom test case"
justinorringer 348e60c
Merge pull request #13 from irion4686/revert-8-ete_ha_test
justinorringer f541e13
Removing cloning functionality
justinorringer 7bc5b15
Removed the wrong struct params
justinorringer cbfc971
Adding back the appendCloningRequest hook needed
justinorringer f4b05c3
GetInstanceIsHA on clone
justinorringer bf09f04
Fix test, no IsHighAvailability field on clone
justinorringer bf3dd2d
Reflect cloning removed in readme
justinorringer 2002a96
Removed the clone tests and added db tests
kpatel0923 33e9ecd
Merge branch 'dev' into webhook-test-update
justinorringer 497a918
Release v0.5.1 (#198)
mazin-s eb00f13
Fixed test case
kpatel0923 1babd0d
Merge branch 'webhook-test-update' of https://github.com/irion4686/nd…
kpatel0923 bbc9598
Added check to the end to end test to assert that more than 1 node wa…
irion4686 7188d25
Merge pull request #17 from irion4686/webhook-test-update
justinorringer 6af152c
Merge branch 'dev' into ete_ha_test
justinorringer 4fc1804
Merge pull request #8 from irion4686/ete_ha_test
ArcZz 71688cc
Added check to the end to end test to assert that more than 1 node wa…
irion4686 02bb089
Merge pull request #18 from irion4686/ete_ha_test
ArcZz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package v1alpha1 | ||
|
||
// validate the Node and NodeProperties passed are valid | ||
// e.g validate vmNames being unique, properties correctly defined, etc. | ||
// one day move to common/util | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
var ( | ||
typeOptions = map[string]bool{"database": true, "haproxy": true} | ||
roleOptions = map[string]bool{"primary": true, "secondary": true} | ||
failoverOptions = map[string]bool{"Automatic": true, "Manual": true} | ||
) | ||
|
||
func ValidateNodes(nodes []*Node, isHighAvailability bool) error { | ||
if !isHighAvailability { | ||
return nil | ||
} | ||
|
||
databaseNodeCount := 0 | ||
vmNames := make(map[string]bool) // for validating that vmnames are unique | ||
for _, node := range nodes { | ||
if node.Properties.NodeType == "database" { | ||
databaseNodeCount++ | ||
} | ||
|
||
if err := ValidateNodeProperties(node.Properties); err != nil { | ||
return err | ||
} | ||
|
||
if _, ok := vmNames[node.VmName]; ok { | ||
return fmt.Errorf("vmName %s is already specified", node.VmName) | ||
} | ||
vmNames[node.VmName] = true | ||
} | ||
|
||
if databaseNodeCount < 3 { | ||
return fmt.Errorf("high Availability requires at least 3 nodes database nodes") | ||
} | ||
return nil | ||
} | ||
|
||
func ValidateNodeProperties(np NodeProperties) error { | ||
if !typeOptions[np.NodeType] { | ||
return fmt.Errorf("invalid NodeType in Node Properties: %s", np.NodeType) | ||
} | ||
|
||
if !roleOptions[np.Role] { | ||
return fmt.Errorf("invalid Role in Node Properties: %s", np.Role) | ||
} | ||
|
||
if !failoverOptions[np.FailoverMode] { | ||
return fmt.Errorf("invalid FailoverMode in Node Properties: %s", np.FailoverMode) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to validate this in web hooks. e.g validate vmNames being unique, properties correctly defined, etc.