Skip to content

Commit

Permalink
Merge pull request #226 from 0sewa0/4.6_policyClient_fix
Browse files Browse the repository at this point in the history
[release 4.6] Bug 1888602: Fixes policyClient and the corresponding config.
  • Loading branch information
openshift-merge-robot committed Dec 6, 2020
2 parents ad08fad + 591f2fe commit 52eb982
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
24 changes: 16 additions & 8 deletions manifests/03-clusterrole.yaml
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
Expand Up @@ -73,11 +73,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 @@ -122,6 +117,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 @@ -159,7 +159,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

0 comments on commit 52eb982

Please sign in to comment.