Skip to content

Commit

Permalink
Merge pull request #1414 from cliveseldon/1411_kubeflow_req
Browse files Browse the repository at this point in the history
Kubeflow manifest changes
  • Loading branch information
seldondev authored and ukclivecox committed Feb 13, 2020
1 parent b363510 commit 0bb6388
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spec:
metadata:
annotations:
prometheus.io/scrape: 'true'
sidecar.istio.io/inject: 'false'
labels:
app: seldon
app.kubernetes.io/instance: seldon1
Expand Down
36 changes: 36 additions & 0 deletions helm-charts/seldon-core-operator/templates/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ webhooks:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- if .Values.kubeflow }}
matchLabels:
serving.kubeflow.org/inferenceservice: enabled
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if not .Values.kubeflow }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.GitVersion }}
{{- if not .Values.controllerId }}
objectSelector:
Expand All @@ -63,6 +68,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand All @@ -88,13 +94,18 @@ webhooks:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- if .Values.kubeflow }}
matchLabels:
serving.kubeflow.org/inferenceservice: enabled
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if not .Values.kubeflow }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.GitVersion }}
{{- if not .Values.controllerId }}
objectSelector:
Expand All @@ -107,6 +118,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand All @@ -132,13 +144,18 @@ webhooks:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- if .Values.kubeflow }}
matchLabels:
serving.kubeflow.org/inferenceservice: enabled
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if not .Values.kubeflow }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.GitVersion }}
{{- if not .Values.controllerId }}
objectSelector:
Expand All @@ -151,6 +168,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand Down Expand Up @@ -191,13 +209,18 @@ webhooks:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- if .Values.kubeflow }}
matchLabels:
serving.kubeflow.org/inferenceservice: enabled
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if not .Values.kubeflow }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.GitVersion }}
{{- if not .Values.controllerId }}
objectSelector:
Expand All @@ -210,6 +233,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand All @@ -235,13 +259,18 @@ webhooks:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- if .Values.kubeflow }}
matchLabels:
serving.kubeflow.org/inferenceservice: enabled
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if not .Values.kubeflow }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.GitVersion }}
{{- if not .Values.controllerId }}
objectSelector:
Expand All @@ -254,6 +283,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand All @@ -279,13 +309,18 @@ webhooks:
matchExpressions:
- key: seldon.io/controller-id
operator: DoesNotExist
{{- if .Values.kubeflow }}
matchLabels:
serving.kubeflow.org/inferenceservice: enabled
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.singleNamespace }}
namespaceSelector:
matchLabels:
seldon.io/controller-id: {{ .Release.Namespace }}
{{- end }}
{{- if not .Values.kubeflow }}
{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.GitVersion }}
{{- if not .Values.controllerId }}
objectSelector:
Expand All @@ -298,6 +333,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand Down
2 changes: 2 additions & 0 deletions helm-charts/seldon-core-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ istio:
enabled: false
gateway: seldon-gateway
tlsMode: ''
kubeflow:
false
manager:
memoryRequest: 20Mi
memoryLimit: 30Mi
Expand Down
2 changes: 2 additions & 0 deletions operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
replicas: 1
template:
metadata:
annotations:
sidecar.istio.io/inject: 'false'
labels:
control-plane: seldon-controller-manager
spec:
Expand Down
7 changes: 5 additions & 2 deletions operator/helm/split_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
HELM_CERTMANAGER_IF_START = '{{- if .Values.certManager.enabled -}}\n'
HELM_NOT_CERTMANAGER_IF_START = '{{- if not .Values.certManager.enabled -}}\n'
HELM_VERSION_IF_START= '{{- if semverCompare ">=1.15.0" .Capabilities.KubeVersion.GitVersion }}\n'
HELM_KUBEFLOW_IF_START='{{- if .Values.kubeflow }}\n'
HELM_KUBEFLOW_IF_NOT_START='{{- if not .Values.kubeflow }}\n'
#HELM_SECRET_IF_START = '{{- if .Values.webhook.secretProvided -}}\n'
HELM_IF_END = '{{- end }}\n'

Expand Down Expand Up @@ -213,8 +215,9 @@ def helm_release(value: str):
# Write webhook related data in 1 file
namespaceSelector = " namespaceSelector:\n matchLabels:\n seldon.io/controller-id: " + helm_release("Namespace") + "\n"
objectSelector = " objectSelector:\n matchLabels:\n seldon.io/controller-id: " + helm_value("controllerId") + "\n"
webhookData = re.sub(r"(.*namespaceSelector:\n.*matchExpressions:\n.*\n.*\n)",HELM_VERSION_IF_START+HELM_NOT_SINGLE_NAMESPACE_IF_START+r"\1"+HELM_IF_END+HELM_IF_END+HELM_SINGLE_NAMESPACE_IF_START+namespaceSelector+HELM_IF_END,webhookData, re.M)
webhookData = re.sub(r"(.*objectSelector:\n.*matchExpressions:\n.*\n.*\n)",HELM_VERSION_IF_START+HELM_NOT_CONTROLLERID_IF_START+r"\1"+HELM_IF_END+HELM_IF_END+HELM_CONTROLLERID_IF_START+objectSelector+HELM_IF_END,webhookData, re.M)
kubeflowSelector = " matchLabels:\n serving.kubeflow.org/inferenceservice: enabled\n"
webhookData = re.sub(r"(.*namespaceSelector:\n.*matchExpressions:\n.*\n.*\n)",HELM_VERSION_IF_START+HELM_NOT_SINGLE_NAMESPACE_IF_START+r"\1"+HELM_KUBEFLOW_IF_START+kubeflowSelector+HELM_IF_END+HELM_IF_END+HELM_IF_END+HELM_SINGLE_NAMESPACE_IF_START+namespaceSelector+HELM_IF_END,webhookData, re.M)
webhookData = re.sub(r"(.*objectSelector:\n.*matchExpressions:\n.*\n.*\n)",HELM_KUBEFLOW_IF_NOT_START+HELM_VERSION_IF_START+HELM_NOT_CONTROLLERID_IF_START+r"\1"+HELM_IF_END+HELM_IF_END+HELM_CONTROLLERID_IF_START+objectSelector+HELM_IF_END+HELM_IF_END,webhookData, re.M)

filename = args.folder + "/" + "webhook.yaml"
with open(filename, 'w') as outfile:
Expand Down

0 comments on commit 0bb6388

Please sign in to comment.