Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #110 from bertinatto/secret46
[release-4.6] Bug 1915467: redeploy CSI Controller Deployment when secret change
  • Loading branch information
openshift-merge-robot committed Feb 11, 2021
2 parents fdcc590 + 4a017c1 commit 71b6b96
Show file tree
Hide file tree
Showing 90 changed files with 7,538 additions and 61 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -6,7 +6,7 @@ require (
github.com/go-bindata/go-bindata v3.1.2+incompatible
github.com/openshift/api v0.0.0-20200827090112-c05698d102cf
github.com/openshift/build-machinery-go v0.0.0-20200819073603-48aa266c95f7
github.com/openshift/library-go v0.0.0-20200929145920-05013f256034
github.com/openshift/library-go v0.0.0-20210204141222-0e7715cd7725
github.com/prometheus/client_golang v1.7.1
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5
Expand Down
29 changes: 3 additions & 26 deletions go.sum

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion pkg/operator/starter.go
Expand Up @@ -11,6 +11,7 @@ import (
opv1 "github.com/openshift/api/operator/v1"
"github.com/openshift/library-go/pkg/controller/controllercmd"
"github.com/openshift/library-go/pkg/operator/csi/csicontrollerset"
"github.com/openshift/library-go/pkg/operator/csi/csidrivercontrollerservicecontroller"
goc "github.com/openshift/library-go/pkg/operator/genericoperatorclient"
"github.com/openshift/library-go/pkg/operator/staleconditions"
"github.com/openshift/library-go/pkg/operator/v1helpers"
Expand All @@ -24,12 +25,14 @@ const (
operatorName = "aws-ebs-csi-driver-operator"
operandName = "aws-ebs-csi-driver"
instanceName = "ebs.csi.aws.com"
secretName = "ebs-cloud-credentials"
)

func RunOperator(ctx context.Context, controllerConfig *controllercmd.ControllerContext) error {
// Create clientsets and informers
kubeClient := kubeclient.NewForConfigOrDie(rest.AddUserAgent(controllerConfig.KubeConfig, operatorName))
kubeInformersForNamespaces := v1helpers.NewKubeInformersForNamespaces(kubeClient, defaultNamespace, "")
secretInformer := kubeInformersForNamespaces.InformersFor(defaultNamespace).Core().V1().Secrets()

// Create GenericOperatorclient. This is used by the library-go controllers created down below
gvr := opv1.SchemeGroupVersion.WithResource("clustercsidrivers")
Expand Down Expand Up @@ -72,13 +75,15 @@ func RunOperator(ctx context.Context, controllerConfig *controllercmd.Controller
"controller.yaml",
kubeClient,
kubeInformersForNamespaces.InformersFor(defaultNamespace),
nil,
csidrivercontrollerservicecontroller.WithSecretHashAnnotationHook(defaultNamespace, secretName, secretInformer),
).WithCSIDriverNodeService(
"AWSEBSDriverNodeServiceController",
generated.MustAsset,
"node.yaml",
kubeClient,
kubeInformersForNamespaces.InformersFor(defaultNamespace),
)
).WithExtraInformers(secretInformer.Informer())

staleController := staleconditions.NewRemoveStaleConditionsController(
[]string{"ResourceSyncControllerDegraded"}, // ResourceSyncController + condition was added in 4.7
Expand Down
191 changes: 191 additions & 0 deletions vendor/github.com/openshift/client-go/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 71b6b96

Please sign in to comment.