Skip to content

Commit

Permalink
Ensure FeatureGate is copied from cluster to MCO render source
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelSpeed committed May 22, 2023
1 parent 8dd4ec2 commit 4c18303
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ignition-server/controllers/local_ignitionprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

"github.com/blang/semver"
"github.com/docker/distribution/manifest/manifestlist"
configv1 "github.com/openshift/api/config/v1"
hyperv1 "github.com/openshift/hypershift/api/v1beta1"
"github.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane/common"
"github.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane/imageprovider"
Expand Down Expand Up @@ -235,6 +236,27 @@ func (p *LocalIgnitionProvider) GetPayload(ctx context.Context, releaseImage str
return nil, fmt.Errorf("failed to extract templates from image: %w", err)
}

// Write out the feature gate manifest to the MCC dir.
if err := func() error {
featureGate := &configv1.FeatureGate{}
if err := p.Client.Get(ctx, client.ObjectKey{Name: "cluster"}, featureGate); err != nil {
return fmt.Errorf("failed to get feature gate: %w", err)
}

featureGateBytes, err := yaml.Marshal(featureGate)
if err != nil {
return fmt.Errorf("failed to marshal feature gate: %w", err)
}

if err := os.WriteFile(filepath.Join(mccBaseDir, "99_feature-gate.yaml"), featureGateBytes, 0644); err != nil {
return fmt.Errorf("failed to write feature gate: %w", err)
}

return nil
}(); err != nil {
return nil, fmt.Errorf("failed to extract feature gate: %w", err)
}

// Extract binaries from the MCO image into the bin directory
err = func() error {
start := time.Now()
Expand Down

0 comments on commit 4c18303

Please sign in to comment.