Skip to content
Draft
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
7 changes: 7 additions & 0 deletions build/root/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ PRINT_HELP ?=
WHAT ?=
TESTS ?=
BRANCH ?=
TAGS ?=
GO_BUILD_FLAGS := $(if ${TAGS},-tags=${TAGS},)

# We don't need make's built-in rules.
MAKEFLAGS += --no-builtin-rules
Expand All @@ -61,6 +63,11 @@ $(error Both KUBE_GOFLAGS and GOFLAGS are set. Please use just GOFLAGS)
endif
endif

# Add build tags to GOFLAGS
ifneq ($(TAGS),)
GOFLAGS := $(GOFLAGS) $(GO_BUILD_FLAGS)
endif

# This controls the verbosity of the build. Higher numbers mean more output.
KUBE_VERBOSE ?= 1

Expand Down
5 changes: 3 additions & 2 deletions openshift-hack/images/hyperkube/Dockerfile.rhel
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.20 AS builder
ARG TAGS=""
WORKDIR /go/src/k8s.io/kubernetes
COPY . .
RUN make WHAT='cmd/kube-apiserver cmd/kube-controller-manager cmd/kube-scheduler cmd/kubelet cmd/watch-termination openshift-hack/cmd/k8s-tests-ext' && \
RUN make TAGS="${TAGS}" WHAT='cmd/kube-apiserver cmd/kube-controller-manager cmd/kube-scheduler cmd/kubelet cmd/watch-termination openshift-hack/cmd/k8s-tests-ext' && \
mkdir -p /tmp/build && \
cp openshift-hack/images/hyperkube/hyperkube openshift-hack/images/hyperkube/kubensenter /tmp/build && \
cp /go/src/k8s.io/kubernetes/_output/local/bin/linux/$(go env GOARCH)/{kube-apiserver,kube-controller-manager,kube-scheduler,kubelet,watch-termination,k8s-tests-ext} \
Expand All @@ -14,4 +15,4 @@ COPY --from=builder /tmp/build/* /usr/bin/
LABEL io.k8s.display-name="OpenShift Kubernetes Server Commands" \
io.k8s.description="OpenShift is a platform for developing, building, and deploying containerized applications." \
io.openshift.tags="openshift,hyperkube" \
io.openshift.build.versions="kubernetes=1.33.3"
io.openshift.build.versions="kubernetes=1.33.3"
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

configv1 "github.com/openshift/api/config/v1"
"k8s.io/kubernetes/openshift-kube-apiserver/admission/customresourcevalidation"
"k8s.io/kubernetes/openshift-kube-apiserver/version"
)

const PluginName = "config.openshift.io/ValidateFeatureGate"
Expand Down Expand Up @@ -50,14 +51,23 @@ func toFeatureGateV1(uncastObj runtime.Object) (*configv1.FeatureGate, field.Err
type featureGateV1 struct {
}

func validateOKDFeatureSet(spec configv1.FeatureGateSpec) field.ErrorList {
allErrs := field.ErrorList{}
if spec.FeatureSet == configv1.OKD && !version.IsSCOS() {
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec.featureSet"), "OKD featureset is not supported on OpenShift clusters"))
}

return allErrs
}

func (featureGateV1) ValidateCreate(_ context.Context, uncastObj runtime.Object) field.ErrorList {
obj, allErrs := toFeatureGateV1(uncastObj)
if len(allErrs) > 0 {
return allErrs
}

allErrs = append(allErrs, validation.ValidateObjectMeta(&obj.ObjectMeta, false, customresourcevalidation.RequireNameCluster, field.NewPath("metadata"))...)

allErrs = append(allErrs, validateOKDFeatureSet(obj.Spec)...)
return allErrs
}

Expand All @@ -72,6 +82,7 @@ func (featureGateV1) ValidateUpdate(_ context.Context, uncastObj runtime.Object,
}

allErrs = append(allErrs, validation.ValidateObjectMetaUpdate(&obj.ObjectMeta, &oldObj.ObjectMeta, field.NewPath("metadata"))...)
allErrs = append(allErrs, validateOKDFeatureSet(obj.Spec)...)

return allErrs
}
Expand Down
7 changes: 7 additions & 0 deletions openshift-kube-apiserver/version/scos.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build scos

package version

func init() {
SCOS = true
}
11 changes: 11 additions & 0 deletions openshift-kube-apiserver/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package version

var (
// SCOS is a setting to enable CentOS Stream CoreOS-only modifications
SCOS = false
)

// IsSCOS returns true if CentOS Stream CoreOS-only modifications are enabled
func IsSCOS() bool {
return SCOS
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.