Skip to content
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

PWX-32230: Supporting unidirectional clusterpair creation with storkctl create command. #1455

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

diptiranjanpx
Copy link
Contributor

Signed-Off-By: Diptiranjan

What type of PR is this?
improvement

What this PR does / why we need it:
With storkctl create option, we can create unidirectional cluster pair.

Does this PR change a user-facing CRD or CLI?:

git:(PWX-32230) ✗ bin/linux/storkctl create clusterpair uni-cp -p s3 -n kube-system --src-kube-file /tmp/dipti5.config --dest-kube-file /tmp/dipti7.config --s3-access-key ***** --s3-secret-key ****** --s3-endpoint ********* --s3-region us-east1 --uni-directional
Destination portworx endpoint is 10.10.100.100:9001
Fetching px token with auth token in destination cluster

Creating Secret and Backuplocation in source cluster in namespace kube-system...
Backuplocation uni-cp created on source cluster in namespace kube-system

Creating a cluster pair. Direction: Source -> Destination
ClusterPair uni-cp created successfully. Direction Source -> Destination

Is a release note needed?:

Does this change need to be cherry-picked to a release branch?:

Test
Test result has been updated in PWX-32230.

@cnbu-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Patch coverage: 31.25% and project coverage change: +0.62 🎉

Comparison is base (04b1cd1) 66.05% compared to head (b033991) 66.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1455      +/-   ##
==========================================
+ Coverage   66.05%   66.68%   +0.62%     
==========================================
  Files          43       43              
  Lines        4984     4991       +7     
==========================================
+ Hits         3292     3328      +36     
+ Misses       1373     1339      -34     
- Partials      319      324       +5     
Impacted Files Coverage Δ
pkg/storkctl/clusterpair.go 23.24% <15.38%> (+5.28%) ⬆️
pkg/storkctl/generate.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -598,7 +606,7 @@ func newCreateClusterPairCommand(cmdFactory Factory, ioStreams genericclioptions
createClusterPairCommand.Flags().StringVarP(&destToken, "dest-token", "", "", "(Optional)Destination cluster token for cluster pairing")
createClusterPairCommand.Flags().StringVarP(&projectMappingsStr, "project-mappings", "", "", projectMappingHelpString)
createClusterPairCommand.Flags().StringVarP(&mode, "mode", "", "async-dr", "Mode of DR. [async-dr, sync-dr]")

createClusterPairCommand.Flags().BoolVarP(&uniDirectional, "uni-directional", "u", false, "Required to create Clusterpair from source -> dest only")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of "Required to", I think we can mention (Optional) To

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -430,7 +434,7 @@ func newCreateClusterPairCommand(cmdFactory Factory, ioStreams genericclioptions
credentialData["encryptionKey"] = []byte(encryptionKey)

// Bail out if portworx-api service type is not loadbalancer type and the endpoints are not provided.
if len(sEP) == 0 {
if !uniDirectional && len(sEP) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to understand change in this line. Can you please explain?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have to figure out portworx endpoint in source cluster for unidirectional clusterpair.
Also with this check the output of unidirectional create command does not print the following kind of line
Source portworx endpoint is 10.10.101.100:9001

@pp511
Copy link
Contributor

pp511 commented Jul 18, 2023

UTs for this package already exists. We should update the UTs to account for the code coverage.

@diptiranjanpx diptiranjanpx force-pushed the PWX-32230 branch 2 times, most recently from d91c52b to 187ee4a Compare July 19, 2023 14:38
@diptiranjanpx
Copy link
Contributor Author

UTs for this package already exists. We should update the UTs to account for the code coverage.

Added.

@@ -253,6 +253,7 @@ func newCreateClusterPairCommand(cmdFactory Factory, ioStreams genericclioptions
var syncDR bool
var pxAuthTokenSrc, pxAuthSecretNamespaceSrc string
var pxAuthTokenDest, pxAuthSecretNamespaceDest string
var uniDirectional bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit..unidirectional

@pp511
Copy link
Contributor

pp511 commented Jul 19, 2023

Looks good.

@diptiranjanpx diptiranjanpx merged commit a2a5e83 into master Jul 20, 2023
3 of 4 checks passed
@diptiranjanpx diptiranjanpx deleted the PWX-32230 branch May 27, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants