Skip to content

Commit

Permalink
Merge pull request #12 from small-hack/create-admin-script-cm
Browse files Browse the repository at this point in the history
create admin curl script instead of fighting spacing
  • Loading branch information
jessebot authored Mar 26, 2024
2 parents c0060ae + 3dd3c62 commit 11a0829
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/netmaker/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.11.2
version: 0.11.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
2 changes: 1 addition & 1 deletion charts/netmaker/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# netmaker

![Version: 0.11.2](https://img.shields.io/badge/Version-0.11.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.23.0](https://img.shields.io/badge/AppVersion-v0.23.0-informational?style=flat-square)
![Version: 0.11.3](https://img.shields.io/badge/Version-0.11.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.23.0](https://img.shields.io/badge/AppVersion-v0.23.0-informational?style=flat-square)

A Helm chart to run HA Netmaker on Kubernetes

Expand Down
14 changes: 14 additions & 0 deletions charts/netmaker/templates/netmaker-admin-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if or .Values.netmaker.admin.user .Values.netmaker.admin.existingSecret }}
apiVersion: v1
kind: ConfigMap
metadata:
name: setup-initial-user-job-script
labels:
"helm.sh/hook": post-install
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "-5"
{{- include "netmaker.labels" . | nindent 4 }}
data:
create_admin_user.sh: |
curl --location "https://$SERVER_HTTP_HOST/api/users/adm/createsuperadmin" --header 'Content-Type: application/json' --data "{\"username\":\"$ADMIN_USER\",\"password\":\"$ADMIN_PASSWORD\"}"
{{- end }}
14 changes: 9 additions & 5 deletions charts/netmaker/templates/netmaker-admin-user-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ metadata:
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "-4"
spec:
template:
metadata:
name: setup-initial-user-pod
spec:
restartPolicy: {{ .Values.netmaker.admin.jobRestartPolicy }}
volumes:
- name: admin-script
configMap:
name: setup-initial-user-job-script
containers:
- name: setup-initial-user
image: curlimages/curl:latest
command:
- |-
curl --location "https://$SERVER_HTTP_HOST/api/users/adm/createsuperadmin" \
--header 'Content-Type: application/json' \
--data "{\"username\":\"$ADMIN_USER\",\"password\":\"$ADMIN_PASSWORD\"}"
volumeMounts:
- mountPath: /scripts
name: admin-script
command: ['/scripts/create_admin_user.sh']
env:
- name: SERVER_HTTP_HOST
valueFrom:
Expand Down

0 comments on commit 11a0829

Please sign in to comment.