Skip to content

Commit a174370

Browse files
authored
bump kindest node to use 1.30.0 (#937)
1 parent 6d5ca02 commit a174370

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
REGISTRY ?= ghcr.io
2-
KIND_IMAGE ?= kindest/node:v1.28.0
2+
KIND_IMAGE ?= kindest/node:v1.30.0
33
ifndef TAG
44
TAG ?= $(shell git rev-parse --short=7 HEAD)
55
endif

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export this variable which specifies the number of member clusters that will be
4141
export MEMBER_CLUSTER_COUNT=1
4242
```
4343

44-
from the root directory of the repo run the following command, by default a hub cluster gets created which is the control plane for fleet (**The makefile uses kindest/node:v1.28.0**)
44+
from the root directory of the repo run the following command, by default a hub cluster gets created which is the control plane for fleet (**The makefile uses kindest/node:v1.30.0**)
4545

4646
```shell
4747
make setup-clusters

pkg/webhook/validation/uservalidation.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424

2525
const (
2626
mastersGroup = "system:masters"
27+
kubeadmClusterAdminsGroup = "kubeadm:cluster-admins"
2728
serviceAccountsGroup = "system:serviceaccounts"
2829
nodeGroup = "system:nodes"
2930
kubeSchedulerUser = "system:kube-scheduler"
@@ -48,7 +49,7 @@ var (
4849
func ValidateUserForFleetCRD(req admission.Request, whiteListedUsers []string, group string) admission.Response {
4950
namespacedName := types.NamespacedName{Name: req.Name, Namespace: req.Namespace}
5051
userInfo := req.UserInfo
51-
if checkCRDGroup(group) && !isMasterGroupUserOrWhiteListedUser(whiteListedUsers, userInfo) {
52+
if checkCRDGroup(group) && !isAdminGroupUserOrWhiteListedUser(whiteListedUsers, userInfo) {
5253
klog.V(2).InfoS(deniedModifyResource, "user", userInfo.Username, "groups", userInfo.Groups, "operation", req.Operation, "GVK", req.RequestKind, "subResource", req.SubResource, "namespacedName", namespacedName)
5354
return admission.Denied(fmt.Sprintf(ResourceDeniedFormat, userInfo.Username, utils.GenerateGroupString(userInfo.Groups), req.Operation, req.RequestKind, req.SubResource, namespacedName))
5455
}
@@ -60,7 +61,7 @@ func ValidateUserForFleetCRD(req admission.Request, whiteListedUsers []string, g
6061
func ValidateUserForResource(req admission.Request, whiteListedUsers []string) admission.Response {
6162
namespacedName := types.NamespacedName{Name: req.Name, Namespace: req.Namespace}
6263
userInfo := req.UserInfo
63-
if isMasterGroupUserOrWhiteListedUser(whiteListedUsers, userInfo) || isUserAuthenticatedServiceAccount(userInfo) || isUserKubeScheduler(userInfo) || isUserKubeControllerManager(userInfo) || isNodeGroupUser(userInfo) {
64+
if isAdminGroupUserOrWhiteListedUser(whiteListedUsers, userInfo) || isUserAuthenticatedServiceAccount(userInfo) || isUserKubeScheduler(userInfo) || isUserKubeControllerManager(userInfo) || isNodeGroupUser(userInfo) {
6465
klog.V(3).InfoS(allowedModifyResource, "user", userInfo.Username, "groups", userInfo.Groups, "operation", req.Operation, "GVK", req.RequestKind, "subResource", req.SubResource, "namespacedName", namespacedName)
6566
return admission.Allowed(fmt.Sprintf(ResourceAllowedFormat, userInfo.Username, utils.GenerateGroupString(userInfo.Groups), req.Operation, req.RequestKind, req.SubResource, namespacedName))
6667
}
@@ -130,9 +131,11 @@ func ValidatedUpstreamMemberClusterUpdate(currentMC, oldMC clusterv1beta1.Member
130131
return admission.Allowed(fmt.Sprintf(ResourceAllowedFormat, userInfo.Username, utils.GenerateGroupString(userInfo.Groups), req.Operation, req.RequestKind, req.SubResource, namespacedName))
131132
}
132133

133-
// isMasterGroupUserOrWhiteListedUser returns true is user belongs to white listed users or user belongs to system:masters group.
134-
func isMasterGroupUserOrWhiteListedUser(whiteListedUsers []string, userInfo authenticationv1.UserInfo) bool {
135-
return slices.Contains(whiteListedUsers, userInfo.Username) || slices.Contains(userInfo.Groups, mastersGroup)
134+
// isAdminGroupUserOrWhiteListedUser returns true is user belongs to white listed users or user belongs to system:masters/kubeadm:cluster-admins group.
135+
// In clusters using kubeadm, kubernetes-admin belongs to kubeadm:cluster-admins group and kubernetes-super-admin user belongs to system:masters group.
136+
// https://kubernetes.io/docs/reference/setup-tools/kubeadm/implementation-details/#generate-kubeconfig-files-for-control-plane-components
137+
func isAdminGroupUserOrWhiteListedUser(whiteListedUsers []string, userInfo authenticationv1.UserInfo) bool {
138+
return slices.Contains(whiteListedUsers, userInfo.Username) || slices.Contains(userInfo.Groups, mastersGroup) || slices.Contains(userInfo.Groups, kubeadmClusterAdminsGroup)
136139
}
137140

138141
// isUserAuthenticatedServiceAccount returns true if user is a valid service account.

pkg/webhook/validation/uservalidation_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ func TestValidateUserForResource(t *testing.T) {
3737
},
3838
wantResponse: admission.Allowed(fmt.Sprintf(ResourceAllowedFormat, "test-user", utils.GenerateGroupString([]string{mastersGroup}), admissionv1.Create, &utils.RoleMetaGVK, "", types.NamespacedName{Name: "test-role", Namespace: "test-namespace"})),
3939
},
40+
"allow user in kubeadm:cluster-admin group": {
41+
req: admission.Request{
42+
AdmissionRequest: admissionv1.AdmissionRequest{
43+
Name: "test-role",
44+
Namespace: "test-namespace",
45+
RequestKind: &utils.RoleMetaGVK,
46+
UserInfo: authenticationv1.UserInfo{
47+
Username: "test-user",
48+
Groups: []string{kubeadmClusterAdminsGroup},
49+
},
50+
Operation: admissionv1.Create,
51+
},
52+
},
53+
wantResponse: admission.Allowed(fmt.Sprintf(ResourceAllowedFormat, "test-user", utils.GenerateGroupString([]string{kubeadmClusterAdminsGroup}), admissionv1.Create, &utils.RoleMetaGVK, "", types.NamespacedName{Name: "test-role", Namespace: "test-namespace"})),
54+
},
4055
// UT to test GenerateGroupString in pkg/utils/common.gp
4156
"allow user in system:masters group along with 10 other groups": {
4257
req: admission.Request{

test/e2e/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -o pipefail
66

77
# Before updating the default kind image to use, verify that the version is supported
88
# by the current kind release.
9-
KIND_IMAGE="${KIND_IMAGE:-kindest/node:v1.28.0}"
9+
KIND_IMAGE="${KIND_IMAGE:-kindest/node:v1.30.0}"
1010
KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}"
1111
MEMBER_CLUSTER_COUNT=$1
1212

0 commit comments

Comments
 (0)