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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/gonum/graph v0.0.0-20170401004347-50b27dea7ebb
github.com/google/go-cmp v0.5.9
github.com/openshift/api v0.0.0-20230426193520-54a14470e5dc
github.com/openshift/api v0.0.0-20230502141037-a22bd9995471
github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d
github.com/openshift/client-go v0.0.0-20230120202327-72f107311084
github.com/openshift/library-go v0.0.0-20230501134757-c3f6a3f540c5
github.com/openshift/library-go v0.0.0-20230502160234-500059c0376f
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/common v0.37.0
github.com/spf13/cobra v1.6.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,14 @@ github.com/onsi/ginkgo/v2 v2.4.0 h1:+Ig9nvqgS5OBSACXNk15PLdp0U9XPYROt9CFzVdFGIs=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys=
github.com/openshift/api v0.0.0-20230426193520-54a14470e5dc h1:U/ran9ckjGV/aSVTrWHFa/DY2L4Y1PT5N0lSDe/4of4=
github.com/openshift/api v0.0.0-20230426193520-54a14470e5dc/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4=
github.com/openshift/api v0.0.0-20230502141037-a22bd9995471 h1:3yy5gCHc/eFKRu+x7UwPZq/PVqqT31wnBa1LcT2x2v8=
github.com/openshift/api v0.0.0-20230502141037-a22bd9995471/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4=
github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d h1:RR4ah7FfaPR1WePizm0jlrsbmPu91xQZnAsVVreQV1k=
github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/client-go v0.0.0-20230120202327-72f107311084 h1:66uaqNwA+qYyQDwsMWUfjjau8ezmg1dzCqub13KZOcE=
github.com/openshift/client-go v0.0.0-20230120202327-72f107311084/go.mod h1:M3h9m001PWac3eAudGG3isUud6yBjr5XpzLYLLTlHKo=
github.com/openshift/library-go v0.0.0-20230501134757-c3f6a3f540c5 h1:g4rKtkEhi/nqBtiuKQ3JamwLT7/Pdb5NC/PfhbAyQcM=
github.com/openshift/library-go v0.0.0-20230501134757-c3f6a3f540c5/go.mod h1:JLv17uWyQvoK14yxp7h2vBJ8zz2xkWqanOv5TzuFkvY=
github.com/openshift/library-go v0.0.0-20230502160234-500059c0376f h1:pdGIBN2C2pm4ckYQfjMSSsdPgRG/lpvt3kuI0APY6T0=
github.com/openshift/library-go v0.0.0-20230502160234-500059c0376f/go.mod h1:JLv17uWyQvoK14yxp7h2vBJ8zz2xkWqanOv5TzuFkvY=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
Expand Down
33 changes: 31 additions & 2 deletions pkg/cmd/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
kubecontrolplanev1 "github.com/openshift/api/kubecontrolplane/v1"
"github.com/openshift/cluster-kube-controller-manager-operator/bindata"
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/operator/targetconfigcontroller"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
genericrender "github.com/openshift/library-go/pkg/operator/render"
genericrenderoptions "github.com/openshift/library-go/pkg/operator/render/options"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -134,6 +135,23 @@ func setFeatureGates(renderConfig *TemplateData, opts *renderOpts) error {
return nil
}

func setFeatureGatesFromAccessor(renderConfig *TemplateData, featureGates featuregates.FeatureGateAccess) error {
currFeatureGates, err := featureGates.CurrentFeatureGates()
if err != nil {
return fmt.Errorf("unable to get FeatureGates: %w", err)
}
allGates := []string{}
for _, featureGateName := range currFeatureGates.KnownFeatures() {
if currFeatureGates.Enabled(featureGateName) {
allGates = append(allGates, fmt.Sprintf("%v=true", featureGateName))
} else {
allGates = append(allGates, fmt.Sprintf("%v=false", featureGateName))
}
}
renderConfig.FeatureGates = allGates
return nil
}

func discoverRestrictedCIDRs(clusterConfigFileData []byte, renderConfig *TemplateData) error {
if err := discoverRestrictedCIDRsFromNetwork(clusterConfigFileData, renderConfig); err != nil {
if err = discoverRestrictedCIDRsFromClusterAPI(clusterConfigFileData, renderConfig); err != nil {
Expand Down Expand Up @@ -228,9 +246,20 @@ func (r *renderOpts) Run() error {
return fmt.Errorf("unable to parse restricted CIDRs from config: %v", err)
}
}
if err := setFeatureGates(&renderConfig, r); err != nil {
return err

featureGates, err := r.generic.FeatureGates()
if err != nil {
klog.Warningf(fmt.Sprintf("error getting FeatureGates: %v", err))
if err := setFeatureGates(&renderConfig, r); err != nil {
return err
}

} else {
if err := setFeatureGatesFromAccessor(&renderConfig, featureGates); err != nil {
return err
}
}

if err := r.manifest.ApplyTo(&renderConfig.ManifestConfig); err != nil {
return err
}
Expand Down

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.

Loading