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 Feb 12, 2020
2 parents 9acb670 + ade3ee8 commit ef722f9
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 @@ -30,13 +30,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 @@ -49,6 +54,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand All @@ -74,13 +80,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 @@ -93,6 +104,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand All @@ -118,13 +130,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 @@ -137,6 +154,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand Down Expand Up @@ -177,13 +195,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 @@ -196,6 +219,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand All @@ -221,13 +245,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 @@ -240,6 +269,7 @@ webhooks:
objectSelector:
matchLabels:
seldon.io/controller-id: {{ .Values.controllerId }}
{{- end }}
{{- end }}
rules:
- apiGroups:
Expand All @@ -265,13 +295,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 @@ -284,6 +319,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 @@ -51,6 +51,8 @@ istio:
enabled: false
gateway: seldon-gateway
tlsMode: ''
kubeflow:
false
manager:
memoryRequest: 200Mi
memoryLimit: 300Mi
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 @@ -220,8 +222,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 ef722f9

Please sign in to comment.