Skip to content
Open
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
24 changes: 16 additions & 8 deletions pkg/payload/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,7 @@ func renderDir(renderConfig manifestRenderConfig, idir, odir string, requiredFea
if skipFiles.Has(file.Name()) {
continue
}
if strings.Contains(file.Name(), "CustomNoUpgrade") ||
strings.Contains(file.Name(), "TechPreviewNoUpgrade") ||
strings.Contains(file.Name(), "DevPreviewNoUpgrade") ||
strings.Contains(file.Name(), "OKD") {
// CustomNoUpgrade, TechPreviewNoUpgrade, DevPreviewNoUpgrade, and OKD may add features to manifests like the ClusterVersion CRD,
// but we do not need those features during bootstrap-render time. In those clusters, the production
// CVO will be along shortly to update the manifests and deliver the gated features.
// fixme: now that we have requiredFeatureSet, use it to do Manifest.Include() filtering here instead of making filename assumptions
if skipFeatureSets(file.Name()) {
continue
}

Expand Down Expand Up @@ -199,6 +192,21 @@ func renderDir(renderConfig manifestRenderConfig, idir, odir string, requiredFea
return nil
}

// CustomNoUpgrade, TechPreviewNoUpgrade, DevPreviewNoUpgrade, and OKD may add features to manifests like the ClusterVersion CRD,
// but we do not need those features during bootstrap-render time. In those clusters, the production
// CVO will be along shortly to update the manifests and deliver the gated features.
// fixme: now that we have requiredFeatureSet, use it to do Manifest.Include() filtering here instead of making filename assumptions
var cvoSkipFeatureSets = sets.New[string]("CustomNoUpgrade", "TechPreviewNoUpgrade", "DevPreviewNoUpgrade", "OKD")

func skipFeatureSets(filename string) bool {
for featureSet := range cvoSkipFeatureSets {
if strings.HasPrefix(filename, featureSet) {
return true
}
}
return false
}

type manifestRenderConfig struct {
ReleaseImage string
ClusterProfile string
Expand Down
21 changes: 21 additions & 0 deletions pkg/payload/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
configv1 "github.com/openshift/api/config/v1"
"k8s.io/apimachinery/pkg/util/sets"
)

func TestRenderManifest(t *testing.T) {
Expand Down Expand Up @@ -58,3 +60,22 @@ func TestRenderManifest(t *testing.T) {
})
}
}

func Test_cvoKnownFeatureSets(t *testing.T) {
unknown := sets.New[string]()
known := cvoSkipFeatureSets.Clone().Insert(string(configv1.Default))
for _, fs := range append(configv1.AllFixedFeatureSets, configv1.CustomNoUpgrade) {
candidate := string(fs)
if !known.Has(candidate) {
unknown.Insert(candidate)
}
}
if unknown.Len() != 0 {
t.Errorf("found unknown feature sets [%s] not recognized by CVO. If it is a result of bump o/api e.g., "+
"https://github.com/openshift/cluster-version-operator/pull/1302/commits/dd3b8335f7f443b5ab6ffcfd78236832cb922753 "+
"and it led to failing CVO/Hypershift e2e tests, please try to fix them by pulls like "+
"https://github.com/openshift/hypershift/pull/7557 and "+
"https://github.com/openshift/cluster-version-operator/pull/1302/commits/981361e85b58ec77dada253e63f79f8ef78a8bd1. "+
"Otherwise, adding them to cvoSkipFeatureSets fixes this unit test", strings.Join(unknown.UnsortedList(), ", "))
}
}