Skip to content

Commit

Permalink
[feat][helm] Simplify helm chart deployment (#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias authored and lloesche committed Apr 21, 2022
1 parent 81fc02d commit 4f557ec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
17 changes: 17 additions & 0 deletions kubernetes/chart/templates/arango-user-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- $name := "arango-user" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $name }}
labels:
{{- include "resoto.labels" . | nindent 4 }}
data:
# Check if the secret exists already (e.g. helm upgrade)
{{- $existingArangoUserSecret := lookup "v1" "Secret" .Release.Namespace $name }}

{{- if not $existingArangoUserSecret }}
password: {{ randAlphaNum 32 | b64enc | quote }}
{{- else }}
# password does exist on cluster, build an object with the existing values
password: {{ index $existingArangoUserSecret.data "password" | quote }}
{{- end }}
5 changes: 5 additions & 0 deletions kubernetes/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ resotoworker:
extraArgs: [ ]
# Use this section to pass extra environment variables
extraEnv: [ ]
# Use this section to define volumes of the worker
volumes: []
# Use this section to define volume mounts for the worker
volumeMounts: []


resotometrics:
# Use this section to override configuration values
Expand Down
23 changes: 0 additions & 23 deletions kubernetes/setup-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ spec:
caSecretName: None
EOF

# create secret for dashboard. not really needed for test, but nice to have.
kubectl --namespace resoto create secret generic arangodb-operator-dashboard --from-literal=username=a --from-literal=password=a

# wait for the db deployment is ready.
kubectl --namespace resoto wait --for=condition=ready arangodeployment/single-server --timeout=300s

Expand All @@ -43,33 +40,13 @@ ARANGO_DB_POD=$(kubectl --namespace resoto get pod -larango_deployment=single-se
# wait until the db is ready to accept clients.
timeout 1m $SHELL -c "until kubectl --namespace resoto exec $ARANGO_DB_POD -- /lifecycle/tools/arangodb_operator lifecycle probe --endpoint=/_api/version --auth; do sleep 1; done"

# create a db and user for us.
kubectl --namespace resoto exec -i $ARANGO_DB_POD -- arangosh --console.history false --server.password "" <<EOF
const users = require('@arangodb/users');
print("creating user");
users.save('ck', 'ck');
print("creating db");
db._createDatabase('resoto');
print("granting user db access");
users.grantDatabase('ck', 'resoto', 'rw');
print("all done:", users.all());
EOF

# put the db password in a secret.
kubectl --namespace resoto create secret generic arango-user --from-literal=password=ck

# install cloud keeper with the example collector

DIR="$(dirname "$(realpath "$0")")"
helm upgrade -i --namespace resoto resoto "$DIR/chart" --set image.tag=$IMAGE_TAG -f - <<EOF
resotocore:
graphdb:
server: http://single-server:8529
username: ck
database: resoto
passwordSecret:
name: arango-user
key: password
EOF
# wait for it to be ready
kubectl --namespace resoto rollout status deploy/resoto-resotocore --timeout=300s
Expand Down

0 comments on commit 4f557ec

Please sign in to comment.