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

Bug 1888601: Fixes policyClient and the corresponding config. #225

Merged
merged 2 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions manifests/03-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ rules:
- namespaces
verbs:
- get
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- list
- get
- watch

---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -136,6 +128,22 @@ rules:
- get
- list
- watch
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- list
- get
- watch
- apiGroups:
- machine.openshift.io
resources:
- machinesets
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
12 changes: 6 additions & 6 deletions pkg/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ func (s *Support) Run(ctx context.Context, controller *controllercmd.ControllerC
if err != nil {
return err
}
policyClient, err := policyclient.NewForConfig(controller.KubeConfig)
if err != nil {
return err
}

// these are gathering clients
gatherProtoKubeConfig := rest.CopyConfig(controller.ProtoKubeConfig)
if len(s.Impersonate) > 0 {
Expand Down Expand Up @@ -124,6 +119,11 @@ func (s *Support) Run(ctx context.Context, controller *controllercmd.ControllerC
return err
}

gatherPolicyClient, err := policyclient.NewForConfig(gatherKubeConfig)
if err != nil {
return err
}

registryClient, err := imageregistryv1client.NewForConfig(gatherKubeConfig)
if err != nil {
return err
Expand Down Expand Up @@ -161,7 +161,7 @@ func (s *Support) Run(ctx context.Context, controller *controllercmd.ControllerC

// the gatherers periodically check the state of the cluster and report any
// config to the recorder
configPeriodic := clusterconfig.New(gatherConfigClient, gatherKubeClient.CoreV1(), gatherKubeClient.CertificatesV1beta1(), metricsClient, registryClient.ImageregistryV1(), crdClient, gatherNetworkClient, dynamicClient, policyClient)
configPeriodic := clusterconfig.New(gatherConfigClient, gatherKubeClient.CoreV1(), gatherKubeClient.CertificatesV1beta1(), metricsClient, registryClient.ImageregistryV1(), crdClient, gatherNetworkClient, dynamicClient, gatherPolicyClient)
periodic := periodic.New(configObserver, recorder, map[string]gather.Interface{
"config": configPeriodic,
})
Expand Down