controller-runtime icon indicating copy to clipboard operation
controller-runtime copied to clipboard

:seedling: Register kubeconfig flag variable via RegisterFlags func

Open johannesfrey opened this issue 3 years ago • 11 comments

There have been reported issues (flag redefined) because CR registers the kubeconfig flag to the default command line FlagSet via init function. See:

  • https://github.com/kubernetes-sigs/controller-runtime/issues/1396
  • https://github.com/kubernetes-sigs/controller-runtime/issues/878

This PR provides an exported func to register flags that defensively tries to register the kubeconfig flag if not already defined. It does only change the current behaviour by previously checking if has already been defined.

As a follow up the registration via init should probably removed in conjunction with a :warning: release note, as it would be a breaking change for the user.

NOTE: I am not entirely sure if this really is the desired way to go and to start a discussion regarding the topic.

Johannes Frey <[email protected]>, Mercedes-Benz Tech Innovation GmbH (Provider Information)

johannesfrey avatar Sep 13 '22 07:09 johannesfrey

/test pull-controller-runtime-test-master

johannesfrey avatar Sep 20 '22 08:09 johannesfrey

/retest

johannesfrey avatar Sep 20 '22 08:09 johannesfrey

/label do-not-merge/work-in-progress

johannesfrey avatar Sep 20 '22 09:09 johannesfrey

@johannesfrey: The label(s) /label do-not-merge/work-in-progress cannot be applied. These labels are supported: api-review, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, team/katacoda, refactor

In response to this:

/label do-not-merge/work-in-progress

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.

k8s-ci-robot avatar Sep 20 '22 09:09 k8s-ci-robot

/label do-not-merge/work-in-progress

I think if you move [WIP] to be a prefix it should work automatically

sbueringer avatar Sep 20 '22 11:09 sbueringer

/retitle [WIP] :seedling: Register kubeconfig flag variable via RegisterFlags func

sbueringer avatar Sep 20 '22 11:09 sbueringer

/label do-not-merge/work-in-progress

I think if you move [WIP] to be a prefix it should work automatically

Yeah, I had it like that but then workflow complains :sweat_smile:

johannesfrey avatar Sep 20 '22 11:09 johannesfrey

/label do-not-merge/work-in-progress

I think if you move [WIP] to be a prefix it should work automatically

Yeah, I had it like that but then workflow complains sweat_smile

This can be fixed/changed by bumping kubebuilder-release-tools to v0.2.0: https://github.com/kubernetes-sigs/controller-runtime/blob/master/.github/workflows/verify.yml#L12

sbueringer avatar Sep 20 '22 11:09 sbueringer

/retest

johannesfrey avatar Oct 06 '22 13:10 johannesfrey

/retest

johannesfrey avatar Oct 06 '22 14:10 johannesfrey

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, johannesfrey

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

k8s-ci-robot avatar Oct 26 '22 21:10 k8s-ci-robot