From 7fbdc976807bcddd8aa08b60be7bdd4842dd5dee Mon Sep 17 00:00:00 2001 From: Rhea Danzey Date: Fri, 13 Sep 2024 13:28:57 -0500 Subject: [PATCH 1/9] gitlab-matrix-project-bot - Initial chart Signed-off-by: Rhea Danzey --- charts/gitlab-matrix-project-bot/.helmignore | 23 ++++ charts/gitlab-matrix-project-bot/Chart.yaml | 24 ++++ .../templates/NOTES.txt | 22 ++++ .../templates/_helpers.tpl | 62 ++++++++++ .../templates/deployment.yaml | 68 +++++++++++ .../templates/hpa.yaml | 32 ++++++ .../templates/ingress.yaml | 61 ++++++++++ .../templates/service.yaml | 15 +++ .../templates/serviceaccount.yaml | 13 +++ .../templates/tests/test-connection.yaml | 15 +++ charts/gitlab-matrix-project-bot/values.yaml | 107 ++++++++++++++++++ 11 files changed, 442 insertions(+) create mode 100644 charts/gitlab-matrix-project-bot/.helmignore create mode 100644 charts/gitlab-matrix-project-bot/Chart.yaml create mode 100644 charts/gitlab-matrix-project-bot/templates/NOTES.txt create mode 100644 charts/gitlab-matrix-project-bot/templates/_helpers.tpl create mode 100644 charts/gitlab-matrix-project-bot/templates/deployment.yaml create mode 100644 charts/gitlab-matrix-project-bot/templates/hpa.yaml create mode 100644 charts/gitlab-matrix-project-bot/templates/ingress.yaml create mode 100644 charts/gitlab-matrix-project-bot/templates/service.yaml create mode 100644 charts/gitlab-matrix-project-bot/templates/serviceaccount.yaml create mode 100644 charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml create mode 100644 charts/gitlab-matrix-project-bot/values.yaml diff --git a/charts/gitlab-matrix-project-bot/.helmignore b/charts/gitlab-matrix-project-bot/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/gitlab-matrix-project-bot/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/gitlab-matrix-project-bot/Chart.yaml b/charts/gitlab-matrix-project-bot/Chart.yaml new file mode 100644 index 0000000..1b6a60b --- /dev/null +++ b/charts/gitlab-matrix-project-bot/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: gitlab-matrix-project-bot +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +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.1.0 + +# 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 +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/charts/gitlab-matrix-project-bot/templates/NOTES.txt b/charts/gitlab-matrix-project-bot/templates/NOTES.txt new file mode 100644 index 0000000..1c962c4 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "gitlab-matrix-project-bot.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "gitlab-matrix-project-bot.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gitlab-matrix-project-bot.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "gitlab-matrix-project-bot.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/charts/gitlab-matrix-project-bot/templates/_helpers.tpl b/charts/gitlab-matrix-project-bot/templates/_helpers.tpl new file mode 100644 index 0000000..33c7d65 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "gitlab-matrix-project-bot.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "gitlab-matrix-project-bot.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "gitlab-matrix-project-bot.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "gitlab-matrix-project-bot.labels" -}} +helm.sh/chart: {{ include "gitlab-matrix-project-bot.chart" . }} +{{ include "gitlab-matrix-project-bot.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "gitlab-matrix-project-bot.selectorLabels" -}} +app.kubernetes.io/name: {{ include "gitlab-matrix-project-bot.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "gitlab-matrix-project-bot.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "gitlab-matrix-project-bot.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/gitlab-matrix-project-bot/templates/deployment.yaml b/charts/gitlab-matrix-project-bot/templates/deployment.yaml new file mode 100644 index 0000000..c11af98 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "gitlab-matrix-project-bot.fullname" . }} + labels: + {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "gitlab-matrix-project-bot.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "gitlab-matrix-project-bot.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "gitlab-matrix-project-bot.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/gitlab-matrix-project-bot/templates/hpa.yaml b/charts/gitlab-matrix-project-bot/templates/hpa.yaml new file mode 100644 index 0000000..89037a9 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "gitlab-matrix-project-bot.fullname" . }} + labels: + {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "gitlab-matrix-project-bot.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/gitlab-matrix-project-bot/templates/ingress.yaml b/charts/gitlab-matrix-project-bot/templates/ingress.yaml new file mode 100644 index 0000000..4fb549f --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "gitlab-matrix-project-bot.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/gitlab-matrix-project-bot/templates/service.yaml b/charts/gitlab-matrix-project-bot/templates/service.yaml new file mode 100644 index 0000000..3d6170c --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "gitlab-matrix-project-bot.fullname" . }} + labels: + {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "gitlab-matrix-project-bot.selectorLabels" . | nindent 4 }} diff --git a/charts/gitlab-matrix-project-bot/templates/serviceaccount.yaml b/charts/gitlab-matrix-project-bot/templates/serviceaccount.yaml new file mode 100644 index 0000000..8a8e7d3 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "gitlab-matrix-project-bot.serviceAccountName" . }} + labels: + {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml b/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml new file mode 100644 index 0000000..fabfe17 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "gitlab-matrix-project-bot.fullname" . }}-test-connection" + labels: + {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "gitlab-matrix-project-bot.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/gitlab-matrix-project-bot/values.yaml b/charts/gitlab-matrix-project-bot/values.yaml new file mode 100644 index 0000000..339dbc3 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/values.yaml @@ -0,0 +1,107 @@ +# Default values for gitlab-matrix-project-bot. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: ghcr.io/erikjohnston/github-matrix-project-bot + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "master" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 8080 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +livenessProbe: + httpGet: + path: / + port: http +readinessProbe: + httpGet: + path: / + port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} From feaa29e60bc71f926b555dc441c01587c3336789 Mon Sep 17 00:00:00 2001 From: Rhea Danzey Date: Fri, 13 Sep 2024 13:30:30 -0500 Subject: [PATCH 2/9] Basic documentation Signed-off-by: Rhea Danzey --- charts/gitlab-matrix-project-bot/Chart.yaml | 2 +- charts/gitlab-matrix-project-bot/README.md | 51 +++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 charts/gitlab-matrix-project-bot/README.md diff --git a/charts/gitlab-matrix-project-bot/Chart.yaml b/charts/gitlab-matrix-project-bot/Chart.yaml index 1b6a60b..c561ea9 100644 --- a/charts/gitlab-matrix-project-bot/Chart.yaml +++ b/charts/gitlab-matrix-project-bot/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: gitlab-matrix-project-bot -description: A Helm chart for Kubernetes +description: Deploys gitlab-matrix-project-bot # A chart can be either an 'application' or a 'library' chart. # diff --git a/charts/gitlab-matrix-project-bot/README.md b/charts/gitlab-matrix-project-bot/README.md new file mode 100644 index 0000000..e33044e --- /dev/null +++ b/charts/gitlab-matrix-project-bot/README.md @@ -0,0 +1,51 @@ +# gitlab-matrix-project-bot + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square) + +Deploys gitlab-matrix-project-bot + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| autoscaling.enabled | bool | `false` | | +| autoscaling.maxReplicas | int | `100` | | +| autoscaling.minReplicas | int | `1` | | +| autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"ghcr.io/erikjohnston/github-matrix-project-bot"` | | +| image.tag | string | `"master"` | | +| imagePullSecrets | list | `[]` | | +| ingress.annotations | object | `{}` | | +| ingress.className | string | `""` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts[0].host | string | `"chart-example.local"` | | +| ingress.hosts[0].paths[0].path | string | `"/"` | | +| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | | +| ingress.tls | list | `[]` | | +| livenessProbe.httpGet.path | string | `"/"` | | +| livenessProbe.httpGet.port | string | `"http"` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| podSecurityContext | object | `{}` | | +| readinessProbe.httpGet.path | string | `"/"` | | +| readinessProbe.httpGet.port | string | `"http"` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| securityContext | object | `{}` | | +| service.port | int | `8080` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.automount | bool | `true` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | +| tolerations | list | `[]` | | +| volumeMounts | list | `[]` | | +| volumes | list | `[]` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) From 931194c64ae6e039ddb178babe1daf9b5dcd5e18 Mon Sep 17 00:00:00 2001 From: Rhea Danzey Date: Fri, 13 Sep 2024 13:35:06 -0500 Subject: [PATCH 3/9] Add some values for config Signed-off-by: Rhea Danzey --- charts/gitlab-matrix-project-bot/values.yaml | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/charts/gitlab-matrix-project-bot/values.yaml b/charts/gitlab-matrix-project-bot/values.yaml index 339dbc3..a2159d5 100644 --- a/charts/gitlab-matrix-project-bot/values.yaml +++ b/charts/gitlab-matrix-project-bot/values.yaml @@ -105,3 +105,29 @@ nodeSelector: {} tolerations: [] affinity: {} + +# Configuration for the gitlab-matrix-project-bot itself +config: + # Set rust log level + logLevel: "info" + + # GitHub authentication + github: + # set useExistingSecret to `true` and set existingSecret name if secret already exists + useExistingSecret: false + existingSecret: null + + # GitHub username + username: "changeme" + # GitHub token + token: "imnotatoken" + + matrix: + # set useExistingSecret to `true` and set existingSecret name if secret already exists + useExistingSecret: false + existingSecret: null + + # URL of homeserver + url: "https://synapse.foo.bar" + # Auth token for user on homeserver + token: "imnotatoken" From 538196950d26defb590bc39ce8a4039ac7a2aa4e Mon Sep 17 00:00:00 2001 From: Rhea Danzey Date: Fri, 13 Sep 2024 13:50:42 -0500 Subject: [PATCH 4/9] Implement configuration secrets for matrix / gitlab auth Signed-off-by: Rhea Danzey --- .../templates/deployment.yaml | 19 +++++++++++++++++-- .../templates/secret-github.yaml | 12 ++++++++++++ .../templates/secret-matrix.yaml | 12 ++++++++++++ charts/gitlab-matrix-project-bot/values.yaml | 4 ++-- 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 charts/gitlab-matrix-project-bot/templates/secret-github.yaml create mode 100644 charts/gitlab-matrix-project-bot/templates/secret-matrix.yaml diff --git a/charts/gitlab-matrix-project-bot/templates/deployment.yaml b/charts/gitlab-matrix-project-bot/templates/deployment.yaml index c11af98..9388935 100644 --- a/charts/gitlab-matrix-project-bot/templates/deployment.yaml +++ b/charts/gitlab-matrix-project-bot/templates/deployment.yaml @@ -1,3 +1,6 @@ +{{- $githubSecret := ternary .Values.config.github.existingSecret ( printf "%s-%s" (include "gitlab-matrix-project-bot.fullname" .) "github" ) .Values.config.github.useExistingSecret -}} +{{- $matrixSecret := ternary .Values.config.matrix.existingSecret ( printf "%s-%s" (include "gitlab-matrix-project-bot.fullname" .) "matrix" ) .Values.config.matrix.useExistingSecret -}} + apiVersion: apps/v1 kind: Deployment metadata: @@ -32,6 +35,11 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} + envFrom: + - secretRef: + name: {{ $githubSecret }} + - secretRef: + name: {{ $matrixSecret }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" @@ -46,12 +54,19 @@ spec: {{- toYaml .Values.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.volumeMounts }} + volumeMounts: + {{- with .Values.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} - {{- with .Values.volumes }} volumes: + - name: github + secret: + secretName: {{ $githubSecret }} + - name: matrix + secret: + secretName: {{ $matrixSecret }} + {{- with .Values.extraVolumes }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nodeSelector }} diff --git a/charts/gitlab-matrix-project-bot/templates/secret-github.yaml b/charts/gitlab-matrix-project-bot/templates/secret-github.yaml new file mode 100644 index 0000000..356f101 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/secret-github.yaml @@ -0,0 +1,12 @@ +{{- if not .Values.config.github.useExistingSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: "{{ include "gitlab-matrix-project-bot.fullname" . }}-github" + labels: + {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} +type: Opaque +data: + GH_USER: "{{ .Values.config.github.token | b64enc }}" + GH_TOKEN: "{{ .Values.config.github.token | b64enc }}" +{{- end }} \ No newline at end of file diff --git a/charts/gitlab-matrix-project-bot/templates/secret-matrix.yaml b/charts/gitlab-matrix-project-bot/templates/secret-matrix.yaml new file mode 100644 index 0000000..35d75f9 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/secret-matrix.yaml @@ -0,0 +1,12 @@ +{{- if not .Values.config.matrix.useExistingSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: "{{ include "gitlab-matrix-project-bot.fullname" . }}-matrix" + labels: + {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} +type: Opaque +data: + MX_URL: "{{ .Values.config.matrix.url | b64enc }}" + MX_TOKEN: "{{ .Values.config.matrix.token | b64enc }}" +{{- end }} \ No newline at end of file diff --git a/charts/gitlab-matrix-project-bot/values.yaml b/charts/gitlab-matrix-project-bot/values.yaml index a2159d5..528f731 100644 --- a/charts/gitlab-matrix-project-bot/values.yaml +++ b/charts/gitlab-matrix-project-bot/values.yaml @@ -88,14 +88,14 @@ autoscaling: # targetMemoryUtilizationPercentage: 80 # Additional volumes on the output Deployment definition. -volumes: [] +extraVolumes: [] # - name: foo # secret: # secretName: mysecret # optional: false # Additional volumeMounts on the output Deployment definition. -volumeMounts: [] +extraVolumeMounts: [] # - name: foo # mountPath: "/etc/foo" # readOnly: true From f4f796082280a0ab1917d19669f07c2e001f2fd5 Mon Sep 17 00:00:00 2001 From: Rhea Danzey Date: Fri, 13 Sep 2024 13:52:08 -0500 Subject: [PATCH 5/9] s/gitlab/github/g Signed-off-by: Rhea Danzey --- charts/gitlab-matrix-project-bot/Chart.yaml | 4 ++-- charts/gitlab-matrix-project-bot/README.md | 4 ++-- .../templates/NOTES.txt | 8 ++++---- .../templates/_helpers.tpl | 20 +++++++++---------- .../templates/deployment.yaml | 14 ++++++------- .../templates/hpa.yaml | 6 +++--- .../templates/ingress.yaml | 4 ++-- .../templates/secret-github.yaml | 4 ++-- .../templates/secret-matrix.yaml | 4 ++-- .../templates/service.yaml | 6 +++--- .../templates/serviceaccount.yaml | 4 ++-- .../templates/tests/test-connection.yaml | 6 +++--- charts/gitlab-matrix-project-bot/values.yaml | 4 ++-- 13 files changed, 44 insertions(+), 44 deletions(-) diff --git a/charts/gitlab-matrix-project-bot/Chart.yaml b/charts/gitlab-matrix-project-bot/Chart.yaml index c561ea9..151bfa5 100644 --- a/charts/gitlab-matrix-project-bot/Chart.yaml +++ b/charts/gitlab-matrix-project-bot/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: gitlab-matrix-project-bot -description: Deploys gitlab-matrix-project-bot +name: github-matrix-project-bot +description: Deploys github-matrix-project-bot # A chart can be either an 'application' or a 'library' chart. # diff --git a/charts/gitlab-matrix-project-bot/README.md b/charts/gitlab-matrix-project-bot/README.md index e33044e..237ba7f 100644 --- a/charts/gitlab-matrix-project-bot/README.md +++ b/charts/gitlab-matrix-project-bot/README.md @@ -1,8 +1,8 @@ -# gitlab-matrix-project-bot +# github-matrix-project-bot ![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square) -Deploys gitlab-matrix-project-bot +Deploys github-matrix-project-bot ## Values diff --git a/charts/gitlab-matrix-project-bot/templates/NOTES.txt b/charts/gitlab-matrix-project-bot/templates/NOTES.txt index 1c962c4..0c7db1a 100644 --- a/charts/gitlab-matrix-project-bot/templates/NOTES.txt +++ b/charts/gitlab-matrix-project-bot/templates/NOTES.txt @@ -6,16 +6,16 @@ {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "gitlab-matrix-project-bot.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "github-matrix-project-bot.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "gitlab-matrix-project-bot.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gitlab-matrix-project-bot.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "github-matrix-project-bot.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "github-matrix-project-bot.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "gitlab-matrix-project-bot.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "github-matrix-project-bot.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT diff --git a/charts/gitlab-matrix-project-bot/templates/_helpers.tpl b/charts/gitlab-matrix-project-bot/templates/_helpers.tpl index 33c7d65..1fb18b5 100644 --- a/charts/gitlab-matrix-project-bot/templates/_helpers.tpl +++ b/charts/gitlab-matrix-project-bot/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "gitlab-matrix-project-bot.name" -}} +{{- define "github-matrix-project-bot.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). If release name contains chart name it will be used as a full name. */}} -{{- define "gitlab-matrix-project-bot.fullname" -}} +{{- define "github-matrix-project-bot.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "gitlab-matrix-project-bot.chart" -}} +{{- define "github-matrix-project-bot.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "gitlab-matrix-project-bot.labels" -}} -helm.sh/chart: {{ include "gitlab-matrix-project-bot.chart" . }} -{{ include "gitlab-matrix-project-bot.selectorLabels" . }} +{{- define "github-matrix-project-bot.labels" -}} +helm.sh/chart: {{ include "github-matrix-project-bot.chart" . }} +{{ include "github-matrix-project-bot.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "gitlab-matrix-project-bot.selectorLabels" -}} -app.kubernetes.io/name: {{ include "gitlab-matrix-project-bot.name" . }} +{{- define "github-matrix-project-bot.selectorLabels" -}} +app.kubernetes.io/name: {{ include "github-matrix-project-bot.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "gitlab-matrix-project-bot.serviceAccountName" -}} +{{- define "github-matrix-project-bot.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "gitlab-matrix-project-bot.fullname" .) .Values.serviceAccount.name }} +{{- default (include "github-matrix-project-bot.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/charts/gitlab-matrix-project-bot/templates/deployment.yaml b/charts/gitlab-matrix-project-bot/templates/deployment.yaml index 9388935..ff839e7 100644 --- a/charts/gitlab-matrix-project-bot/templates/deployment.yaml +++ b/charts/gitlab-matrix-project-bot/templates/deployment.yaml @@ -1,19 +1,19 @@ -{{- $githubSecret := ternary .Values.config.github.existingSecret ( printf "%s-%s" (include "gitlab-matrix-project-bot.fullname" .) "github" ) .Values.config.github.useExistingSecret -}} -{{- $matrixSecret := ternary .Values.config.matrix.existingSecret ( printf "%s-%s" (include "gitlab-matrix-project-bot.fullname" .) "matrix" ) .Values.config.matrix.useExistingSecret -}} +{{- $githubSecret := ternary .Values.config.github.existingSecret ( printf "%s-%s" (include "github-matrix-project-bot.fullname" .) "github" ) .Values.config.github.useExistingSecret -}} +{{- $matrixSecret := ternary .Values.config.matrix.existingSecret ( printf "%s-%s" (include "github-matrix-project-bot.fullname" .) "matrix" ) .Values.config.matrix.useExistingSecret -}} apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "gitlab-matrix-project-bot.fullname" . }} + name: {{ include "github-matrix-project-bot.fullname" . }} labels: - {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- include "github-matrix-project-bot.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: - {{- include "gitlab-matrix-project-bot.selectorLabels" . | nindent 6 }} + {{- include "github-matrix-project-bot.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -21,7 +21,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "gitlab-matrix-project-bot.labels" . | nindent 8 }} + {{- include "github-matrix-project-bot.labels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} @@ -30,7 +30,7 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "gitlab-matrix-project-bot.serviceAccountName" . }} + serviceAccountName: {{ include "github-matrix-project-bot.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: diff --git a/charts/gitlab-matrix-project-bot/templates/hpa.yaml b/charts/gitlab-matrix-project-bot/templates/hpa.yaml index 89037a9..7d66814 100644 --- a/charts/gitlab-matrix-project-bot/templates/hpa.yaml +++ b/charts/gitlab-matrix-project-bot/templates/hpa.yaml @@ -2,14 +2,14 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "gitlab-matrix-project-bot.fullname" . }} + name: {{ include "github-matrix-project-bot.fullname" . }} labels: - {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- include "github-matrix-project-bot.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "gitlab-matrix-project-bot.fullname" . }} + name: {{ include "github-matrix-project-bot.fullname" . }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: diff --git a/charts/gitlab-matrix-project-bot/templates/ingress.yaml b/charts/gitlab-matrix-project-bot/templates/ingress.yaml index 4fb549f..d1b669d 100644 --- a/charts/gitlab-matrix-project-bot/templates/ingress.yaml +++ b/charts/gitlab-matrix-project-bot/templates/ingress.yaml @@ -1,5 +1,5 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := include "gitlab-matrix-project-bot.fullname" . -}} +{{- $fullName := include "github-matrix-project-bot.fullname" . -}} {{- $svcPort := .Values.service.port -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} @@ -17,7 +17,7 @@ kind: Ingress metadata: name: {{ $fullName }} labels: - {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- include "github-matrix-project-bot.labels" . | nindent 4 }} {{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/gitlab-matrix-project-bot/templates/secret-github.yaml b/charts/gitlab-matrix-project-bot/templates/secret-github.yaml index 356f101..72d22e4 100644 --- a/charts/gitlab-matrix-project-bot/templates/secret-github.yaml +++ b/charts/gitlab-matrix-project-bot/templates/secret-github.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: Secret metadata: - name: "{{ include "gitlab-matrix-project-bot.fullname" . }}-github" + name: "{{ include "github-matrix-project-bot.fullname" . }}-github" labels: - {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- include "github-matrix-project-bot.labels" . | nindent 4 }} type: Opaque data: GH_USER: "{{ .Values.config.github.token | b64enc }}" diff --git a/charts/gitlab-matrix-project-bot/templates/secret-matrix.yaml b/charts/gitlab-matrix-project-bot/templates/secret-matrix.yaml index 35d75f9..ff5d29f 100644 --- a/charts/gitlab-matrix-project-bot/templates/secret-matrix.yaml +++ b/charts/gitlab-matrix-project-bot/templates/secret-matrix.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: Secret metadata: - name: "{{ include "gitlab-matrix-project-bot.fullname" . }}-matrix" + name: "{{ include "github-matrix-project-bot.fullname" . }}-matrix" labels: - {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- include "github-matrix-project-bot.labels" . | nindent 4 }} type: Opaque data: MX_URL: "{{ .Values.config.matrix.url | b64enc }}" diff --git a/charts/gitlab-matrix-project-bot/templates/service.yaml b/charts/gitlab-matrix-project-bot/templates/service.yaml index 3d6170c..1795f57 100644 --- a/charts/gitlab-matrix-project-bot/templates/service.yaml +++ b/charts/gitlab-matrix-project-bot/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "gitlab-matrix-project-bot.fullname" . }} + name: {{ include "github-matrix-project-bot.fullname" . }} labels: - {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- include "github-matrix-project-bot.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -12,4 +12,4 @@ spec: protocol: TCP name: http selector: - {{- include "gitlab-matrix-project-bot.selectorLabels" . | nindent 4 }} + {{- include "github-matrix-project-bot.selectorLabels" . | nindent 4 }} diff --git a/charts/gitlab-matrix-project-bot/templates/serviceaccount.yaml b/charts/gitlab-matrix-project-bot/templates/serviceaccount.yaml index 8a8e7d3..2dc05cb 100644 --- a/charts/gitlab-matrix-project-bot/templates/serviceaccount.yaml +++ b/charts/gitlab-matrix-project-bot/templates/serviceaccount.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "gitlab-matrix-project-bot.serviceAccountName" . }} + name: {{ include "github-matrix-project-bot.serviceAccountName" . }} labels: - {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- include "github-matrix-project-bot.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml b/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml index fabfe17..150e9aa 100644 --- a/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml +++ b/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "gitlab-matrix-project-bot.fullname" . }}-test-connection" + name: "{{ include "github-matrix-project-bot.fullname" . }}-test-connection" labels: - {{- include "gitlab-matrix-project-bot.labels" . | nindent 4 }} + {{- include "github-matrix-project-bot.labels" . | nindent 4 }} annotations: "helm.sh/hook": test spec: @@ -11,5 +11,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "gitlab-matrix-project-bot.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "github-matrix-project-bot.fullname" . }}:{{ .Values.service.port }}'] restartPolicy: Never diff --git a/charts/gitlab-matrix-project-bot/values.yaml b/charts/gitlab-matrix-project-bot/values.yaml index 528f731..fd35664 100644 --- a/charts/gitlab-matrix-project-bot/values.yaml +++ b/charts/gitlab-matrix-project-bot/values.yaml @@ -1,4 +1,4 @@ -# Default values for gitlab-matrix-project-bot. +# Default values for github-matrix-project-bot. # This is a YAML-formatted file. # Declare variables to be passed into your templates. @@ -106,7 +106,7 @@ tolerations: [] affinity: {} -# Configuration for the gitlab-matrix-project-bot itself +# Configuration for the github-matrix-project-bot itself config: # Set rust log level logLevel: "info" From 0f85c67887edc062084354fd3a8fc3b48485abd9 Mon Sep 17 00:00:00 2001 From: Rhea Danzey Date: Fri, 13 Sep 2024 13:52:31 -0500 Subject: [PATCH 6/9] README updates Signed-off-by: Rhea Danzey --- charts/gitlab-matrix-project-bot/README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/charts/gitlab-matrix-project-bot/README.md b/charts/gitlab-matrix-project-bot/README.md index 237ba7f..84d37e0 100644 --- a/charts/gitlab-matrix-project-bot/README.md +++ b/charts/gitlab-matrix-project-bot/README.md @@ -13,6 +13,17 @@ Deploys github-matrix-project-bot | autoscaling.maxReplicas | int | `100` | | | autoscaling.minReplicas | int | `1` | | | autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| config.github.existingSecret | string | `nil` | | +| config.github.token | string | `"imnotatoken"` | | +| config.github.useExistingSecret | bool | `false` | | +| config.github.username | string | `"changeme"` | | +| config.logLevel | string | `"info"` | | +| config.matrix.existingSecret | string | `nil` | | +| config.matrix.token | string | `"imnotatoken"` | | +| config.matrix.url | string | `"https://synapse.foo.bar"` | | +| config.matrix.useExistingSecret | bool | `false` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | | fullnameOverride | string | `""` | | | image.pullPolicy | string | `"IfNotPresent"` | | | image.repository | string | `"ghcr.io/erikjohnston/github-matrix-project-bot"` | | @@ -44,8 +55,6 @@ Deploys github-matrix-project-bot | serviceAccount.create | bool | `true` | | | serviceAccount.name | string | `""` | | | tolerations | list | `[]` | | -| volumeMounts | list | `[]` | | -| volumes | list | `[]` | | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) From 19bf5b73c1ff13f0b69e45697e9c1e783fef32fb Mon Sep 17 00:00:00 2001 From: Rhea Danzey Date: Fri, 13 Sep 2024 13:53:39 -0500 Subject: [PATCH 7/9] Remove tests Signed-off-by: Rhea Danzey --- .../templates/tests/test-connection.yaml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml diff --git a/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml b/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml deleted file mode 100644 index 150e9aa..0000000 --- a/charts/gitlab-matrix-project-bot/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "github-matrix-project-bot.fullname" . }}-test-connection" - labels: - {{- include "github-matrix-project-bot.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "github-matrix-project-bot.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never From 02df2cde1878cfb3cc5390c59366b495a8a9249c Mon Sep 17 00:00:00 2001 From: Rhea Danzey Date: Fri, 13 Sep 2024 14:06:09 -0500 Subject: [PATCH 8/9] fix test? Signed-off-by: Rhea Danzey --- .../templates/tests/service_test.yaml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 charts/gitlab-matrix-project-bot/templates/tests/service_test.yaml diff --git a/charts/gitlab-matrix-project-bot/templates/tests/service_test.yaml b/charts/gitlab-matrix-project-bot/templates/tests/service_test.yaml new file mode 100644 index 0000000..b000143 --- /dev/null +++ b/charts/gitlab-matrix-project-bot/templates/tests/service_test.yaml @@ -0,0 +1,26 @@ +suite: test service +templates: + - templates/service.yaml +tests: + - it: should pass + release: + name: projbot + set: + service: + type: ClusterIP + asserts: + - contains: + path: spec.ports + content: + name: http + port: 8080 + protocol: TCP + targetPort: http + - equal: + path: spec.type + value: ClusterIP + - equal: + path: spec.selector + value: + app.kubernetes.io/name: gitlab-matrix-project-bot + app.kubernetes.io/instance: projbot From e60ba80db24242d62662aecd170c4611148f7659 Mon Sep 17 00:00:00 2001 From: Rhea Danzey Date: Fri, 13 Sep 2024 14:33:23 -0500 Subject: [PATCH 9/9] ignore tests Signed-off-by: Rhea Danzey --- charts/gitlab-matrix-project-bot/.helmignore | 1 + .../{templates => }/tests/service_test.yaml | 0 2 files changed, 1 insertion(+) rename charts/gitlab-matrix-project-bot/{templates => }/tests/service_test.yaml (100%) diff --git a/charts/gitlab-matrix-project-bot/.helmignore b/charts/gitlab-matrix-project-bot/.helmignore index 0e8a0eb..faeb926 100644 --- a/charts/gitlab-matrix-project-bot/.helmignore +++ b/charts/gitlab-matrix-project-bot/.helmignore @@ -21,3 +21,4 @@ .idea/ *.tmproj .vscode/ +tests/ diff --git a/charts/gitlab-matrix-project-bot/templates/tests/service_test.yaml b/charts/gitlab-matrix-project-bot/tests/service_test.yaml similarity index 100% rename from charts/gitlab-matrix-project-bot/templates/tests/service_test.yaml rename to charts/gitlab-matrix-project-bot/tests/service_test.yaml