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

🌱 Add --labels to kubectl kcp workload sync #2815

Conversation

fabriziopandini
Copy link
Contributor

Summary

This PR adds a --labels flag to be used for setting labels in the SyncTarget created by kcp workload sync, thus allowing to easier to test scenarios like the east/west workload placement described in this PR (it is not required anymore to patch SyncTarget after they are created).

The same capability is added to the syncerFixture in the test framework

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 19, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 19, 2023

Hi @fabriziopandini. Thanks for your PR.

I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@davidfestal davidfestal left a comment

Choose a reason for hiding this comment

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

Thanks for this PR !
Just a few minor comments

@@ -140,6 +142,7 @@ func (o *SyncOptions) BindFlags(cmd *cobra.Command) {
"Options are:\n"+strings.Join(kcpfeatures.KnownFeatures(), "\n")) // hide kube-only gates
cmd.Flags().DurationVar(&o.APIImportPollInterval, "api-import-poll-interval", o.APIImportPollInterval, "Polling interval for API import.")
cmd.Flags().DurationVar(&o.DownstreamNamespaceCleanDelay, "downstream-namespace-clean-delay", o.DownstreamNamespaceCleanDelay, "Time to wait before deleting a downstream namespaces.")
cmd.Flags().StringVar(&o.SyncTargetLabels, "labels", o.SyncTargetLabels, "A set of key=value pairs to be used as a labels for the sync target in kcp")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cmd.Flags().StringVar(&o.SyncTargetLabels, "labels", o.SyncTargetLabels, "A set of key=value pairs to be used as a labels for the sync target in kcp")
cmd.Flags().StringVar(&o.SyncTargetLabels, "labels", o.SyncTargetLabels, "A set of key=value pairs to be used as labels on the SyncTarget created in kcp")

Copy link
Member

Choose a reason for hiding this comment

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

Should we also mention the fact that they would be comma-separated ?

Copy link
Member

Choose a reason for hiding this comment

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

Also why not use a StringSliceVar as for apiexports or resources arguments ?
This would take care of the comma-separated part of it, as the doc mentions

--ss="v1,v2" --ss="v3"
will result in

[]string{"v1", "v2", "v3"}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion, done!
now you can do

kubectl kcp workload sync west --replicas=0 --syncer-image=syncer --output-file=west-syncer.yaml \
     --labels=region=east,foo=bar \
     --labels=bar=baz

Copy link
Member

Choose a reason for hiding this comment

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

Nice

@davidfestal
Copy link
Member

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 20, 2023
@davidfestal davidfestal added the area/transparent-multi-cluster Related to scheduling of workloads into pclusters. label Feb 20, 2023
@fabriziopandini
Copy link
Contributor Author

comment addressed, test errors seem a flake but I will check again after tests for this latest commit completes

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidfestal

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 21, 2023
@davidfestal
Copy link
Member

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 21, 2023
@davidfestal
Copy link
Member

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 21, 2023
@openshift-merge-robot openshift-merge-robot merged commit c4a476c into kcp-dev:main Feb 21, 2023
@fabriziopandini fabriziopandini deleted the add-labels-to-kcp-workload-sync branch March 24, 2023 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/transparent-multi-cluster Related to scheduling of workloads into pclusters. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants