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

Kubeflow manifest changes #1414

Merged
merged 3 commits into from
Feb 12, 2020
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 @@ -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: 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 @@ -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