Skip to content

Commit 5d68fe7

Browse files
Merge pull request #7943 from vr4manta/SPLAT-1293
SPLAT-1293: Bump API version to promote vSphereStaticIPs from TechPreview.
2 parents 319914a + e3f320c commit 5d68fe7

File tree

211 files changed

+5834
-9515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+5834
-9515
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ require (
6363
github.com/microsoftgraph/msgraph-sdk-go v0.59.0
6464
github.com/nutanix-cloud-native/prism-go-client v0.2.1-0.20220804130801-c8a253627c64
6565
github.com/onsi/gomega v1.31.1
66-
github.com/openshift/api v0.0.0-20240301093301-ce10821dc999
66+
github.com/openshift/api v0.0.0-20240313103236-5f1498accd5d
6767
github.com/openshift/assisted-image-service v0.0.0-20231130154654-56d03d1503e2
6868
github.com/openshift/assisted-service/api v0.0.0
6969
github.com/openshift/assisted-service/client v0.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,8 +2007,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
20072007
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
20082008
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8=
20092009
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ=
2010-
github.com/openshift/api v0.0.0-20240301093301-ce10821dc999 h1:+S998xHiJApsJZjRAO8wyedU9GfqFd8mtwWly6LqHDo=
2011-
github.com/openshift/api v0.0.0-20240301093301-ce10821dc999/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
2010+
github.com/openshift/api v0.0.0-20240313103236-5f1498accd5d h1:WE1fNTWjcCQMZ+8flkBER/ygsYvQIum25F/2qBQPi+g=
2011+
github.com/openshift/api v0.0.0-20240313103236-5f1498accd5d/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
20122012
github.com/openshift/assisted-image-service v0.0.0-20231130154654-56d03d1503e2 h1:ndmguZuF+ON5ytIaQ4KUAFIlhL3GoCCmDVQlDKNFGGk=
20132013
github.com/openshift/assisted-image-service v0.0.0-20231130154654-56d03d1503e2/go.mod h1:w4GeUpl8BnEzzzIqFAe06muoWJc54XQ4rDVdUKAJns8=
20142014
github.com/openshift/assisted-service/api v0.0.0-20230831114549-1922eda29cf8 h1:+fZLKbycDo4JeLwPGVSAgf2XPaJGLM341l9ZfrrlxG0=

pkg/destroy/bootstrap/bootstrap.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/openshift/installer/pkg/infrastructure/openstack/preprovision"
1717
infra "github.com/openshift/installer/pkg/infrastructure/platform"
1818
ibmcloudtfvars "github.com/openshift/installer/pkg/tfvars/ibmcloud"
19+
"github.com/openshift/installer/pkg/types"
1920
typesazure "github.com/openshift/installer/pkg/types/azure"
2021
"github.com/openshift/installer/pkg/types/featuregates"
2122
ibmcloudtypes "github.com/openshift/installer/pkg/types/ibmcloud"
@@ -69,7 +70,14 @@ func Destroy(ctx context.Context, dir string) (err error) {
6970
}
7071
}
7172

72-
fg := featuregates.FeatureGateFromFeatureSets(configv1.FeatureSets, metadata.FeatureSet, metadata.CustomFeatureSet)
73+
// Get cluster profile for new FeatureGate access. Blank is no longer an option, so default to
74+
// SelfManaged.
75+
clusterProfile := types.GetClusterProfileName()
76+
featureSets, ok := configv1.AllFeatureSets()[clusterProfile]
77+
if !ok {
78+
return fmt.Errorf("no feature sets for cluster profile %q", clusterProfile)
79+
}
80+
fg := featuregates.FeatureGateFromFeatureSets(featureSets, metadata.FeatureSet, metadata.CustomFeatureSet)
7381

7482
provider, err := infra.ProviderForPlatform(platform, fg)
7583
if err != nil {

pkg/types/installconfig.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"strings"
66

7+
"github.com/sirupsen/logrus"
78
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
89

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

550-
fg := featuregates.FeatureGateFromFeatureSets(configv1.FeatureSets, c.FeatureSet, customFS)
551+
clusterProfile := GetClusterProfileName()
552+
featureSets, ok := configv1.AllFeatureSets()[clusterProfile]
553+
if !ok {
554+
logrus.Warnf("no feature sets for cluster profile %q", clusterProfile)
555+
}
556+
fg := featuregates.FeatureGateFromFeatureSets(featureSets, c.FeatureSet, customFS)
551557

552558
return fg
553559
}

pkg/types/utils.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package types
22

3-
import configv1 "github.com/openshift/api/config/v1"
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/sirupsen/logrus"
8+
9+
configv1 "github.com/openshift/api/config/v1"
10+
)
411

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

3340
return res
3441
}
42+
43+
// GetClusterProfileName utility method to retrieve the cluster profile setting. This is used
44+
// when dealing with openshift api to get FeatureSets.
45+
func GetClusterProfileName() configv1.ClusterProfileName {
46+
// Get cluster profile for new FeatureGate access. Blank is no longer an option, so default to
47+
// SelfManaged.
48+
clusterProfile := configv1.SelfManaged
49+
if cp := os.Getenv("OPENSHIFT_INSTALL_EXPERIMENTAL_CLUSTER_PROFILE"); cp != "" {
50+
logrus.Warnf("Found override for Cluster Profile: %q", cp)
51+
// All profiles when getting FeatureSets need to have "include.release.openshift.io/" at the beginning.
52+
// See vendor/openshift/api/config/v1/feature_gates.go for more info.
53+
clusterProfile = configv1.ClusterProfileName(fmt.Sprintf("%s%s", "include.release.openshift.io/", cp))
54+
}
55+
return clusterProfile
56+
}

pkg/types/validation/featuregate_test.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,11 @@ func TestFeatureGates(t *testing.T) {
7171
name: "vSphere hosts is allowed with Feature Gates enabled",
7272
installConfig: func() *types.InstallConfig {
7373
c := validInstallConfig()
74-
c.FeatureSet = v1.TechPreviewNoUpgrade
75-
c.VSphere = validVSpherePlatform()
76-
c.VSphere.Hosts = []*vsphere.Host{{Role: "test"}}
77-
return c
78-
}(),
79-
},
80-
{
81-
name: "vSphere hosts is not allowed without Feature Gates",
82-
installConfig: func() *types.InstallConfig {
83-
c := validInstallConfig()
74+
c.FeatureSet = v1.Default
8475
c.VSphere = validVSpherePlatform()
8576
c.VSphere.Hosts = []*vsphere.Host{{Role: "test"}}
8677
return c
8778
}(),
88-
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$`,
8979
},
9080
{
9181
name: "vSphere hosts is allowed with custom Feature Gates",

pkg/types/validation/installconfig.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,12 +1217,19 @@ func validateAdditionalCABundlePolicy(c *types.InstallConfig) error {
12171217
func ValidateFeatureSet(c *types.InstallConfig) field.ErrorList {
12181218
allErrs := field.ErrorList{}
12191219

1220-
if _, ok := configv1.FeatureSets[c.FeatureSet]; !ok {
1220+
clusterProfile := types.GetClusterProfileName()
1221+
featureSets, ok := configv1.AllFeatureSets()[clusterProfile]
1222+
if !ok {
1223+
logrus.Warnf("no feature sets for cluster profile %q", clusterProfile)
1224+
}
1225+
if _, ok := featureSets[c.FeatureSet]; c.FeatureSet != configv1.CustomNoUpgrade && !ok {
12211226
sortedFeatureSets := func() []string {
12221227
v := []string{}
1223-
for n := range configv1.FeatureSets {
1228+
for n := range configv1.AllFeatureSets()[clusterProfile] {
12241229
v = append(v, string(n))
12251230
}
1231+
// Add CustomNoUpgrade since it is not part of features sets for profiles
1232+
v = append(v, string(configv1.CustomNoUpgrade))
12261233
sort.Strings(v)
12271234
return v
12281235
}()

vendor/github.com/openshift/api/config/v1/0000_00_cluster-version-operator_01_clusteroperator.crd.yaml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/openshift/api/config/v1/0000_00_cluster-version-operator_01_clusterversion-CustomNoUpgrade.crd.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/openshift/api/config/v1/0000_00_cluster-version-operator_01_clusterversion-Default.crd.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)