Skip to content

Commit

Permalink
respect envSecretRefName coming from helm values (#4089)
Browse files Browse the repository at this point in the history
* cleanup of Ansible playbooks

* update metrics example

* respect envSecretRefName coming from helm values

* add unit test
  • Loading branch information
RafalSkolasinski authored May 11, 2022
1 parent 784859c commit 83cfb98
Show file tree
Hide file tree
Showing 13 changed files with 246 additions and 156 deletions.
10 changes: 7 additions & 3 deletions ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ Once installed you can use the following Playbooks.

## Create Kind Cluster

```
```bash
ansible-playbook playbooks/kind_cluster.yaml
```

To deploy Kind cluster with 4 workers add `-e kind_use_many_workers=yes` flag.


## Install Seldon Core with Istio

Expand All @@ -20,11 +22,13 @@ ansible-playbook playbooks/seldon_core.yaml

## Install Kafka

```
```bash
ansible-playbook playbooks/kafka.yaml
```


__N.B:__ If you are using MacOS and have an error saying `in progress in another thread when fork() was called` when installing something with ansible. You might want to set `export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES`
## Side notes

__N.B:__ If you are using MacOS and have an error saying `in progress in another thread when fork() was called` when installing something with ansible. You might want to set `export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES`

See issue [here](https://github.com/ansible/ansible/issues/32499#issuecomment-341578864)
17 changes: 11 additions & 6 deletions ansible/playbooks/kind_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
- seldonio.k8s.kind
- seldonio.k8s.metallb
vars:
# Name of kind cluster to be created; default: ansible
# If kind cluster of this name already exist it will not be removed and only
# the current kubectl context will be updated (kind export kubeconfig ... equivalent)
kind_use_many_workers: no

kind_cluster_name: ansible

kind_version: v0.11.1
kind_image_version: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
# For compatible version of image for each kind version please see https://github.com/kubernetes-sigs/kind/releases
kind_version: v0.12.0
kind_image_version: kindest/node:v1.21.10@sha256:84709f09756ba4f863769bdcabe5edafc2ada72d3c8c44d6515fc581b66b029c

# Default namespace to be created and set for current context (if not null).
kind_kubectl_default_namespace: seldon

pre_tasks:
- name: "Set custom Kind config to use many workers"
set_fact:
kind_config_file: files/kind_config.yaml
when: kind_use_many_workers | bool
20 changes: 0 additions & 20 deletions ansible/playbooks/kind_many_workers.yaml

This file was deleted.

7 changes: 3 additions & 4 deletions ansible/playbooks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
---
- name: Install Seldon Core & Prerequisites
hosts: localhost
gather_facts: no
roles:
- role: seldonio.k8s.istio
when: install_istio | bool

- role: seldonio.k8s.minio
when: install_minio | bool

- role: seldonio.k8s.seldon_core_analytics
when: install_seldon_core_analytics | bool
- name: seldonio.k8s.prometheus
when: install_prometheus | bool

- role: seldonio.k8s.seldon_core
when: install_seldon_core | bool
Expand All @@ -21,8 +20,8 @@
install_istio: "{{ full_install }}"
install_ambassador: "{{ full_install }}"
install_minio: "{{ full_install }}"
install_prometheus: "{{ full_install }}"

install_seldon_core_analytics: "{{ full_install }}"
install_seldon_core: "{{ full_install }}"

# Overwrite this variable if you want to DO NOT want to include any variable from defaults
Expand Down
46 changes: 0 additions & 46 deletions ansible/playbooks/seldon_core.yaml

This file was deleted.

23 changes: 11 additions & 12 deletions ansible/playbooks/vars/default.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
########################### Generic Configuration #############################

seldon_system_namespace: seldon-system
seldon_logs_namespace: seldon-logs

seldon_namespaces: [ seldon ]
seldon_namespaces: [ seldon, dev, prod ]


######################## Seldon Core Configuration ############################
Expand All @@ -20,13 +18,13 @@ seldon_core_version: master
seldon_core_values:
istio:
enabled: true
gateway: "seldon-gateway.istio-system.svc.cluster.local"
gateway: "istio-system/seldon-gateway"


############################ Istio Configuration ##############################

# Version of Istio to be installed
istio_version: 1.10.4
istio_version: 1.13.1

# This flag controls creation of Seldon Gateway, default: true
istio_create_seldon_gateway: true
Expand All @@ -41,16 +39,17 @@ minio_service_type: LoadBalancer
# If set to "null" then secret will not be written
minio_rclone_secret_name: seldon-rclone-secret

# Name of rclone-compatible secret; default: null
# If set to "null" then secret will not be written
minio_kfserving_secret_name: seldon-kfserving-secret

# List of namespaces to which MinIO secret should be written
minio_secret_namespaces: "{{ seldon_namespaces }}"


#################### Seldon Core Analytics Configuration ######################
###################### Seldon Monitoring Configuration ########################
seldon_monitoring_namespace: seldon-monitoring
seldon_monitoring_prometheus_operator_chart_version: "6.9.5"

# Seldon Core Analytics version: helm chart version, default: null (latest)
seldon_core_analytics_version: v1.9.1
seldon_core_analytics_values: {}
seldon_monitoring_prometheus_operator_values:
fullnameOverride: seldon-monitoring
kube-state-metrics:
extraArgs:
metric-labels-allowlist: pods=[*]
17 changes: 9 additions & 8 deletions doc/source/analytics/analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ We recommend to configure Prometheus using [Prometheus Operator](https://github.
The [kube-prometheus](https://github.com/prometheus-operator/kube-prometheus) stack configuration can be easily installed using the [Bitnami Helm Charts](https://github.com/bitnami/charts/tree/master/bitnami/kube-prometheus/)

```bash
kubectl create namespace seldon-system
kubectl create namespace seldon-monitoring

helm upgrade --install prometheus kube-prometheus \
--version 6.8.3 \
helm upgrade --install seldon-monitoring kube-prometheus \
--version 6.9.5 \
--set fullnameOverride=seldon-monitoring \
--namespace seldon-system \
--namespace seldon-monitoring \
--repo https://charts.bitnami.com/bitnami

kubectl rollout status -n seldon-system statefulsets/prometheus-seldon-monitoring-prometheus
kubectl rollout status -n seldon-monitoring statefulsets/prometheus-seldon-monitoring-prometheus
```

The following pods should now be present in the `seldon-system` namespace:
The following pods should now be present in the `seldon-monitoring` namespace:
```bash
$ kubectl get pods -n seldon-system
$ kubectl get pods -n seldon-monitoring
NAME READY STATUS RESTARTS AGE
alertmanager-seldon-monitoring-alertmanager-0 2/2 Running 0 51s
prometheus-kube-state-metrics-d97b6b5ff-n5z7w 1/1 Running 0 52s
Expand All @@ -67,6 +67,7 @@ apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: seldon-podmonitor
namespace: seldon-monitoring
spec:
selector:
matchLabels:
Expand All @@ -89,7 +90,7 @@ Assuming that there exist `SeldonDeployment` models running in the cluster one c

Expose Prometheus to your localhost with
```bash
$ kubectl port-forward -n seldon-system svc/seldon-monitoring-prometheus 9090:9090
$ kubectl port-forward -n seldon-monitoring svc/seldon-monitoring-prometheus 9090:9090
```

You can now head to your browser http://localhost:9090 to access the Prometheus UI.
Expand Down
2 changes: 1 addition & 1 deletion examples/models/metrics/get-metrics.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
QUERY='query=mygauge{deployment_name=~"echo",namespace=~"seldon"}'
QUERY_URL=http://seldon-monitoring-prometheus.seldon-system.svc.cluster.local:9090/api/v1/query
QUERY_URL=http://seldon-monitoring-prometheus.seldon-monitoring.svc.cluster.local:9090/api/v1/query

kubectl run --quiet=true -it --rm curlmetrics-$(date +%s) --image=radial/busyboxplus:curl --restart=Never -- \
curl --data-urlencode ${QUERY} ${QUERY_URL}
Loading

0 comments on commit 83cfb98

Please sign in to comment.