Skip to content
Closed
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
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ require (
github.com/imdario/mergo v0.3.9
github.com/opencontainers/go-digest v1.0.0
github.com/openshift/api v0.0.0-20210629145910-15a1cae1fca8
github.com/openshift/client-go v0.0.0-20210112165513-ebc401615f47
github.com/openshift/library-go v0.0.0-20210301154249-aa29957b8a9c
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142
github.com/openshift/library-go v0.0.0-20210702104503-39570b4a2ae8
github.com/openshift/runtime-utils v0.0.0-20200415173359-c45d4ff3f912
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.1
Expand All @@ -52,9 +52,9 @@ require (
golang.org/x/net v0.0.0-20210224082022-3d97a244fca7
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
k8s.io/api v0.21.1
k8s.io/apiextensions-apiserver v0.21.0-rc.0
k8s.io/apiextensions-apiserver v0.21.1
k8s.io/apimachinery v0.21.1
k8s.io/client-go v0.21.0-rc.0
k8s.io/client-go v0.21.1
k8s.io/code-generator v0.21.1
k8s.io/kubectl v0.21.0-rc.0
k8s.io/kubelet v0.21.0-rc.0
Expand Down
16 changes: 5 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -632,14 +632,12 @@ github.com/opencontainers/selinux v1.5.2/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwy
github.com/openshift/api v0.0.0-20210629145910-15a1cae1fca8 h1:/wwYnC6F/XQJW2DyvoEZRgO2UFExBl9nSQaQbEEgbXA=
github.com/openshift/api v0.0.0-20210629145910-15a1cae1fca8/go.mod h1:izBmoXbUu3z5kUa4FjZhvekTsyzIWiOoaIgJiZBBMQs=
github.com/openshift/build-machinery-go v0.0.0-20200211121458-5e3d6e570160/go.mod h1:1CkcsT3aVebzRBzVTSbiKSkJMsC/CASqxesfqEMfJEc=
github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/build-machinery-go v0.0.0-20210423112049-9415d7ebd33e/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/client-go v0.0.0-20201214125552-e615e336eb49/go.mod h1:9/jG4I6sh+5QublJpZZ4Zs/P4/QCXMsQQ/K/058bSB8=
github.com/openshift/client-go v0.0.0-20210112165513-ebc401615f47 h1:+TEY29DK0XhqB7HFC9OfV8qf3wffSyi7MWv3AP28DGQ=
github.com/openshift/client-go v0.0.0-20210112165513-ebc401615f47/go.mod h1:u7NRAjtYVAKokiI9LouzTv4mhds8P4S1TwdVAfbjKSk=
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 h1:ZHRIMCFIJN1p9LsJt4HQ+akDrys4PrYnXzOWI5LK03I=
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142/go.mod h1:fjS8r9mqDVsPb5td3NehsNOAWa4uiFkYEfVZioQ2gH0=
github.com/openshift/library-go v0.0.0-20191003152030-97c62d8a2901/go.mod h1:NBttNjZpWwup/nthuLbPAPSYC8Qyo+BBK5bCtFoyYjo=
github.com/openshift/library-go v0.0.0-20210301154249-aa29957b8a9c h1:6yulc45KX+/9qqlW+D8oMp8C0lgqkUMYKM+oGbxX98M=
github.com/openshift/library-go v0.0.0-20210301154249-aa29957b8a9c/go.mod h1:hip2mwymSDfiip0aiTaePpUC1dxOHkjzMqaS0e3lWhw=
github.com/openshift/library-go v0.0.0-20210702104503-39570b4a2ae8 h1:vgvVr4EnUiUpl2u5QltMw3/IoBLx8SW2GRcGEXnzmGQ=
github.com/openshift/library-go v0.0.0-20210702104503-39570b4a2ae8/go.mod h1:PkxPzGpVgObkue/pqw6JSKE+z58AUcHVYgME6W4pM0g=
github.com/openshift/runtime-utils v0.0.0-20200415173359-c45d4ff3f912 h1:zPJYcr+2g68K+pEqw7crr0vLSVsYb3B82LS3y7/kxpc=
github.com/openshift/runtime-utils v0.0.0-20200415173359-c45d4ff3f912/go.mod h1:0OXNy7VoqFexkxKqyQbHJLPwn1MFp1/CxRJAgKHM+/o=
github.com/ostreedev/ostree-go v0.0.0-20190702140239-759a8c1ac913/go.mod h1:J6OG6YJVEWopen4avK3VNQSnALmmjvniMmni/YFYAwc=
Expand Down Expand Up @@ -996,7 +994,6 @@ golang.org/x/sys v0.0.0-20200610111108-226ff32320da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073 h1:8qxJSnu+7dRq6upnbntrmriWByIakBuct5OM/MdQC1M=
Expand All @@ -1017,7 +1014,6 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE=
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20170915040203-e531a2a1c15f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down Expand Up @@ -1193,7 +1189,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20190502103701-55513cacd4ae/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down Expand Up @@ -1237,7 +1232,6 @@ k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/klog/v2 v2.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts=
k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
k8s.io/kube-aggregator v0.21.0-rc.0/go.mod h1:M+whOmsAeQf8ObJ0/eO9Af1Dz2UQEB9OW9BWmt9b2sU=
Expand All @@ -1261,7 +1255,7 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
sigs.k8s.io/controller-tools v0.2.8/go.mod h1:9VKHPszmf2DHz/QmHkcfZoewO6BL7pPs9uAiBVsaJSE=
sigs.k8s.io/kube-storage-version-migrator v0.0.3/go.mod h1:mXfSLkx9xbJHQsgNDDUZK/iQTs2tMbx/hsJlWe6Fthw=
sigs.k8s.io/kube-storage-version-migrator v0.0.4/go.mod h1:mXfSLkx9xbJHQsgNDDUZK/iQTs2tMbx/hsJlWe6Fthw=
sigs.k8s.io/kustomize/api v0.8.5 h1:bfCXGXDAbFbb/Jv5AhMj2BB8a5VAJuuQ5/KU69WtDjQ=
sigs.k8s.io/kustomize/api v0.8.5/go.mod h1:M377apnKT5ZHJS++6H4rQoCHmWtt6qTpp3mbe7p6OLY=
sigs.k8s.io/kustomize/cmd/config v0.9.7/go.mod h1:MvXCpHs77cfyxRmCNUQjIqCmZyYsbn5PyQpWiq44nW0=
Expand Down
18 changes: 17 additions & 1 deletion pkg/controller/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import (
apicfgv1 "github.com/openshift/api/config/v1"
apioperatorsv1alpha1 "github.com/openshift/api/operator/v1alpha1"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
containerruntimeconfig "github.com/openshift/machine-config-operator/pkg/controller/container-runtime-config"
kubeletconfig "github.com/openshift/machine-config-operator/pkg/controller/kubelet-config"
"github.com/openshift/machine-config-operator/pkg/controller/render"
"github.com/openshift/machine-config-operator/pkg/controller/template"
)
Expand All @@ -46,6 +48,7 @@ func New(templatesDir, manifestDir, pullSecretFile string) *Bootstrap {

// Run runs boostrap for Machine Config Controller
// It writes all the assets to destDir
// nolint:gocyclo
func (b *Bootstrap) Run(destDir string) error {
infos, err := ioutil.ReadDir(b.manifestDir)
if err != nil {
Expand All @@ -70,6 +73,7 @@ func (b *Bootstrap) Run(destDir string) error {
decoder := codecFactory.UniversalDecoder(mcfgv1.GroupVersion, apioperatorsv1alpha1.GroupVersion, apicfgv1.GroupVersion)

var cconfig *mcfgv1.ControllerConfig
var featureGate *apicfgv1.FeatureGate
var pools []*mcfgv1.MachineConfigPool
var configs []*mcfgv1.MachineConfig
var icspRules []*apioperatorsv1alpha1.ImageContentSourcePolicy
Expand Down Expand Up @@ -112,6 +116,10 @@ func (b *Bootstrap) Run(destDir string) error {
icspRules = append(icspRules, obj)
case *apicfgv1.Image:
imgCfg = obj
case *apicfgv1.FeatureGate:
if obj.GetName() == ctrlcommon.ClusterFeatureInstanceName {
featureGate = obj
}
default:
glog.Infof("skipping %q [%d] manifest because of unhandled %T", file.Name(), idx+1, obji)
}
Expand All @@ -121,7 +129,7 @@ func (b *Bootstrap) Run(destDir string) error {
if cconfig == nil {
return fmt.Errorf("error: no controllerconfig found in dir: %q", destDir)
}
iconfigs, err := template.RunBootstrap(b.templatesDir, cconfig, psraw)
iconfigs, err := template.RunBootstrap(b.templatesDir, cconfig, psraw, featureGate)
if err != nil {
return err
}
Expand All @@ -133,6 +141,14 @@ func (b *Bootstrap) Run(destDir string) error {
}
configs = append(configs, rconfigs...)

if featureGate != nil {
kConfigs, err := kubeletconfig.RunFeatureGateBootstrap(b.templatesDir, featureGate, cconfig, pools)
if err != nil {
return err
}
configs = append(configs, kConfigs...)
}

fpools, gconfigs, err := render.RunBootstrap(pools, configs, cconfig)
if err != nil {
return err
Expand Down
13 changes: 13 additions & 0 deletions pkg/controller/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ spec:
want: []manifest{{
Raw: []byte(`{"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"name":"test-ingress","namespace":"test-namespace"},"spec":{"rules":[{"http":{"paths":[{"backend":{"serviceName":"test","servicePort":80},"path":"/testpath"}]}}]}}`),
}},
}, {
name: "feature gate",
raw: `
apiVersion: config.openshift.io/v1
kind: FeatureGate
metadata:
name: cluster
spec:
featureSet: TechPreviewNoUpgrade
`,
want: []manifest{{
Raw: []byte(`{"apiVersion":"config.openshift.io/v1","kind":"FeatureGate","metadata":{"name":"cluster"},"spec":{"featureSet":"TechPreviewNoUpgrade"}}`),
}},
}, {
name: "two-resources",
raw: `
Expand Down
16 changes: 8 additions & 8 deletions pkg/controller/kubelet-config/kubelet_config_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,10 @@ func (ctrl *Controller) handleFeatureErr(err error, key interface{}) {
ctrl.featureQueue.AddAfter(key, 1*time.Minute)
}

func (ctrl *Controller) generateOriginalKubeletConfig(role string, featureGate *configv1.FeatureGate) (*ign3types.File, error) {
cc, err := ctrl.ccLister.Get(ctrlcommon.ControllerConfigName)
if err != nil {
return nil, fmt.Errorf("could not get ControllerConfig %v", err)
}
func generateOriginalKubeletConfig(cc *mcfgv1.ControllerConfig, templatesDir, role string, featureGate *configv1.FeatureGate) (*ign3types.File, error) {
// Render the default templates
rc := &mtmpl.RenderConfig{ControllerConfigSpec: &cc.Spec, FeatureGate: featureGate}
generatedConfigs, err := mtmpl.GenerateMachineConfigsForRole(rc, role, ctrl.templatesDir)
generatedConfigs, err := mtmpl.GenerateMachineConfigsForRole(rc, role, templatesDir)
if err != nil {
return nil, fmt.Errorf("GenerateMachineConfigsforRole failed with error %s", err)
}
Expand Down Expand Up @@ -478,7 +474,7 @@ func (ctrl *Controller) syncKubeletConfig(key string) error {
err := fmt.Errorf("could not fetch FeatureGates: %v", err)
return ctrl.syncStatusOnly(cfg, err)
}
featureGates, err := generateFeatureMap(features)
featureGates, err := generateFeatureMap(features, openshiftOnlyFeatureGates...)
if err != nil {
err := fmt.Errorf("could not generate FeatureMap: %v", err)
glog.V(2).Infof("%v", err)
Expand Down Expand Up @@ -512,7 +508,11 @@ func (ctrl *Controller) syncKubeletConfig(key string) error {
userDefinedSystemReserved := make(map[string]string, 2)

// Generate the original KubeletConfig
originalKubeletIgn, err := ctrl.generateOriginalKubeletConfig(role, features)
cc, err := ctrl.ccLister.Get(ctrlcommon.ControllerConfigName)
if err != nil {
return fmt.Errorf("could not get ControllerConfig %v", err)
}
originalKubeletIgn, err := generateOriginalKubeletConfig(cc, ctrl.templatesDir, role, features)
if err != nil {
return ctrl.syncStatusOnly(cfg, err, "could not generate the original Kubelet config: %v", err)
}
Expand Down
126 changes: 94 additions & 32 deletions pkg/controller/kubelet-config/kubelet_config_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/client-go/util/retry"
kubeletconfigv1beta1 "k8s.io/kubelet/config/v1beta1"

mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/openshift/machine-config-operator/pkg/version"
)
Expand Down Expand Up @@ -74,6 +75,11 @@ func (ctrl *Controller) syncFeatureHandler(key string) error {
return err
}

cc, err := ctrl.ccLister.Get(ctrlcommon.ControllerConfigName)
if err != nil {
return fmt.Errorf("could not get ControllerConfig %v", err)
}

// Find all MachineConfigPools
mcpPools, err := ctrl.mcpLister.List(labels.Everything())
if err != nil {
Expand All @@ -100,43 +106,15 @@ func (ctrl *Controller) syncFeatureHandler(key string) error {
return err
}
}
// Generate the original KubeletConfig
originalKubeletIgn, err := ctrl.generateOriginalKubeletConfig(role, nil)
if err != nil {
return err
}
if originalKubeletIgn.Contents.Source == nil {
return fmt.Errorf("could not find original Kubelet config to decode")
}
dataURL, err := dataurl.DecodeString(*originalKubeletIgn.Contents.Source)
if err != nil {
return err
}
originalKubeConfig, err := decodeKubeletConfig(dataURL.Data)

rawCfgIgn, err := generateKubeConfigIgnFromFeatures(cc, ctrl.templatesDir, role, *featureGates)
if err != nil {
return err
}
// Check to see if FeatureGates are equal
if reflect.DeepEqual(originalKubeConfig.FeatureGates, *featureGates) {
if rawCfgIgn == nil {
continue
}
// Merge in Feature Gates
err = mergo.Merge(&originalKubeConfig.FeatureGates, featureGates, mergo.WithOverride)
if err != nil {
return err
}
// Encode the new config into raw JSON
cfgJSON, err := EncodeKubeletConfig(originalKubeConfig, kubeletconfigv1beta1.SchemeGroupVersion)
if err != nil {
return err
}
tempIgnConfig := ctrlcommon.NewIgnConfig()
cfgIgn := createNewKubeletIgnition(cfgJSON)
tempIgnConfig.Storage.Files = append(tempIgnConfig.Storage.Files, *cfgIgn)
rawCfgIgn, err := json.Marshal(tempIgnConfig)
if err != nil {
return err
}

mc.Spec.Config.Raw = rawCfgIgn
mc.ObjectMeta.Annotations = map[string]string{
ctrlcommon.GeneratedByControllerVersionAnnotationKey: version.Hash,
Expand Down Expand Up @@ -231,3 +209,87 @@ func generateFeatureMap(features *osev1.FeatureGate, exclusions ...string) (*map
}
return &rv, nil
}

func generateKubeConfigIgnFromFeatures(cc *mcfgv1.ControllerConfig, templatesDir, role string, featureGates map[string]bool) ([]byte, error) {
// Generate the original KubeletConfig
originalKubeletIgn, err := generateOriginalKubeletConfig(cc, templatesDir, role, nil)
if err != nil {
return nil, err
}
if originalKubeletIgn.Contents.Source == nil {
return nil, fmt.Errorf("could not find original Kubelet config to decode")
}
dataURL, err := dataurl.DecodeString(*originalKubeletIgn.Contents.Source)
if err != nil {
return nil, err
}
originalKubeConfig, err := decodeKubeletConfig(dataURL.Data)
if err != nil {
return nil, err
}
// Check to see if FeatureGates are equal
if reflect.DeepEqual(originalKubeConfig.FeatureGates, featureGates) {
// When there is no difference, this isn't an error, but no machine config should be created
return nil, nil
}

// Merge in Feature Gates
err = mergo.Merge(&originalKubeConfig.FeatureGates, featureGates, mergo.WithOverride)
if err != nil {
return nil, err
}
// Encode the new config into raw JSON
cfgJSON, err := EncodeKubeletConfig(originalKubeConfig, kubeletconfigv1beta1.SchemeGroupVersion)
if err != nil {
return nil, err
}
tempIgnConfig := ctrlcommon.NewIgnConfig()
cfgIgn := createNewKubeletIgnition(cfgJSON)
tempIgnConfig.Storage.Files = append(tempIgnConfig.Storage.Files, *cfgIgn)
rawCfgIgn, err := json.Marshal(tempIgnConfig)
if err != nil {
return nil, err
}
return rawCfgIgn, nil
}

func RunFeatureGateBootstrap(templateDir string, features *osev1.FeatureGate, controllerConfig *mcfgv1.ControllerConfig, mcpPools []*mcfgv1.MachineConfigPool) ([]*mcfgv1.MachineConfig, error) {
machineConfigs := []*mcfgv1.MachineConfig{}

featureGates, err := generateFeatureMap(features, openshiftOnlyFeatureGates...)
if err != nil {
return nil, err
}

for _, pool := range mcpPools {
role := pool.Name
rawCfgIgn, err := generateKubeConfigIgnFromFeatures(controllerConfig, templateDir, role, *featureGates)
if err != nil {
return nil, err
}
if rawCfgIgn == nil {
continue
}

// Get MachineConfig
managedKey, err := getManagedFeaturesKey(pool, nil)
if err != nil {
return nil, err
}

ignConfig := ctrlcommon.NewIgnConfig()
mc, err := ctrlcommon.MachineConfigFromIgnConfig(role, managedKey, ignConfig)
if err != nil {
return nil, err
}

mc.Spec.Config.Raw = rawCfgIgn
mc.ObjectMeta.Annotations = map[string]string{
ctrlcommon.GeneratedByControllerVersionAnnotationKey: version.Hash,
}

machineConfigs = append(machineConfigs, mc)
}

return machineConfigs, nil
}
Loading