Skip to content

Commit 9dfb60f

Browse files
committed
update and fix perms after reviewing audit logs
1 parent 84660be commit 9dfb60f

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

pkg/webhooks/hcpnamespace/hcpnamespace.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var (
2727
"system:serviceaccount:open-cluster-management-agent:klusterlet",
2828
"system:serviceaccount:hypershift:operator",
2929
"system:serviceaccount:ocm:ocm",
30+
"system:serviceaccount:kube-system:namespace-controller",
3031
}
3132

3233
// Protected namespace patterns

pkg/webhooks/hostedcontrolplane/hostedcontrolplane.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ const (
2323
var (
2424
// Full usernames of Service accounts allowed to delete HostedControlPlanes
2525
allowedServiceAccountsUsernames = []string{
26-
"system:serviceaccount:open-cluster-management-agent:klusterlet-work-sa", "system:serviceaccount:kube-system:generic-garbage-collector",
26+
"system:serviceaccount:open-cluster-management-agent:klusterlet-work-sa",
27+
"system:serviceaccount:kube-system:generic-garbage-collector",
28+
"system:serviceaccount:hypershift:operator",
2729
}
2830
// Names of Service accounts allowed to delete HostedControlPlanes
2931
allowedServiceAccountsNames = []string{
30-
"cluster-api", "control-plane-pki-operator",
32+
"cluster-api",
33+
"control-plane-pki-operator",
3134
}
3235

3336
scope = admissionregv1.NamespacedScope

pkg/webhooks/manifestworks/manifestworks.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ const (
2323
var (
2424
// List of service accounts allowed to delete ManifestWorks
2525
allowedServiceAccounts = []string{
26-
"system:serviceaccount:open-cluster-management-agent:klusterlet-work-sa",
27-
"system:serviceaccount:open-cluster-management-agent:klusterlet",
28-
"system:serviceaccount:hypershift:operator",
2926
"system:serviceaccount:ocm:ocm",
3027
"system:serviceaccount:kube-system:generic-garbage-collector",
3128
"system:serviceaccount:multicluster-engine:ocm-foundation-sa",

pkg/webhooks/manifestworks/manifestworks_test.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,14 @@ func TestManifestWorksAuthorized(t *testing.T) {
1717
shouldBeAllowed bool
1818
}{
1919
{
20-
name: "Klusterlet work SA can delete manifestworks",
21-
username: "system:serviceaccount:open-cluster-management-agent:klusterlet-work-sa",
20+
name: "OCM SA can delete manifestworks",
21+
username: "system:serviceaccount:ocm:ocm",
2222
operation: admissionv1.Delete,
2323
shouldBeAllowed: true,
2424
},
2525
{
26-
name: "Klusterlet SA can delete manifestworks",
27-
username: "system:serviceaccount:open-cluster-management-agent:klusterlet",
28-
operation: admissionv1.Delete,
29-
shouldBeAllowed: true,
30-
},
31-
{
32-
name: "Hypershift operator can delete manifestworks",
33-
username: "system:serviceaccount:hypershift:operator",
26+
name: "ocm-foundation-s SA can delete manifestworks",
27+
username: "system:serviceaccount:multicluster-engine:ocm-foundation-sa",
3428
operation: admissionv1.Delete,
3529
shouldBeAllowed: true,
3630
},

0 commit comments

Comments
 (0)