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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ require (
github.com/microsoftgraph/msgraph-sdk-go v0.47.0
github.com/nutanix-cloud-native/prism-go-client v0.2.1-0.20220804130801-c8a253627c64
github.com/onsi/gomega v1.31.1
github.com/openshift/api v0.0.0-20240301093301-ce10821dc999
github.com/openshift/api v0.0.0-20240313103236-5f1498accd5d
github.com/openshift/assisted-image-service v0.0.0-20231130154654-56d03d1503e2
github.com/openshift/assisted-service/api v0.0.0
github.com/openshift/assisted-service/client v0.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1999,8 +1999,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8=
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ=
github.com/openshift/api v0.0.0-20240301093301-ce10821dc999 h1:+S998xHiJApsJZjRAO8wyedU9GfqFd8mtwWly6LqHDo=
github.com/openshift/api v0.0.0-20240301093301-ce10821dc999/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
github.com/openshift/api v0.0.0-20240313103236-5f1498accd5d h1:WE1fNTWjcCQMZ+8flkBER/ygsYvQIum25F/2qBQPi+g=
github.com/openshift/api v0.0.0-20240313103236-5f1498accd5d/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
github.com/openshift/assisted-image-service v0.0.0-20231130154654-56d03d1503e2 h1:ndmguZuF+ON5ytIaQ4KUAFIlhL3GoCCmDVQlDKNFGGk=
github.com/openshift/assisted-image-service v0.0.0-20231130154654-56d03d1503e2/go.mod h1:w4GeUpl8BnEzzzIqFAe06muoWJc54XQ4rDVdUKAJns8=
github.com/openshift/assisted-service/api v0.0.0-20230831114549-1922eda29cf8 h1:+fZLKbycDo4JeLwPGVSAgf2XPaJGLM341l9ZfrrlxG0=
Expand Down
10 changes: 9 additions & 1 deletion pkg/destroy/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/openshift/installer/pkg/infrastructure/openstack/preprovision"
infra "github.com/openshift/installer/pkg/infrastructure/platform"
ibmcloudtfvars "github.com/openshift/installer/pkg/tfvars/ibmcloud"
"github.com/openshift/installer/pkg/types"
typesazure "github.com/openshift/installer/pkg/types/azure"
"github.com/openshift/installer/pkg/types/featuregates"
ibmcloudtypes "github.com/openshift/installer/pkg/types/ibmcloud"
Expand Down Expand Up @@ -69,7 +70,14 @@ func Destroy(ctx context.Context, dir string) (err error) {
}
}

fg := featuregates.FeatureGateFromFeatureSets(configv1.FeatureSets, metadata.FeatureSet, metadata.CustomFeatureSet)
// Get cluster profile for new FeatureGate access. Blank is no longer an option, so default to
// SelfManaged.
clusterProfile := types.GetClusterProfileName()
featureSets, ok := configv1.AllFeatureSets()[clusterProfile]
if !ok {
return fmt.Errorf("no feature sets for cluster profile %q", clusterProfile)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you reuse the GetClusterProfileName function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good catch. I thought I had updated this one.

fg := featuregates.FeatureGateFromFeatureSets(featureSets, metadata.FeatureSet, metadata.CustomFeatureSet)

provider, err := infra.ProviderForPlatform(platform, fg)
if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion pkg/types/installconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"strings"

"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

configv1 "github.com/openshift/api/config/v1"
Expand Down Expand Up @@ -547,7 +548,12 @@ func (c *InstallConfig) EnabledFeatureGates() featuregates.FeatureGate {
customFS = featuregates.GenerateCustomFeatures(c.FeatureGates)
}

fg := featuregates.FeatureGateFromFeatureSets(configv1.FeatureSets, c.FeatureSet, customFS)
clusterProfile := GetClusterProfileName()
featureSets, ok := configv1.AllFeatureSets()[clusterProfile]
if !ok {
logrus.Warnf("no feature sets for cluster profile %q", clusterProfile)
}
fg := featuregates.FeatureGateFromFeatureSets(featureSets, c.FeatureSet, customFS)

return fg
}
24 changes: 23 additions & 1 deletion pkg/types/utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package types

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

"github.com/sirupsen/logrus"

configv1 "github.com/openshift/api/config/v1"
)

// StringsToIPs is used to convert list of strings to list of IP addresses.
func StringsToIPs(ips []string) []configv1.IP {
Expand Down Expand Up @@ -32,3 +39,18 @@ func MachineNetworksToCIDRs(nets []MachineNetworkEntry) []configv1.CIDR {

return res
}

// GetClusterProfileName utility method to retrieve the cluster profile setting. This is used
// when dealing with openshift api to get FeatureSets.
func GetClusterProfileName() configv1.ClusterProfileName {
// Get cluster profile for new FeatureGate access. Blank is no longer an option, so default to
// SelfManaged.
clusterProfile := configv1.SelfManaged
if cp := os.Getenv("OPENSHIFT_INSTALL_EXPERIMENTAL_CLUSTER_PROFILE"); cp != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could we change this to OPENSHIFT_INSTALL_CLUSTER_PROFILE? I suspect the installer will need to add an option for this in the install config, so thank you for making this configurable until we can do that!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I saw there was an existing profile. I saw it does something similarly. Do I just update it here or should we look into updating other spot too?

if cp := os.Getenv("OPENSHIFT_INSTALL_EXPERIMENTAL_CLUSTER_PROFILE"); cp != "" {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I didn't realize this was using an existing env var. In that case, let's just keep it as is.

logrus.Warnf("Found override for Cluster Profile: %q", cp)
// All profiles when getting FeatureSets need to have "include.release.openshift.io/" at the beginning.
// See vendor/openshift/api/config/v1/feature_gates.go for more info.
clusterProfile = configv1.ClusterProfileName(fmt.Sprintf("%s%s", "include.release.openshift.io/", cp))
}
return clusterProfile
}
12 changes: 1 addition & 11 deletions pkg/types/validation/featuregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,11 @@ func TestFeatureGates(t *testing.T) {
name: "vSphere hosts is allowed with Feature Gates enabled",
installConfig: func() *types.InstallConfig {
c := validInstallConfig()
c.FeatureSet = v1.TechPreviewNoUpgrade
c.VSphere = validVSpherePlatform()
c.VSphere.Hosts = []*vsphere.Host{{Role: "test"}}
return c
}(),
},
{
name: "vSphere hosts is not allowed without Feature Gates",
installConfig: func() *types.InstallConfig {
c := validInstallConfig()
c.FeatureSet = v1.Default
c.VSphere = validVSpherePlatform()
c.VSphere.Hosts = []*vsphere.Host{{Role: "test"}}
return c
}(),
expected: `^platform.vsphere.hosts: Forbidden: this field is protected by the VSphereStaticIPs feature gate which must be enabled through either the TechPreviewNoUpgrade or CustomNoUpgrade feature set$`,
},
{
name: "vSphere hosts is allowed with custom Feature Gates",
Expand Down
11 changes: 9 additions & 2 deletions pkg/types/validation/installconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -1212,12 +1212,19 @@ func validateAdditionalCABundlePolicy(c *types.InstallConfig) error {
func ValidateFeatureSet(c *types.InstallConfig) field.ErrorList {
allErrs := field.ErrorList{}

if _, ok := configv1.FeatureSets[c.FeatureSet]; !ok {
clusterProfile := types.GetClusterProfileName()
featureSets, ok := configv1.AllFeatureSets()[clusterProfile]
if !ok {
logrus.Warnf("no feature sets for cluster profile %q", clusterProfile)
}
if _, ok := featureSets[c.FeatureSet]; c.FeatureSet != configv1.CustomNoUpgrade && !ok {
sortedFeatureSets := func() []string {
v := []string{}
for n := range configv1.FeatureSets {
for n := range configv1.AllFeatureSets()[clusterProfile] {
v = append(v, string(n))
}
// Add CustomNoUpgrade since it is not part of features sets for profiles
v = append(v, string(configv1.CustomNoUpgrade))
sort.Strings(v)
return v
}()
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.

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