From 50c48b37e54b98b0700e2e4216912f57646194ad Mon Sep 17 00:00:00 2001 From: Will <30413278+wcrum@users.noreply.github.com> Date: Tue, 21 Nov 2023 09:15:42 -0600 Subject: [PATCH] feat: initial commit for helm deployments --- Charts/Chart.yaml | 4 +++ Charts/templates/deployment.yaml | 23 +++++++++++++ Charts/templates/job.yaml | 55 ++++++++++++++++++++++++++++++++ Charts/templates/service.yaml | 13 ++++++++ Charts/values.yaml | 10 ++++++ 5 files changed, 105 insertions(+) create mode 100644 Charts/Chart.yaml create mode 100644 Charts/templates/deployment.yaml create mode 100644 Charts/templates/job.yaml create mode 100644 Charts/templates/service.yaml create mode 100644 Charts/values.yaml diff --git a/Charts/Chart.yaml b/Charts/Chart.yaml new file mode 100644 index 0000000000..9bd5a9400b --- /dev/null +++ b/Charts/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v2 +name: spectrocloud-librarium +description: A Helm chart for SpectroCloud Docs +version: 0.1.0 \ No newline at end of file diff --git a/Charts/templates/deployment.yaml b/Charts/templates/deployment.yaml new file mode 100644 index 0000000000..efacff3bb1 --- /dev/null +++ b/Charts/templates/deployment.yaml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + app: {{ .Chart.Name }} + group: {{ .Chart.Name }} +spec: + replicas: 1 + selector: + matchLabels: + app: {{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Chart.Name }} + group: {{ .Chart.Name }} + spec: + serviceAccountName: restart-docs + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} \ No newline at end of file diff --git a/Charts/templates/job.yaml b/Charts/templates/job.yaml new file mode 100644 index 0000000000..6e8a796fa9 --- /dev/null +++ b/Charts/templates/job.yaml @@ -0,0 +1,55 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: restart-docs + namespace: {{ .Chart.Name }} +spec: + concurrencyPolicy: Forbid + schedule: '0 0 * * *' + jobTemplate: + spec: + backoffLimit: 2 + activeDeadlineSeconds: 600 + template: + spec: + serviceAccountName: restart-docs + restartPolicy: Never + containers: + - name: kubectl + image: bitnami/kubectl + command: + - 'kubectl' + - 'rollout' + - 'restart' + - 'deployment/{{ .Chart.Name }}' +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: restart-docs + namespace: {{ .Chart.Name }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: restart-docs +subjects: + - kind: ServiceAccount + name: restart-docs + namespace: {{ .Chart.Name }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: restart-docs + namespace: {{ .Chart.Name }} +rules: + - apiGroups: ["apps", "extensions"] + resources: ["deployments"] + resourceNames: ["{{ .Chart.Name }}"] + verbs: ["get", "patch"] +--- +kind: ServiceAccount +apiVersion: v1 +metadata: + name: restart-docs + namespace: {{ .Chart.Name }} \ No newline at end of file diff --git a/Charts/templates/service.yaml b/Charts/templates/service.yaml new file mode 100644 index 0000000000..c41a046a92 --- /dev/null +++ b/Charts/templates/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + group: {{ .Chart.Name }} +spec: + type: ClusterIP + selector: + app: restart-docs + ports: + - port: {{ .Values.service.port }} + targetPort: 80 \ No newline at end of file diff --git a/Charts/values.yaml b/Charts/values.yaml new file mode 100644 index 0000000000..063bc75e68 --- /dev/null +++ b/Charts/values.yaml @@ -0,0 +1,10 @@ +replicaCount: 1 + +image: + repository: ghcr.io/spectrocloud/librarium + tag: "nightly" + pullPolicy: Always + +service: + type: ClusterIP + port: 8000 \ No newline at end of file