Skip to content

Commit

Permalink
Add generated featuregate files inertly to payloads
Browse files Browse the repository at this point in the history
This will allow payload inspect tools to report which features have been
created and promoted between various levels.  This means we cannot
remove featuregates for at least a release after their introduction.
  • Loading branch information
deads2k committed Jan 10, 2024
1 parent 355cd25 commit 5fb1b9d
Show file tree
Hide file tree
Showing 9 changed files with 494 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COPY payload-manifests/crds/* /usr/share/bootkube/manifests/manifests
# these are applied by the CVO
COPY manifests /manifests
COPY payload-manifests/crds/* /manifests
COPY payload-manifests/featuregates/* /manifests
COPY payload-command/empty-resources /manifests

LABEL io.openshift.release.operator true
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ verify-scripts:
bash -x hack/verify-group-versions.sh
bash -x hack/verify-prerelease-lifecycle-gen.sh
hack/verify-payload-crds.sh
hack/verify-payload-featuregates.sh

.PHONY: verify
verify: verify-scripts verify-crd-schema verify-codegen-crds
Expand Down Expand Up @@ -77,7 +78,7 @@ verify-%:
################################################################################################

.PHONY: update-scripts
update-scripts: update-compatibility update-openapi update-deepcopy update-protobuf update-swagger-docs tests-vendor update-prerelease-lifecycle-gen update-payload-crds
update-scripts: update-compatibility update-openapi update-deepcopy update-protobuf update-swagger-docs tests-vendor update-prerelease-lifecycle-gen update-payload-crds update-payload-featuregates

.PHONY: update-compatibility
update-compatibility:
Expand Down Expand Up @@ -107,6 +108,10 @@ update-prerelease-lifecycle-gen:
update-payload-crds:
hack/update-payload-crds.sh

.PHONY: update-payload-featuregates
update-payload-featuregates:
hack/update-payload-featuregates.sh

#####################
#
# END: Update scripts
Expand Down
5 changes: 5 additions & 0 deletions hack/update-payload-featuregates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

source "$(dirname "${BASH_SOURCE}")/lib/init.sh"

go run --mod=vendor -trimpath github.com/openshift/api/payload-command/cmd/write-available-featuresets --asset-output-dir=./payload-manifests/featuregates
11 changes: 11 additions & 0 deletions hack/verify-payload-featuregates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

source "$(dirname "${BASH_SOURCE}")/lib/init.sh"

VERIFY_DIR=$(mktemp -d -t featuregates-verify-XXXXXX)

go run --mod=vendor -trimpath github.com/openshift/api/payload-command/cmd/write-available-featuresets --asset-output-dir="${VERIFY_DIR}"

diff -r "${VERIFY_DIR}" ./payload-manifests/featuregates

rm -rf "${VERIFY_DIR}"
19 changes: 18 additions & 1 deletion payload-command/render/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package render

import (
"encoding/json"

configv1 "github.com/openshift/api/config/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
Expand All @@ -26,5 +28,20 @@ func readFeatureGateV1OrDie(objBytes []byte) *configv1.FeatureGate {
}

func writeFeatureGateV1OrDie(obj *configv1.FeatureGate) string {
return runtime.EncodeOrDie(configCodecs.LegacyCodec(configv1.SchemeGroupVersion), obj)
asMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)
if err != nil {
panic(err)
}
if _, ok := asMap["apiVersion"]; !ok {
asMap["apiVersion"] = configv1.GroupVersion.Identifier()
}
if _, ok := asMap["kind"]; !ok {
asMap["kind"] = "FeatureGate"
}

ret, err := json.MarshalIndent(asMap, "", " ")
if err != nil {
panic(err)
}
return string(ret) + "\n"
}
20 changes: 20 additions & 0 deletions payload-manifests/featuregates/featureGate-CustomNoUpgrade.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"apiVersion": "config.openshift.io/v1",
"kind": "FeatureGate",
"metadata": {
"creationTimestamp": null,
"name": "cluster"
},
"spec": {
"featureSet": "CustomNoUpgrade"
},
"status": {
"featureGates": [
{
"disabled": null,
"enabled": null,
"version": ""
}
]
}
}
143 changes: 143 additions & 0 deletions payload-manifests/featuregates/featureGate-Default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"apiVersion": "config.openshift.io/v1",
"kind": "FeatureGate",
"metadata": {
"creationTimestamp": null,
"name": "cluster"
},
"spec": {},
"status": {
"featureGates": [
{
"disabled": [
{
"name": "AdminNetworkPolicy"
},
{
"name": "AutomatedEtcdBackup"
},
{
"name": "CSIDriverSharedResource"
},
{
"name": "ClusterAPIInstall"
},
{
"name": "DNSNameResolver"
},
{
"name": "DisableKubeletCloudCredentialProviders"
},
{
"name": "DynamicResourceAllocation"
},
{
"name": "EventedPLEG"
},
{
"name": "GCPClusterHostedDNS"
},
{
"name": "GCPLabelsTags"
},
{
"name": "GatewayAPI"
},
{
"name": "InsightsConfigAPI"
},
{
"name": "InstallAlternateInfrastructureAWS"
},
{
"name": "MachineAPIOperatorDisableMachineHealthCheckController"
},
{
"name": "MachineAPIProviderOpenStack"
},
{
"name": "MachineConfigNodes"
},
{
"name": "ManagedBootImages"
},
{
"name": "MaxUnavailableStatefulSet"
},
{
"name": "MetricsServer"
},
{
"name": "MixedCPUsAllocation"
},
{
"name": "NetworkLiveMigration"
},
{
"name": "NodeSwap"
},
{
"name": "OnClusterBuild"
},
{
"name": "PinnedImages"
},
{
"name": "RouteExternalCertificate"
},
{
"name": "SignatureStores"
},
{
"name": "SigstoreImageVerification"
},
{
"name": "VSphereControlPlaneMachineSet"
},
{
"name": "VSphereStaticIPs"
},
{
"name": "ValidatingAdmissionPolicy"
}
],
"enabled": [
{
"name": "AlibabaPlatform"
},
{
"name": "AzureWorkloadIdentity"
},
{
"name": "BuildCSIVolumes"
},
{
"name": "CloudDualStackNodeIPs"
},
{
"name": "ExternalCloudProvider"
},
{
"name": "ExternalCloudProviderAzure"
},
{
"name": "ExternalCloudProviderExternal"
},
{
"name": "ExternalCloudProviderGCP"
},
{
"name": "KMSv1"
},
{
"name": "OpenShiftPodSecurityAdmission"
},
{
"name": "PrivateHostedZoneAWS"
}
],
"version": ""
}
]
}
}
145 changes: 145 additions & 0 deletions payload-manifests/featuregates/featureGate-LatencySensitive.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"apiVersion": "config.openshift.io/v1",
"kind": "FeatureGate",
"metadata": {
"creationTimestamp": null,
"name": "cluster"
},
"spec": {
"featureSet": "LatencySensitive"
},
"status": {
"featureGates": [
{
"disabled": [
{
"name": "AdminNetworkPolicy"
},
{
"name": "AutomatedEtcdBackup"
},
{
"name": "CSIDriverSharedResource"
},
{
"name": "ClusterAPIInstall"
},
{
"name": "DNSNameResolver"
},
{
"name": "DisableKubeletCloudCredentialProviders"
},
{
"name": "DynamicResourceAllocation"
},
{
"name": "EventedPLEG"
},
{
"name": "GCPClusterHostedDNS"
},
{
"name": "GCPLabelsTags"
},
{
"name": "GatewayAPI"
},
{
"name": "InsightsConfigAPI"
},
{
"name": "InstallAlternateInfrastructureAWS"
},
{
"name": "MachineAPIOperatorDisableMachineHealthCheckController"
},
{
"name": "MachineAPIProviderOpenStack"
},
{
"name": "MachineConfigNodes"
},
{
"name": "ManagedBootImages"
},
{
"name": "MaxUnavailableStatefulSet"
},
{
"name": "MetricsServer"
},
{
"name": "MixedCPUsAllocation"
},
{
"name": "NetworkLiveMigration"
},
{
"name": "NodeSwap"
},
{
"name": "OnClusterBuild"
},
{
"name": "PinnedImages"
},
{
"name": "RouteExternalCertificate"
},
{
"name": "SignatureStores"
},
{
"name": "SigstoreImageVerification"
},
{
"name": "VSphereControlPlaneMachineSet"
},
{
"name": "VSphereStaticIPs"
},
{
"name": "ValidatingAdmissionPolicy"
}
],
"enabled": [
{
"name": "AlibabaPlatform"
},
{
"name": "AzureWorkloadIdentity"
},
{
"name": "BuildCSIVolumes"
},
{
"name": "CloudDualStackNodeIPs"
},
{
"name": "ExternalCloudProvider"
},
{
"name": "ExternalCloudProviderAzure"
},
{
"name": "ExternalCloudProviderExternal"
},
{
"name": "ExternalCloudProviderGCP"
},
{
"name": "KMSv1"
},
{
"name": "OpenShiftPodSecurityAdmission"
},
{
"name": "PrivateHostedZoneAWS"
}
],
"version": ""
}
]
}
}
Loading

0 comments on commit 5fb1b9d

Please sign in to comment.