Skip to content
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
48 changes: 45 additions & 3 deletions cmd/config-sync-controllers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
"k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth"

"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -40,6 +41,11 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

configv1 "github.com/openshift/api/config/v1"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
"github.com/openshift/library-go/pkg/operator/events"

configv1client "github.com/openshift/client-go/config/clientset/versioned"
configinformers "github.com/openshift/client-go/config/informers/externalversions"

"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/controllers"
"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/restmapper"
Expand Down Expand Up @@ -79,6 +85,12 @@ func main() {
"The namespace for managed objects, target cloud-conf in particular.",
)

recorderName := "cloud-controller-manager-operator-cloud-config-sync-controller"
missingVersion := "0.0.1-snapshot"
desiredVersion := controllers.GetReleaseVersion()
sharedClock := clock.RealClock{}
ctx := ctrl.SetupSignalHandler()

// Once all the flags are regitered, switch to pflag
// to allow leader lection flags to be bound
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
Expand Down Expand Up @@ -131,7 +143,36 @@ func main() {
os.Exit(1)
}

sharedClock := clock.RealClock{}
// Feature gate accessor
configClient, err := configv1client.NewForConfig(mgr.GetConfig())
if err != nil {
setupLog.Error(err, "unable to create config client")
os.Exit(1)
}
kubeClient, err := kubernetes.NewForConfig(mgr.GetConfig())
if err != nil {
setupLog.Error(err, "unable to create kube client")
os.Exit(1)
}

configInformers := configinformers.NewSharedInformerFactory(configClient, 10*time.Minute)
controllerRef, err := events.GetControllerReferenceForCurrentPod(ctx, kubeClient, *managedNamespace, nil)
if err != nil {
klog.Warningf("unable to get owner reference (falling back to namespace): %v", err)
}

featureGateAccessor := featuregates.NewFeatureGateAccess(
desiredVersion, missingVersion,
configInformers.Config().V1().ClusterVersions(), configInformers.Config().V1().FeatureGates(),
events.NewKubeRecorder(kubeClient.CoreV1().Events(*managedNamespace), recorderName, controllerRef, sharedClock),
)
featureGateAccessor.SetChangeHandler(func(featureChange featuregates.FeatureChange) {
// Do nothing here. The controller watches feature gate changes and will react to them.
klog.InfoS("FeatureGates changed", "enabled", featureChange.New.Enabled, "disabled", featureChange.New.Disabled)
})
go featureGateAccessor.Run(ctx)
go configInformers.Start(ctx.Done())

if err = (&controllers.CloudConfigReconciler{
ClusterOperatorStatusClient: controllers.ClusterOperatorStatusClient{
Client: mgr.GetClient(),
Expand All @@ -140,7 +181,8 @@ func main() {
ReleaseVersion: controllers.GetReleaseVersion(),
ManagedNamespace: *managedNamespace,
},
Scheme: mgr.GetScheme(),
Scheme: mgr.GetScheme(),
FeatureGateAccess: featureGateAccessor,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create cloud-config sync controller", "controller", "ClusterOperator")
os.Exit(1)
Expand Down Expand Up @@ -171,7 +213,7 @@ func main() {
}

setupLog.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
if err := mgr.Start(ctx); err != nil {
setupLog.Error(err, "problem running manager")
os.Exit(1)
}
Expand Down
15 changes: 8 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/go-logr/logr v1.4.3
github.com/golangci/golangci-lint v1.62.2
github.com/onsi/ginkgo/v2 v2.23.4
github.com/onsi/gomega v1.37.0
github.com/openshift/api v0.0.0-20250724151358-f313adb86331
github.com/onsi/ginkgo/v2 v2.25.1
github.com/onsi/gomega v1.38.2
github.com/openshift/api v0.0.0-20260923123119-b32f49f8a709
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20250122171707-86066d47a264
github.com/openshift/library-go v0.0.0-20250724123005-03d85c4e997c
github.com/openshift/library-go v0.0.0-20260922150051-30da7232d143
github.com/spf13/cobra v1.9.1
github.com/spf13/pflag v1.0.6
github.com/stretchr/testify v1.10.0
gopkg.in/gcfg.v1 v1.2.3
gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.33.2
k8s.io/apiextensions-apiserver v0.33.2
k8s.io/apimachinery v0.33.2
Expand Down Expand Up @@ -65,7 +64,7 @@ require (
github.com/Crocmagnon/fatcontext v0.5.3 // indirect
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect
github.com/alecthomas/go-check-sumtype v0.2.0 // indirect
github.com/alexkohler/nakedret/v2 v2.0.5 // indirect
Expand Down Expand Up @@ -262,6 +261,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.48.0 // indirect
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect
Expand All @@ -277,10 +277,11 @@ require (
golang.org/x/tools/go/expect v0.1.1-deprecated // indirect
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
google.golang.org/protobuf v1.36.7 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.5.1 // indirect
k8s.io/apiserver v0.33.2 // indirect
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rW
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU=
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0/go.mod h1:ONJg5sxcbsdQQ4pOW8TGdTidT2TMAUy/2Xhr8mrYaao=
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA=
github.com/OpenPeeDeeP/depguard/v2 v2.2.0/go.mod h1:CIzddKRvLBC4Au5aYP/i3nyaWQ+ClszLIuVocRiCYFQ=
github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk=
Expand Down Expand Up @@ -390,20 +390,20 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus=
github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8=
github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y=
github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
github.com/onsi/ginkgo/v2 v2.25.1 h1:Fwp6crTREKM+oA6Cz4MsO8RhKQzs2/gOIVOUscMAfZY=
github.com/onsi/ginkgo/v2 v2.25.1/go.mod h1:ppTWQ1dh9KM/F1XgpeRqelR+zHVwV81DGRSDnFxK7Sk=
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
github.com/openshift-sustaining/net v0.50.0-sec.4 h1:jmkVQIRNrS0DAs24K0yLYJHqH5e+svnbXb/ihoTPKRs=
github.com/openshift-sustaining/net v0.50.0-sec.4/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM=
github.com/openshift/api v0.0.0-20250724151358-f313adb86331 h1:97Hz1Gfcq1JgCShhjL31D/0dCt28Zk/NrMisTS1JrKE=
github.com/openshift/api v0.0.0-20250724151358-f313adb86331/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
github.com/openshift/api v0.0.0-20260923123119-b32f49f8a709 h1:4+OKNqHoQ9e4v6LdPFpjpiJXs1UJklvNiPo4O80jO8I=
github.com/openshift/api v0.0.0-20260923123119-b32f49f8a709/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee h1:tOtrrxfDEW8hK3eEsHqxsXurq/D6LcINGfprkQC3hqY=
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee/go.mod h1:zhRiYyNMk89llof2qEuGPWPD+joQPhCRUc2IK0SB510=
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20250122171707-86066d47a264 h1:KoJiId8Ynajf/ZFodvmayFkDODIL7Vow3LmgR5+oVRg=
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20250122171707-86066d47a264/go.mod h1:d6xqfLy/cKEGUKfounNsWdAhWAcUYfZyuDgHBCQyfeM=
github.com/openshift/library-go v0.0.0-20250724123005-03d85c4e997c h1:KG1U3r4ocDe39/Mvc6oxgDoi9YlCrWAor6n+uvJzRok=
github.com/openshift/library-go v0.0.0-20250724123005-03d85c4e997c/go.mod h1:tptKNust9MdRI0p90DoBSPHIrBa9oh+Rok59tF0vT8c=
github.com/openshift/library-go v0.0.0-20260922150051-30da7232d143 h1:LDrp4LK4HwhTR2hlvSk6P/RTyR3e40oaiSF525ZwX+A=
github.com/openshift/library-go v0.0.0-20260922150051-30da7232d143/go.mod h1:rZWS5OIAy95n/PEfn6PGV0AFN0f3j4fCGgTsvUUBo2s=
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
Expand Down Expand Up @@ -591,8 +591,8 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
go.yaml.in/yaml/v3 v3.0.3 h1:bXOww4E/J3f66rav3pX3m8w6jDE4knZjGOw8b5Y6iNE=
go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
Expand Down Expand Up @@ -733,8 +733,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw=
gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A=
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ rules:
- get
- list
- watch
- create
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand Down
4 changes: 3 additions & 1 deletion pkg/cloud/aws/aws_config_transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"gopkg.in/ini.v1"

awsconfig "k8s.io/cloud-provider-aws/pkg/providers/v1/config"

"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
)

// defaultConfig is a string holding the absolute bare minimum INI string that the AWS CCM needs to start.
Expand All @@ -20,7 +22,7 @@ const defaultConfig = `[Global]

// CloudConfigTransformer is used to inject OpenShift configuration defaults into the Cloud Provider config
// for the AWS Cloud Provider. If an empty source string is provided, a minimal default configuration will be created.
func CloudConfigTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network) (string, error) {
func CloudConfigTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network, features featuregates.FeatureGate) (string, error) {
cfg, err := readAWSConfig(source)
if err != nil {
return "", fmt.Errorf("failed to read the cloud.conf: %w", err)
Expand Down
4 changes: 3 additions & 1 deletion pkg/cloud/aws/aws_config_transformer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"testing"

. "github.com/onsi/gomega"

"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
)

func TestCloudConfigTransformer(t *testing.T) {
Expand Down Expand Up @@ -87,7 +89,7 @@ SigningRegion = signing_region
t.Run(tc.name, func(t *testing.T) {
g := NewWithT(t)

gotConfig, err := CloudConfigTransformer(tc.source, nil, nil) // No Infra or Network are required for the current functionality.
gotConfig, err := CloudConfigTransformer(tc.source, nil, nil, featuregates.NewFeatureGate(nil, nil)) // No Infra or Network are required for the current functionality.
g.Expect(err).ToNot(HaveOccurred())

g.Expect(gotConfig).To(Equal(tc.expected))
Expand Down
3 changes: 2 additions & 1 deletion pkg/cloud/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/cloud/common"
"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/config"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
)

const providerName = "azure"
Expand Down Expand Up @@ -136,7 +137,7 @@ func IsAzure(infra *configv1.Infrastructure) bool {
return false
}

func CloudConfigTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network) (string, error) {
func CloudConfigTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network, features featuregates.FeatureGate) (string, error) {
if !IsAzure(infra) {
return "", fmt.Errorf("invalid platform, expected CloudName to be %s", configv1.AzurePublicCloud)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/cloud/azure/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/onsi/gomega/format"
configv1 "github.com/openshift/api/config/v1"
"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/config"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
"github.com/stretchr/testify/assert"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -259,7 +260,7 @@ func TestCloudConfigTransformer(t *testing.T) {
src, err := json.Marshal(tc.source)
g.Expect(err).NotTo(HaveOccurred(), "Marshal of source data should succeed")

actual, err := CloudConfigTransformer(string(src), tc.infra, nil)
actual, err := CloudConfigTransformer(string(src), tc.infra, nil, featuregates.NewFeatureGate(nil, nil))
if tc.errMsg != "" {
g.Expect(err).Should(MatchError(tc.errMsg))
g.Expect(actual).Should(Equal(""))
Expand Down
3 changes: 2 additions & 1 deletion pkg/cloud/azurestack/azurestack.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/cloud/common"
"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/config"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
)

const providerName = "azurestack"
Expand Down Expand Up @@ -104,7 +105,7 @@ func IsAzureStackHub(platformStatus *configv1.PlatformStatus) bool {
// modifies it to be compatible with the external cloud provider. It returns
// an error if the platform is not OpenStackPlatformType or if any errors are
// encountered while attempting to rework the configuration.
func CloudConfigTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network) (string, error) {
func CloudConfigTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network, features featuregates.FeatureGate) (string, error) {
if !IsAzureStackHub(infra.Status.PlatformStatus) {
return "", fmt.Errorf("invalid platform, expected CloudName to be %s", configv1.AzureStackCloud)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/cloud/azurestack/azurestack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/assert"

"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/config"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
)

const (
Expand Down Expand Up @@ -144,7 +145,7 @@ func TestCloudConfigTransformer(t *testing.T) {
src, err := json.Marshal(tc.source)
g.Expect(err).NotTo(HaveOccurred(), "Marshal of source data should succeed")

actual, err := CloudConfigTransformer(string(src), tc.infra, nil)
actual, err := CloudConfigTransformer(string(src), tc.infra, nil, featuregates.NewFeatureGate(nil, nil))
if tc.errMsg != "" {
g.Expect(err).Should(MatchError(tc.errMsg))
g.Expect(actual).Should(Equal(""))
Expand Down
3 changes: 2 additions & 1 deletion pkg/cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/cloud/common"
"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/config"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"

"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/cloud/aws"
"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/cloud/azure"
Expand All @@ -23,7 +24,7 @@ import (
// cloudConfigTransformer function transforms the source config map using the input infrastructure.config.openshift.io
// and network.config.openshift.io objects. Only the data and binaryData field of the output ConfigMap will be respected by
// consumer of the transformer.
type cloudConfigTransformer func(source string, infra *configv1.Infrastructure, network *configv1.Network) (string, error)
type cloudConfigTransformer func(source string, infra *configv1.Infrastructure, network *configv1.Network, features featuregates.FeatureGate) (string, error)

// GetCloudConfigTransformer returns the function that should be used to transform
// the cloud configuration config map, and a boolean to indicate if the config should
Expand Down
4 changes: 3 additions & 1 deletion pkg/cloud/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package common

import (
configv1 "github.com/openshift/api/config/v1"

"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
)

// NoOpTransformer implements the cloudConfigTransformer. It makes no changes
// to the source configuration and simply returns it as-is.
func NoOpTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network) (string, error) {
func NoOpTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network, features featuregates.FeatureGate) (string, error) {
return source, nil
}
3 changes: 2 additions & 1 deletion pkg/cloud/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/cloud/common"
"github.com/openshift/cluster-cloud-controller-manager-operator/pkg/config"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
)

const providerName = "openstack"
Expand Down Expand Up @@ -142,7 +143,7 @@ func NewProviderAssets(config config.OperatorConfig) (common.CloudProviderAssets
// modifies it to be compatible with the external cloud provider. It returns
// an error if the platform is not OpenStackPlatformType or if any errors are
// encountered while attempting to rework the configuration.
func CloudConfigTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network) (string, error) {
func CloudConfigTransformer(source string, infra *configv1.Infrastructure, network *configv1.Network, features featuregates.FeatureGate) (string, error) {
if infra.Status.PlatformStatus == nil ||
infra.Status.PlatformStatus.Type != configv1.OpenStackPlatformType {
return "", fmt.Errorf("invalid platform, expected to be %s", configv1.OpenStackPlatformType)
Expand Down
Loading