Skip to content

Commit dd1104c

Browse files
authored
Revert "OSD-24275: Validate machineCIDR is contained in default ingresscontro…"
1 parent 50c9f1f commit dd1104c

File tree

8 files changed

+28
-567
lines changed

8 files changed

+28
-567
lines changed

build/resources.go

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ const (
3232
roleName string = "validation-webhook"
3333
prometheusRoleName string = "prometheus-k8s"
3434
repoName string = "managed-cluster-validating-webhooks"
35-
// Role and Binding for reading cluster-config-v1 config map...
36-
clusterConfigRole string = "config-v1-reader-wh"
37-
clusterConfigRoleBinding string = "validation-webhook-cluster-config-v1-reader"
3835
// Used to define what phase a resource should be deployed in by package-operator
3936
pkoPhaseAnnotation string = "package-operator.run/phase"
4037
// Defines the 'rbac' package-operator phase for any resources related to RBAC
@@ -214,60 +211,6 @@ func createClusterRoleBinding() *rbacv1.ClusterRoleBinding {
214211
}
215212
}
216213

217-
func createClusterConfigRole() *rbacv1.Role {
218-
return &rbacv1.Role{
219-
TypeMeta: metav1.TypeMeta{
220-
Kind: "Role",
221-
APIVersion: rbacv1.SchemeGroupVersion.String(),
222-
},
223-
ObjectMeta: metav1.ObjectMeta{
224-
Name: clusterConfigRole,
225-
Namespace: "kube-system",
226-
},
227-
Rules: []rbacv1.PolicyRule{
228-
{
229-
APIGroups: []string{
230-
"",
231-
},
232-
Resources: []string{
233-
"configmaps",
234-
},
235-
Verbs: []string{
236-
"get",
237-
},
238-
ResourceNames: []string{
239-
"cluster-config-v1",
240-
},
241-
},
242-
},
243-
}
244-
}
245-
246-
func createClusterConfigRoleBinding() *rbacv1.RoleBinding {
247-
return &rbacv1.RoleBinding{
248-
TypeMeta: metav1.TypeMeta{
249-
Kind: "RoleBinding",
250-
APIVersion: rbacv1.SchemeGroupVersion.String(),
251-
},
252-
ObjectMeta: metav1.ObjectMeta{
253-
Name: clusterConfigRoleBinding,
254-
Namespace: "kube-system",
255-
},
256-
Subjects: []rbacv1.Subject{
257-
{
258-
Kind: "ServiceAccount",
259-
Name: serviceAccountName,
260-
Namespace: *namespace,
261-
},
262-
},
263-
RoleRef: rbacv1.RoleRef{
264-
Name: clusterConfigRole,
265-
Kind: "Role",
266-
APIGroup: rbacv1.GroupName,
267-
},
268-
}
269-
}
270-
271214
func createPrometheusRole() *rbacv1.Role {
272215
return &rbacv1.Role{
273216
TypeMeta: metav1.TypeMeta{
@@ -884,7 +827,6 @@ func sliceContains(needle string, haystack []string) bool {
884827

885828
func main() {
886829
flag.Parse()
887-
utils.BuildRun = true
888830

889831
skip := strings.Split(*excludes, ",")
890832
onlyInclude := strings.Split(*only, "")
@@ -909,8 +851,6 @@ func main() {
909851
templateResources.Add(utils.DefaultLabelSelector(), runtime.RawExtension{Object: createClusterRoleBinding()})
910852
templateResources.Add(utils.DefaultLabelSelector(), runtime.RawExtension{Object: createPrometheusRole()})
911853
templateResources.Add(utils.DefaultLabelSelector(), runtime.RawExtension{Object: createPromethusRoleBinding()})
912-
templateResources.Add(utils.DefaultLabelSelector(), runtime.RawExtension{Object: createClusterConfigRole()})
913-
templateResources.Add(utils.DefaultLabelSelector(), runtime.RawExtension{Object: createClusterConfigRoleBinding()})
914854
templateResources.Add(utils.DefaultLabelSelector(), runtime.RawExtension{Object: createServiceMonitor()})
915855
templateResources.Add(utils.DefaultLabelSelector(), runtime.RawExtension{Object: createCACertConfigMap()})
916856
templateResources.Add(utils.DefaultLabelSelector(), runtime.RawExtension{Object: createService()})

build/selectorsyncset.yaml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -123,35 +123,6 @@ objects:
123123
- kind: ServiceAccount
124124
name: prometheus-k8s
125125
namespace: openshift-monitoring
126-
- apiVersion: rbac.authorization.k8s.io/v1
127-
kind: Role
128-
metadata:
129-
creationTimestamp: null
130-
name: config-v1-reader-wh
131-
namespace: kube-system
132-
rules:
133-
- apiGroups:
134-
- ""
135-
resourceNames:
136-
- cluster-config-v1
137-
resources:
138-
- configmaps
139-
verbs:
140-
- get
141-
- apiVersion: rbac.authorization.k8s.io/v1
142-
kind: RoleBinding
143-
metadata:
144-
creationTimestamp: null
145-
name: validation-webhook-cluster-config-v1-reader
146-
namespace: kube-system
147-
roleRef:
148-
apiGroup: rbac.authorization.k8s.io
149-
kind: Role
150-
name: config-v1-reader-wh
151-
subjects:
152-
- kind: ServiceAccount
153-
name: validation-webhook
154-
namespace: openshift-validation-webhook
155126
- apiVersion: monitoring.coreos.com/v1
156127
kind: ServiceMonitor
157128
metadata:

cmd/main.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ import (
2121
"github.com/openshift/managed-cluster-validating-webhooks/pkg/k8sutil"
2222
"github.com/openshift/managed-cluster-validating-webhooks/pkg/localmetrics"
2323
"github.com/openshift/managed-cluster-validating-webhooks/pkg/webhooks"
24-
"github.com/openshift/managed-cluster-validating-webhooks/pkg/webhooks/utils"
2524
)
2625

2726
var log = logf.Log.WithName("handler")
2827

2928
var (
3029
listenAddress = flag.String("listen", "0.0.0.0", "listen address")
3130
listenPort = flag.String("port", "5000", "port to listen on")
32-
metricsAddr string
31+
testHooks = flag.Bool("testhooks", false, "Test webhook URI uniqueness and quit?")
3332

3433
useTLS = flag.Bool("tls", false, "Use TLS? Must specify -tlskey, -tlscert, -cacert")
3534
tlsKey = flag.String("tlskey", "", "TLS Key for TLS")
@@ -40,18 +39,15 @@ var (
4039
metricsPort = "8080"
4140
)
4241

43-
func init() {
44-
// Allow export webhook var to share flag value...
45-
flag.BoolVar(&utils.TestHooks, "testhooks", false, "Test webhook URI uniqueness and quit?")
42+
func main() {
43+
var metricsAddr string
4644
flag.StringVar(&metricsAddr, "metrics-bind-address", ":"+metricsPort, "The address the metric endpoint binds to.")
4745
flag.Parse()
48-
}
49-
50-
func main() {
5146
klog.SetOutput(os.Stdout)
47+
5248
logf.SetLogger(klogr.New())
5349

54-
if !utils.TestHooks {
50+
if !*testHooks {
5551
log.Info("HTTP server running at", "listen", net.JoinHostPort(*listenAddress, *listenPort))
5652
}
5753
dispatcher := dispatcher.NewDispatcher(webhooks.Webhooks)
@@ -62,12 +58,12 @@ func main() {
6258
panic(fmt.Errorf("Duplicate webhook trying to listen on %s", realHook.GetURI()))
6359
}
6460
seen[name] = true
65-
if !utils.TestHooks {
61+
if !*testHooks {
6662
log.Info("Listening", "webhookName", name, "URI", realHook.GetURI())
6763
}
6864
http.HandleFunc(realHook.GetURI(), dispatcher.HandleRequest)
6965
}
70-
if utils.TestHooks {
66+
if *testHooks {
7167
os.Exit(0)
7268
}
7369

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ require (
5757
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
5858
github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87 // indirect
5959
github.com/openshift/elasticsearch-operator v0.0.0-20220613183908-e1648e67c298 // indirect
60-
github.com/openshift/installer v0.16.1 // indirect
6160
github.com/pkg/errors v0.9.1 // indirect
6261
github.com/prometheus/client_model v0.6.1 // indirect
6362
github.com/prometheus/common v0.59.1 // indirect

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ github.com/openshift/elasticsearch-operator v0.0.0-20220613183908-e1648e67c298 h
187187
github.com/openshift/elasticsearch-operator v0.0.0-20220613183908-e1648e67c298/go.mod h1:6dxhWPY3Wr/0b0eGrFpV7gcyeS+ne48Mo9OQ9dxrLNI=
188188
github.com/openshift/hive/apis v0.0.0-20230327212335-7fd70848a6d5 h1:adHXZ1WFqCvXpargpTa6divneeUuvV2xr/D6NWgbqS8=
189189
github.com/openshift/hive/apis v0.0.0-20230327212335-7fd70848a6d5/go.mod h1:VIxA5HhvBmsqVn7aUVQYs004B9K4U5A+HrFwvRq2nK8=
190-
github.com/openshift/installer v0.16.1 h1:PmjALN9x1NVNVi3SCqfz0ZwVCgOkQLQWo2nHYXREq/A=
191-
github.com/openshift/installer v0.16.1/go.mod h1:VWGgpJgF8DGCKQjbccnigglhZnHtRLCZ6cxqkXN4Ck0=
192190
github.com/openshift/operator-custom-metrics v0.5.1 h1:1pk4YMUV+cmqfV0f2fyxY62cl7Gc76kwudJT+EdcfYM=
193191
github.com/openshift/operator-custom-metrics v0.5.1/go.mod h1:0dYDHi/ubKRWzsC9MmW6bRMdBgo1QSOuAh3GupTe0Sw=
194192
github.com/openshift/osde2e-common v0.0.0-20231010150014-8a4449a371e6 h1:MPcnO0eeWEyjLBA4mMgJ8pv8u7DjKC7yS+a39R+zhqs=

0 commit comments

Comments
 (0)