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 selector k8s version #1237

Merged
merged 2 commits into from
Dec 10, 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
2 changes: 1 addition & 1 deletion doc/source/examples/go_example.nblink
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"path": "../../../examples/wrappers/go/SeldonGoModel.ipynb"
"path": "../../../incubating/wrappers/s2i/go/SeldonGoModel.ipynb"
}
34 changes: 32 additions & 2 deletions doc/source/workflow/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ The [Kustomize](https://github.com/kubernetes-sigs/kustomize) installation can b

To use the template directly there is a Makefile which has a set of useful commands:

For kubernetes <1.15 comment the patch_object_selector [here](https://github.com/SeldonIO/seldon-core/blob/master/operator/config/webhook/kustomization.yaml)

Install cert-manager

Expand Down Expand Up @@ -122,7 +123,11 @@ See our [upgrading notes](../reference/upgrading.md)

## Advanced Usage

### Install Seldon Core in a single namespace
### Install Seldon Core in a single namespace (version >=1.0)

**You will need a k8s cluster >= 1.15**

#### Helm

You can install the Seldon Core Operator so it only manages resources in its namespace. An example to install in a namespace `seldon-ns1` is shown below:

Expand All @@ -146,12 +151,27 @@ helm install seldon-namespaced seldon-core-operator --repo https://storage.goog

We set `crd.create=true` to create the CRD. If you are installing a Seldon Core Operator after you have installed a previous Seldon Core Operator on the same cluster you will need to set `crd.create=false`.


#### Kustomize

An example install is provided in the Makefile in the Operator folder:

```
make deploy-namespaced1
```


See the [multiple server example notebook](../examples/multiple_operators.html).

### Label focused Seldon Core Operator
### Label focused Seldon Core Operator (version >=1.0)

**You will need a k8s cluster >= 1.15**

You can install the Seldon Core Operator so it manages only SeldonDeployments with the label `seldon.io/controller-id` where the value of the label matches the controller-id of the running operator. An example for a namespace `seldon-id1` is shown below:


#### Helm

```bash
kubectl create namespace seldon-id1
```
Expand All @@ -171,5 +191,15 @@ helm install seldon-controllerid seldon-core-operator --repo https://storage.go

We set `crd.create=true` to create the CRD. If you are installing a Seldon Core Operator after you have installed a previous Seldon Core Operator on the same cluster you will need to set `crd.create=false`.

For kustomize you will need to uncomment the patch_object_selector [here](https://github.com/SeldonIO/seldon-core/blob/master/operator/config/webhook/kustomization.yaml)

#### Kustomize

An example install is provided in the Makefile in the Operator folder:

```
make deploy-controllerid
```

See the [multiple server example notebook](../examples/multiple_operators.html).

8 changes: 8 additions & 0 deletions helm-charts/seldon-core-operator/templates/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,27 @@ webhooks:
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:
Expand Down Expand Up @@ -79,23 +83,27 @@ webhooks:
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:
Expand Down
171 changes: 19 additions & 152 deletions notebooks/seldon_core_setup.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,57 +29,24 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"namespace/seldon created\r\n"
]
}
],
"outputs": [],
"source": [
"!kubectl create namespace seldon"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Context \"gke_dev-george_us-central1-a_standard-cluster-1\" modified.\r\n"
]
}
],
"outputs": [],
"source": [
"!kubectl config set-context $(kubectl config current-context) --namespace=seldon"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"clusterrolebinding.rbac.authorization.k8s.io/kube-system-cluster-admin created\r\n"
]
}
],
"source": [
"!kubectl create clusterrolebinding kube-system-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -95,87 +62,27 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\"stable\" has been added to your repositories\r\n"
]
}
],
"outputs": [],
"source": [
"!helm repo add stable https://kubernetes-charts.storage.googleapis.com/"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hang tight while we grab the latest from your chart repositories...\n",
"...Successfully got an update from the \"jetstack\" chart repository\n",
"...Successfully got an update from the \"stable\" chart repository\n",
"Update Complete. ⎈ Happy Helming!⎈ \n"
]
}
],
"outputs": [],
"source": [
"!helm repo update"
]
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"manifest_sorter.go:175: info: skipping unknown hook: \"crd-install\"\n",
"NAME: ambassador\n",
"LAST DEPLOYED: Fri Dec 6 11:31:58 2019\n",
"NAMESPACE: seldon\n",
"STATUS: deployed\n",
"REVISION: 1\n",
"NOTES:\n",
"Congratulations! You've successfully installed Ambassador.\n",
"\n",
"For help, visit our Slack at https://d6e.co/slack or view the documentation online at https://www.getambassador.io.\n",
"\n",
"To get the IP address of Ambassador, run the following commands:\n",
"NOTE: It may take a few minutes for the LoadBalancer IP to be available.\n",
" You can watch the status of by running 'kubectl get svc -w --namespace seldon ambassador'\n",
"\n",
" On GKE/Azure:\n",
" export SERVICE_IP=$(kubectl get svc --namespace seldon ambassador -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n",
"\n",
" On AWS:\n",
" export SERVICE_IP=$(kubectl get svc --namespace seldon ambassador -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')\n",
"\n",
" echo http://$SERVICE_IP:\n"
]
}
],
"outputs": [],
"source": [
"!helm install ambassador stable/ambassador --set crds.keep=false"
]
Expand All @@ -189,20 +96,9 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Waiting for deployment \"ambassador\" rollout to finish: 0 of 3 updated replicas are available...\n",
"Waiting for deployment \"ambassador\" rollout to finish: 1 of 3 updated replicas are available...\n",
"Waiting for deployment \"ambassador\" rollout to finish: 2 of 3 updated replicas are available...\n",
"deployment \"ambassador\" successfully rolled out\n"
]
}
],
"outputs": [],
"source": [
"!kubectl rollout status deployment.apps/ambassador"
]
Expand Down Expand Up @@ -240,17 +136,9 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"namespace/seldon-system created\r\n"
]
}
],
"outputs": [],
"source": [
"!kubectl create namespace seldon-system"
]
Expand All @@ -264,22 +152,9 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"NAME: seldon-core\r\n",
"LAST DEPLOYED: Fri Dec 6 11:33:00 2019\r\n",
"NAMESPACE: seldon-system\r\n",
"STATUS: deployed\r\n",
"REVISION: 1\r\n",
"TEST SUITE: None\r\n"
]
}
],
"outputs": [],
"source": [
"!helm install seldon-core seldon-core-operator --repo https://storage.googleapis.com/seldon-charts --set ambassador.enabled=true --set usageMetrics.enabled=true --namespace seldon-system"
]
Expand Down Expand Up @@ -309,17 +184,9 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"deployment \"seldon-controller-manager\" successfully rolled out\r\n"
]
}
],
"outputs": [],
"source": [
"!kubectl rollout status deploy/seldon-controller-manager -n seldon-system"
]
Expand Down Expand Up @@ -348,7 +215,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
1 change: 1 addition & 0 deletions operator/config/webhook/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ resources:
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
Loading