Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix webhook rbac and add istio tests #1276

Merged
merged 11 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ spec:
value: '{{ .Values.istio.enabled }}'
- name: ISTIO_GATEWAY
value: '{{ .Values.istio.gateway }}'
- name: ISTIO_TLS_MODE
value: '{{ .Values.istio.tlsMode }}'
image: '{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}'
imagePullPolicy: '{{ .Values.image.pullPolicy }}'
name: manager
Expand Down
148 changes: 126 additions & 22 deletions helm-charts/seldon-core-operator/templates/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,39 @@ webhooks:
resources:
- seldondeployments
- clientConfig:
caBundle: Cg==
caBundle: '{{ $ca.Cert | b64enc }}'
service:
name: seldon-webhook-service
namespace: seldon-system
namespace: '{{ .Release.Namespace }}'
path: /validate-machinelearning-seldon-io-v1alpha2-seldondeployment
failurePolicy: Fail
name: vseldondeployment.kb.io
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.Version }}
{{- if not .Values.singleNamespace }}
namespaceSelector:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.Version }}
{{- if not .Values.controllerId }}
objectSelector:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- end }}
{{- end }}
{{- if .Values.controllerId }}
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
rules:
- apiGroups:
- machinelearning.seldon.io
Expand All @@ -79,13 +105,39 @@ webhooks:
resources:
- seldondeployments
- clientConfig:
caBundle: Cg==
caBundle: '{{ $ca.Cert | b64enc }}'
service:
name: seldon-webhook-service
namespace: seldon-system
namespace: '{{ .Release.Namespace }}'
path: /validate-machinelearning-seldon-io-v1alpha3-seldondeployment
failurePolicy: Fail
name: vseldondeployment.kb.io
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.Version }}
{{- if not .Values.singleNamespace }}
namespaceSelector:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.Version }}
{{- if not .Values.controllerId }}
objectSelector:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- end }}
{{- end }}
{{- if .Values.controllerId }}
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
rules:
- apiGroups:
- machinelearning.seldon.io
Expand All @@ -98,20 +150,6 @@ webhooks:
- seldondeployments
---

{{- if not .Values.certManager.enabled -}}
apiVersion: v1
data:
ca.crt: '{{ $ca.Cert | b64enc }}'
tls.crt: '{{ $cert.Cert | b64enc }}'
tls.key: '{{ $cert.Key | b64enc }}'
kind: Secret
metadata:
name: seldon-webhook-server-cert
namespace: '{{ .Release.Namespace }}'
type: kubernetes.io/tls
{{- end }}
---

apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
Expand Down Expand Up @@ -170,13 +208,39 @@ webhooks:
resources:
- seldondeployments
- clientConfig:
caBundle: Cg==
caBundle: '{{ $ca.Cert | b64enc }}'
service:
name: seldon-webhook-service
namespace: seldon-system
namespace: '{{ .Release.Namespace }}'
path: /mutate-machinelearning-seldon-io-v1alpha2-seldondeployment
failurePolicy: Fail
name: mseldondeployment.kb.io
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.Version }}
{{- if not .Values.singleNamespace }}
namespaceSelector:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.Version }}
{{- if not .Values.controllerId }}
objectSelector:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- end }}
{{- end }}
{{- if .Values.controllerId }}
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
rules:
- apiGroups:
- machinelearning.seldon.io
Expand All @@ -188,13 +252,39 @@ webhooks:
resources:
- seldondeployments
- clientConfig:
caBundle: Cg==
caBundle: '{{ $ca.Cert | b64enc }}'
service:
name: seldon-webhook-service
namespace: seldon-system
namespace: '{{ .Release.Namespace }}'
path: /mutate-machinelearning-seldon-io-v1alpha3-seldondeployment
failurePolicy: Fail
name: mseldondeployment.kb.io
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.Version }}
{{- if not .Values.singleNamespace }}
namespaceSelector:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.Version }}
{{- if not .Values.controllerId }}
objectSelector:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- end }}
{{- end }}
{{- if .Values.controllerId }}
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
rules:
- apiGroups:
- machinelearning.seldon.io
Expand All @@ -205,3 +295,17 @@ webhooks:
- UPDATE
resources:
- seldondeployments
---

{{- if not .Values.certManager.enabled -}}
apiVersion: v1
data:
ca.crt: '{{ $ca.Cert | b64enc }}'
tls.crt: '{{ $cert.Cert | b64enc }}'
tls.key: '{{ $cert.Key | b64enc }}'
kind: Secret
metadata:
name: seldon-webhook-server-cert
namespace: '{{ .Release.Namespace }}'
type: kubernetes.io/tls
{{- end }}
3 changes: 2 additions & 1 deletion helm-charts/seldon-core-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ engine:
name: default
user: 8888
image:
pullPolicy: Always
pullPolicy: IfNotPresent
registry: docker.io
repository: seldonio/seldon-core-operator
tag: 0.5.2-SNAPSHOT
istio:
enabled: false
gateway: seldon-gateway
tlsMode: ''
predictiveUnit:
port: 9000
rbac:
Expand Down
16 changes: 13 additions & 3 deletions operator/config/cert/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ bases:
resources:
- secret.yaml

patches:
- mutating.yaml
- validating.yaml
patchesJson6902:
- target:
group: admissionregistration.k8s.io
version: v1beta1
kind: MutatingWebhookConfiguration
name: mutating-webhook-configuration
path: patch_webhook.yaml
- target:
group: admissionregistration.k8s.io
version: v1beta1
kind: ValidatingWebhookConfiguration
name: validating-webhook-configuration
path: patch_webhook.yaml

8 changes: 0 additions & 8 deletions operator/config/cert/mutating.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions operator/config/cert/patch_webhook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- op: replace
path: /webhooks/0/clientConfig/caBundle
value: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURRVENDQWltZ0F3SUJBZ0lVRkgwbG9uSUFGK2NjUGJnMmdjRlQ5R2JCaVhvd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0x6RXRNQ3NHQTFVRUF3d2tRV1J0YVhOemFXOXVJRU52Ym5SeWIyeHNaWElnVjJWaWFHOXZheUJFWlcxdgpJRU5CTUNBWERURTVNVEF3TWpFek1qRXlNRm9Z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hhb2RtbkJqaW4vNQp2bHRsZmJpanRNbUhSbHNZWm81aHZ4cFFJbXJ2azJveUErdDA3S1I5TWh4T0hRVGs5RXJkckd0RG1zc1p3cHpXCkxHS2NCMEJPbEtPTEVCRmFBUEdST2hUamdXdXJqejJ6TXdwS2JoNENnL0YyWXgvek8yaHFjbTRoNmUyU2RueFoKVDM1VGF5UzdHYnRNaG9oeU1WMTc2SVdRTmJzWkw3Rm1PK0xqU0JPR3FnT2ZmWWpGTzd5aENJdUdGblN2L2pBSgozSGhJVXhaN0lhajc2bE1VK0JjWEF5VjN6SmRkCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
9 changes: 0 additions & 9 deletions operator/config/cert/validating.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ spec:
value: "false"
- name: ISTIO_GATEWAY
value: seldon-gateway
- name: ISTIO_TLS_MODE
value: ""
image: controller:latest
name: manager
resources:
Expand Down
15 changes: 13 additions & 2 deletions operator/config/webhook/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,16 @@ configurations:
- kustomizeconfig.yaml

# Comment this if you have a k8s cluster < 1.15 and want to use namespaced or labelled operators
patchesStrategicMerge:
- patch_object_selector.yaml
patchesJson6902:
- target:
group: admissionregistration.k8s.io
version: v1beta1
kind: MutatingWebhookConfiguration
name: mutating-webhook-configuration
path: patch_webhook.yaml
- target:
group: admissionregistration.k8s.io
version: v1beta1
kind: ValidatingWebhookConfiguration
name: validating-webhook-configuration
path: patch_webhook.yaml
29 changes: 0 additions & 29 deletions operator/config/webhook/patch_object_selector.yaml

This file was deleted.

1 change: 1 addition & 0 deletions operator/controllers/istio.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package controllers
const (
ENV_ISTIO_ENABLED = "ISTIO_ENABLED"
ENV_ISTIO_GATEWAY = "ISTIO_GATEWAY"
ENV_ISTIO_TLS_MODE = "ISTIO_TLS_MODE"
ANNOTATION_ISTIO_GATEWAY = "seldon.io/istio-gateway"
)
Loading