Skip to content

Commit de97041

Browse files
committed
fix gcpauth and olm for k8s v1.22+
1 parent d632da5 commit de97041

File tree

1 file changed

+186
-0
lines changed

1 file changed

+186
-0
lines changed

Diff for: deploy/addons/gcp-auth/gcp-auth-webhook.yaml.tmpl

+186
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Copyright 2017 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
---
16+
apiVersion: v1
17+
kind: ServiceAccount
18+
metadata:
19+
name: minikube-gcp-auth-certs
20+
namespace: gcp-auth
21+
---
22+
apiVersion: rbac.authorization.k8s.io/v1
23+
kind: ClusterRole
24+
metadata:
25+
name: minikube-gcp-auth-certs
26+
rules:
27+
- apiGroups:
28+
- ''
29+
resources:
30+
- secrets
31+
verbs:
32+
- list
33+
- get
34+
- create
35+
- apiGroups:
36+
- admissionregistration.k8s.io
37+
resources:
38+
- mutatingwebhookconfigurations
39+
verbs:
40+
- get
41+
- update
42+
43+
---
44+
apiVersion: rbac.authorization.k8s.io/v1
45+
kind: ClusterRoleBinding
46+
metadata:
47+
name: minikube-gcp-auth-certs
48+
namespace: metadata
49+
roleRef:
50+
apiGroup: rbac.authorization.k8s.io
51+
kind: ClusterRole
52+
name: minikube-gcp-auth-certs
53+
subjects:
54+
- kind: ServiceAccount
55+
name: minikube-gcp-auth-certs
56+
namespace: gcp-auth
57+
---
58+
apiVersion: batch/v1
59+
kind: Job
60+
metadata:
61+
name: gcp-auth-certs-create
62+
namespace: gcp-auth
63+
spec:
64+
template:
65+
metadata:
66+
name: gcp-auth-certs-create
67+
spec:
68+
serviceAccountName: minikube-gcp-auth-certs
69+
containers:
70+
- name: create
71+
image: {{.CustomRegistries.KubeWebhookCertgen | default .ImageRepository | default .Registries.KubeWebhookCertgen}}{{.Images.KubeWebhookCertgen}}
72+
imagePullPolicy: IfNotPresent
73+
args:
74+
- create
75+
- --host=gcp-auth,gcp-auth.gcp-auth,gcp-auth.gcp-auth.svc
76+
- --namespace=gcp-auth
77+
- --secret-name=gcp-auth-certs
78+
restartPolicy: OnFailure
79+
---
80+
apiVersion: apps/v1
81+
kind: Deployment
82+
metadata:
83+
name: gcp-auth
84+
namespace: gcp-auth
85+
spec:
86+
selector:
87+
matchLabels:
88+
app: gcp-auth
89+
template:
90+
metadata:
91+
labels:
92+
app: gcp-auth
93+
kubernetes.io/minikube-addons: gcp-auth
94+
spec:
95+
containers:
96+
- name: gcp-auth
97+
image: {{.CustomRegistries.GCPAuthWebhook | default .ImageRepository | default .Registries.GCPAuthWebhook}}{{.Images.GCPAuthWebhook}}
98+
imagePullPolicy: IfNotPresent
99+
ports:
100+
- containerPort: 8443
101+
volumeMounts:
102+
- name: webhook-certs
103+
mountPath: /etc/webhook/certs
104+
readOnly: true
105+
- name: gcp-project
106+
mountPath: /var/lib/minikube/google_cloud_project
107+
readOnly: true
108+
volumes:
109+
- name: webhook-certs
110+
secret:
111+
secretName: gcp-auth-certs
112+
- name: gcp-project
113+
hostPath:
114+
path: /var/lib/minikube/google_cloud_project
115+
type: File
116+
---
117+
apiVersion: batch/v1
118+
kind: Job
119+
metadata:
120+
name: gcp-auth-certs-patch
121+
namespace: gcp-auth
122+
spec:
123+
template:
124+
metadata:
125+
name: gcp-auth-certs-patch
126+
spec:
127+
serviceAccountName: minikube-gcp-auth-certs
128+
containers:
129+
- name: patch
130+
image: {{.CustomRegistries.KubeWebhookCertgen | default .ImageRepository | default .Registries.KubeWebhookCertgen}}{{.Images.KubeWebhookCertgen}}
131+
imagePullPolicy: IfNotPresent
132+
args:
133+
- patch
134+
- --secret-name=gcp-auth-certs
135+
- --namespace=gcp-auth
136+
- --patch-validating=false
137+
- --webhook-name=gcp-auth-webhook-cfg
138+
restartPolicy: OnFailure
139+
---
140+
apiVersion: admissionregistration.k8s.io/v1
141+
kind: MutatingWebhookConfiguration
142+
metadata:
143+
name: gcp-auth-webhook-cfg
144+
labels:
145+
app: gcp-auth
146+
webhooks:
147+
- name: gcp-auth-mutate.k8s.io
148+
failurePolicy: Ignore
149+
objectSelector:
150+
matchExpressions:
151+
- key: gcp-auth-skip-secret
152+
operator: DoesNotExist
153+
namespaceSelector:
154+
matchExpressions:
155+
- key: name
156+
operator: NotIn
157+
values:
158+
- kube-system
159+
sideEffects: None
160+
admissionReviewVersions: ["v1","v1beta1"]
161+
clientConfig:
162+
service:
163+
name: gcp-auth
164+
namespace: gcp-auth
165+
path: "/mutate"
166+
rules:
167+
- operations: ["CREATE"]
168+
apiGroups: ["*"]
169+
apiVersions: ["*"]
170+
resources: ["pods"]
171+
scope: "*"
172+
- name: gcp-auth-mutate-sa.k8s.io
173+
failurePolicy: Ignore
174+
sideEffects: None
175+
admissionReviewVersions: ["v1","v1beta1"]
176+
clientConfig:
177+
service:
178+
name: gcp-auth
179+
namespace: gcp-auth
180+
path: "/mutate/sa"
181+
rules:
182+
- operations: ["CREATE"]
183+
apiGroups: ["*"]
184+
apiVersions: ["*"]
185+
resources: ["serviceaccounts"]
186+
scope: "*"

0 commit comments

Comments
 (0)