Skip to content

Commit 6e0ada8

Browse files
committed
Added check to allow hive admin user to trigger an SDN migration
1 parent 46efb84 commit 6e0ada8

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pkg/webhooks/sdnmigration/sdnmigration.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ import (
1616
)
1717

1818
const (
19-
WebhookName string = "sdn-migration-validation"
20-
docString string = `Managed OpenShift customers may not modify the network config type because it can can degrade cluster operators and can interfere with OpenShift SRE monitoring.`
21-
overrideAnnotation string = "unsupported-red-hat-internal-testing"
19+
WebhookName string = "sdn-migration-validation"
20+
docString string = `Managed OpenShift customers may not modify the network config type because it can can degrade cluster operators and can interfere with OpenShift SRE monitoring.`
21+
overrideAnnotation string = "unsupported-red-hat-internal-testing"
22+
privilegedHiveUserAccount string = "admin-kubeconfig-signer"
2223
)
2324

2425
var (
@@ -45,6 +46,15 @@ type NetworkConfigWebhook struct {
4546

4647
// Authorized will determine if the request is allowed
4748
func (w *NetworkConfigWebhook) Authorized(request admissionctl.Request) admissionctl.Response {
49+
// We are doing this check to ensure that hive can trigger the
50+
// migration process. Once a cluster install completes successfully,
51+
// the admin password and kubeconfig will be uploaded as secrets and linked to the ClusterDeployment resource
52+
// on hive under the cluster namespace. Hive uses this credentials for the user "admin-kubeconfig-signer"
53+
// in order to call the api on the clusters and execute administrative tasks.
54+
if request.UserInfo.Username == privilegedHiveUserAccount {
55+
return utils.WebhookResponse(request, true, "Privileged user may access")
56+
}
57+
4858
// allow if modified by an allow listed service account
4959
for _, group := range request.UserInfo.Groups {
5060
if privilegedServiceAccountsRe.Match([]byte(group)) {

0 commit comments

Comments
 (0)