Skip to content

Commit 9297e5a

Browse files
authored
Merge branch 'openshift:master' into OSD-24275
2 parents 5f3ce0a + e9aaa80 commit 9297e5a

File tree

9 files changed

+19
-23
lines changed

9 files changed

+19
-23
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,5 +437,3 @@ pkg/webhooks/namespace
437437
Commit all changes and deploy as normal.
438438

439439
Once the code changes are complete, remove the undesired `ValidatingWebhookConfiguration` object(s) manually from the cluster.
440-
441-

pkg/config/generate/namespaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var namespaceFiles = []string{
2323

2424
var (
2525
// Base lists - default values which will always be enforced regardless of managed-cluster-config
26-
namespaces = []string{"^kube.*", "^default$", "^redhat.*"}
26+
namespaces = []string{"^default$", "^openshift$", "^kube-.*", "^redhat-.*"}
2727
configmaps = []string{}
2828
)
2929

pkg/config/namespaces.go

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/webhooks/ingressconfig/ingressconfig.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ import (
1717
)
1818

1919
const (
20-
WebhookName string = "ingress-config-validation"
21-
privilegedServiceAccounts string = `^system:serviceaccounts:(kube.*|openshift.*|default|redhat.*|osde2e-[a-z0-9]{5})`
22-
privilegedUsers string = `system:admin`
23-
docString string = `Managed OpenShift customers may not modify ingress config resources because it can can degrade cluster operators and can interfere with OpenShift SRE monitoring.`
20+
WebhookName string = "ingress-config-validation"
21+
privilegedUsers string = `system:admin`
22+
docString string = `Managed OpenShift customers may not modify ingress config resources because it can can degrade cluster operators and can interfere with OpenShift SRE monitoring.`
2423
)
2524

2625
var (
2726
log = logf.Log.WithName(WebhookName)
28-
privilegedServiceAccountsRe = regexp.MustCompile(privilegedServiceAccounts)
27+
privilegedServiceAccountsRe = regexp.MustCompile(utils.PrivilegedServiceAccountGroups)
2928
privilegedUsersRe = regexp.MustCompile(privilegedUsers)
3029

3130
scope = admissionregv1.ClusterScope

pkg/webhooks/namespace/namespace.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
const (
2323
WebhookName string = "namespace-validation"
2424
badNamespace string = `(^com$|^io$|^in$)`
25-
layeredProductNamespace string = `^redhat.*`
25+
layeredProductNamespace string = `^redhat-.*`
2626
layeredProductAdminGroupName string = "layered-sre-cluster-admins"
2727
docString string = `Managed OpenShift Customers may not modify namespaces specified in the %v ConfigMaps because customer workloads should be placed in customer-created namespaces. Customers may not create namespaces identified by this regular expression %s because it could interfere with critical DNS resolution. Additionally, customers may not set or change the values of these Namespace labels %s.`
2828
clusterAdminGroup string = "cluster-admins"

pkg/webhooks/namespace/namespace_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func TestLayeredProducts(t *testing.T) {
290290
tests := []namespaceTestSuites{
291291
{
292292
// Layered admins can manipulate in the lp ns, but not privileged ones
293-
// note: ^redhat.* is a privileged ns, but lp admins have an exception in
293+
// note: ^redhat-.* is a privileged ns, but lp admins have an exception in
294294
// it (but not other privileged ns)
295295
testID: "lp-create-layered-ns",
296296
targetNamespace: "redhat-layered-product",

pkg/webhooks/prometheusrule/prometheusrule.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ import (
1818
)
1919

2020
const (
21-
WebhookName string = "prometheusrule-validation"
22-
docString string = `Managed OpenShift Customers may not create PrometheusRule in namespaces managed by Red Hat.`
23-
privilegedServiceAccountGroups string = `^system:serviceaccounts:(kube.*|openshift.*|default|redhat.*|osde2e-[a-z0-9]{5})`
21+
WebhookName string = "prometheusrule-validation"
22+
docString string = `Managed OpenShift Customers may not create PrometheusRule in namespaces managed by Red Hat.`
2423
)
2524

2625
var (
2726
timeout int32 = 2
2827
allowedUsers = []string{"kube:admin", "system:admin", "backplane-cluster-admin"}
2928
sreAdminGroups = []string{"system:serviceaccounts:openshift-backplane-srep"}
30-
privilegedServiceAccountGroupsRe = regexp.MustCompile(privilegedServiceAccountGroups)
29+
privilegedServiceAccountGroupsRe = regexp.MustCompile(utils.PrivilegedServiceAccountGroups)
3130
privilegedLabels = map[string]string{"app.kubernetes.io/name": "stackrox"}
3231
scope = admissionregv1.NamespacedScope
3332
rules = []admissionregv1.RuleWithOperations{

pkg/webhooks/sdnmigration/sdnmigration.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ import (
1616
)
1717

1818
const (
19-
WebhookName string = "sdn-migration-validation"
20-
privilegedServiceAccounts string = `^system:serviceaccounts:(kube.*|openshift.*|default|redhat.*|osde2e-[a-z0-9]{5})`
21-
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.`
22-
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"
2322
)
2423

2524
var (
2625
log = logf.Log.WithName(WebhookName)
27-
privilegedServiceAccountsRe = regexp.MustCompile(privilegedServiceAccounts)
26+
privilegedServiceAccountsRe = regexp.MustCompile(utils.PrivilegedServiceAccountGroups)
2827

2928
scope = admissionregv1.ClusterScope
3029
rules = []admissionregv1.RuleWithOperations{

pkg/webhooks/utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const (
2222
// perform restricted actions.
2323
// Centralized osde2e tests have a serviceaccount like "system:serviceaccounts:osde2e-abcde"
2424
// Decentralized osde2e tests have a serviceaccount like "system:serviceaccounts:osde2e-h-abcde"
25-
PrivilegedServiceAccountGroups string = `^system:serviceaccounts:(kube.*|openshift.*|default|redhat.*|osde2e-(h-)?[a-z0-9]{5})`
25+
PrivilegedServiceAccountGroups string = `^system:serviceaccounts:(kube-.*|openshift|openshift-.*|default|redhat-.*|osde2e-(h-)?[a-z0-9]{5})`
2626
)
2727

2828
var (

0 commit comments

Comments
 (0)