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-32573: Creating namespaces as part of clusterpair creation if the input namespace does not exist. #1467

Merged
merged 1 commit into from
Jul 28, 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:
Create namespaces in source and dest clusters if it does not exist as part of clusterpair creation.

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

Is a release note needed?:

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

Test

1. Creating bidirectional clusterpair when namespaces don’t exist in both source and dest cluster.

➜  stork git:(PWX-32573) ✗ kubectl get ns ns1
Error from server (NotFound): namespaces "ns1" not found

➜  ~ kubectl get ns ns1
Error from server (NotFound): namespaces "ns1" not found

➜  stork git:(PWX-32573) ✗ bin/linux/storkctl create clusterpair cp-ns1 -n ns1 --src-kube-file /tmp/dipti5.config --dest-kube-file /tmp/dipti7.config  --s3-access-key ***** --s3-secret-key ******--s3-endpoint ******* --s3-region us-east1 -p s3
Source portworx endpoint is 10.13.192.154:9001
Destination portworx endpoint is 10.13.194.128:9001
Fetching px token with auth token in destination cluster

Creating Secret and ObjectstoreLocation in source cluster in namespace ns1...
ObjectstoreLocation cp-ns1 created on source cluster in namespace ns1

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

Fetching px token with auth token in source cluster
Creating Secret and ObjectstoreLocation in destination cluster in namespace ns1...
ObjectstoreLocation cp-ns1 created on destination cluster in namespace ns1

Creating a cluster pair. Direction: Destination -> Source
Cluster pair cp-ns1 created successfully. Direction: Destination -> Source

In source:
➜  stork git:(PWX-32573) ✗ storkctl get clusterpair -n ns1
NAME     STORAGE-STATUS   SCHEDULER-STATUS   CREATED
cp-ns1   Ready            Ready              27 Jul 23 12:14 UTC

In dest:
➜  ~ storkctl get clusterpair -n ns1
NAME     STORAGE-STATUS   SCHEDULER-STATUS   CREATED
cp-ns1   Ready            Ready              27 Jul 23 12:14 UTC

Other test results have been updated in PWX-32573.

@cnbu-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

func createNamespace(config string, namespace string) error {
conf, err := getConfig(config).ClientConfig()
if err != nil {
util.CheckErr(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

The caller is going to print this error, so we can skip it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, I removed from this function.

@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.47% ⚠️

Comparison is base (0f8e630) 66.68% compared to head (989ddb9) 66.21%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1467      +/-   ##
==========================================
- Coverage   66.68%   66.21%   -0.47%     
==========================================
  Files          43       43              
  Lines        4991     5026      +35     
==========================================
  Hits         3328     3328              
- Misses       1339     1374      +35     
  Partials      324      324              
Files Changed Coverage Δ
pkg/storkctl/clusterpair.go 21.93% <0.00%> (-1.32%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@pp511 pp511 left a comment

Choose a reason for hiding this comment

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

lgtm

@diptiranjanpx diptiranjanpx merged commit 0eda3fe into master Jul 28, 2023
2 of 4 checks passed
@diptiranjanpx diptiranjanpx deleted the PWX-32573 branch May 27, 2024 08:25
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.

4 participants