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
refactor cluster policy controller and NamespaceSCCAllocationController #65
refactor cluster policy controller and NamespaceSCCAllocationController #65
Conversation
// leader election and other "normal" behaviors. | ||
// The context passed will be passed down to controller loops and observers and cancelled on SIGTERM and SIGINT signals. | ||
// copied from controllercmd.ControllerCommandConfig | ||
func (c *ClusterPolicyControllerCommandConfig) NewCommandWithContext(ctx context.Context) *cobra.Command { |
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.
This is copy pasted logic for now, since we need a custom logic in StartController and access to the internal variables.
I will make a PR against library-go so this could be customizable and we could avoid copy paste
/hold |
you will want to wait for #61 to land, it's also bumping all deps |
will rebase once it merges, but it is missing the bump in |
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.
Leaving some comments, but I'll have another look once the other merges and this gets rebased. Also please put all the vendor changes into single commit.
// for metrics | ||
_ "github.com/openshift/library-go/pkg/controller/metrics" | ||
|
||
clusterpolicyversion "github.com/openshift/cluster-policy-controller/pkg/version" |
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.
Keep openshift imports in a single group above.
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.
To be clear: are we splitting openshift imports from this repo vs other repos into the groups or not? (am not sure if you are pointing out just the metrics)
KubeConfigFile string | ||
func NewClusterPolicyControllerCommand(name string) *cobra.Command { | ||
cmd := NewClusterPolicyControllerCommandConfig("cluster-policy-controller", clusterpolicyversion.Get(), RunClusterPolicyController). | ||
NewCommandWithContext(context.TODO()) |
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.
context.Background()
?
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.
I am little bit confused by It is never canceled
: https://golang.org/pkg/context/#Background . Nevertheless, I updated the code.
4094754
to
1bb82f1
Compare
1bb82f1
to
a7e6813
Compare
@soltysh the code was simplified to use only the default config . There are some changes to the operator that need to be merged openshift/cluster-kube-controller-manager-operator#545 . What is the order of merging when we need both of these changes at the same time? |
4040f2a
to
65e972a
Compare
65e972a
to
9d228b2
Compare
- k8s to v0.21.2 - library-go
9d228b2
to
d4c6c84
Compare
rebased and using WithComponentOwnerReference @soltysh |
/retest |
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.
/lgtm
/approve
@@ -4,6 +4,7 @@ import ( | |||
"context" | |||
"errors" | |||
"fmt" | |||
"github.com/openshift/library-go/pkg/operator/events" |
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.
nit: imports order
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: atiratree, soltysh 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 |
/hold cancel |
TODO: