forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPSTREAM: <carry>: noderestrictions: add node-role.kubernetes.io/* to…
… allowed node labels Server side validation of node labels was added in kubernetes#90307. We only disabled kubelet-side validation before to make our node role labels work. UPSTREAM: <carry>: add control plane to allow roles OpenShift-Rebase-Source: 38bfed3 OpenShift-Rebase-Source: aff4434 UPSTREAM: <carry>: Do not allow nodes to set forbidden openshift labels Signed-off-by: Harshal Patil <harpatil@redhat.com>
- Loading branch information
1 parent
5342ed0
commit a87d8ff
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
staging/src/k8s.io/kubelet/pkg/apis/well_known_openshift_labels.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Copyright 2023 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package apis | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
) | ||
|
||
const ( | ||
NodeLabelControlPlane = "node-role.kubernetes.io/control-plane" | ||
NodeLabelMaster = "node-role.kubernetes.io/master" | ||
NodeLabelWorker = "node-role.kubernetes.io/worker" | ||
NodeLabelEtcd = "node-role.kubernetes.io/etcd" | ||
) | ||
|
||
var openshiftNodeLabels = sets.NewString( | ||
NodeLabelControlPlane, | ||
NodeLabelMaster, | ||
NodeLabelWorker, | ||
NodeLabelEtcd, | ||
) | ||
|
||
func OpenShiftNodeLabels() []string { | ||
return openshiftNodeLabels.List() | ||
} | ||
|
||
func IsForbiddenOpenshiftLabel(label string) bool { | ||
return openshiftNodeLabels.Has(label) | ||
} |