From e90793786d362a1343d890dbbf9f590d8e74879e Mon Sep 17 00:00:00 2001 From: Klaus Meyer Date: Tue, 23 Apr 2024 00:26:49 +0200 Subject: [PATCH] use the new base chart for whatchy --- charts/whatchy/.helmignore | 23 ---- charts/whatchy/Chart.lock | 6 + charts/whatchy/Chart.yaml | 26 +--- charts/whatchy/README.md | 18 --- charts/whatchy/RELEASENOTES.md | 6 - charts/whatchy/templates/_helpers.tpl | 62 --------- charts/whatchy/templates/cronjob.yaml | 48 ------- charts/whatchy/templates/db-prepare-job.yaml | 23 ---- charts/whatchy/templates/deployment.yaml | 68 ---------- charts/whatchy/templates/hpa.yaml | 28 ---- charts/whatchy/templates/ingress.yaml | 61 --------- charts/whatchy/templates/service.yaml | 15 --- charts/whatchy/templates/serviceaccount.yaml | 12 -- charts/whatchy/values.yaml | 129 ++++++------------- 14 files changed, 54 insertions(+), 471 deletions(-) delete mode 100644 charts/whatchy/.helmignore create mode 100644 charts/whatchy/Chart.lock delete mode 100644 charts/whatchy/README.md delete mode 100644 charts/whatchy/RELEASENOTES.md delete mode 100644 charts/whatchy/templates/_helpers.tpl delete mode 100644 charts/whatchy/templates/cronjob.yaml delete mode 100644 charts/whatchy/templates/db-prepare-job.yaml delete mode 100644 charts/whatchy/templates/deployment.yaml delete mode 100644 charts/whatchy/templates/hpa.yaml delete mode 100644 charts/whatchy/templates/ingress.yaml delete mode 100644 charts/whatchy/templates/service.yaml delete mode 100644 charts/whatchy/templates/serviceaccount.yaml diff --git a/charts/whatchy/.helmignore b/charts/whatchy/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/charts/whatchy/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# 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/whatchy/Chart.lock b/charts/whatchy/Chart.lock new file mode 100644 index 0000000..8c3eebd --- /dev/null +++ b/charts/whatchy/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: rails-application + repository: https://klausmeyer.github.io/helm-charts + version: 0.1.0-alpha2 +digest: sha256:5745546d337f716196d354eb58e4936283586c0f3ba0daa5bfc218bb4c90599a +generated: "2024-04-25T20:04:38.962981027+02:00" diff --git a/charts/whatchy/Chart.yaml b/charts/whatchy/Chart.yaml index 8f69113..c8ea651 100644 --- a/charts/whatchy/Chart.yaml +++ b/charts/whatchy/Chart.yaml @@ -1,24 +1,10 @@ apiVersion: v2 name: whatchy -description: Rails app to track tv shows / series - -# 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. +description: A Helm chart for Kubernetes type: application +version: "0.2.0-alpha1" -# 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.1 - -# 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.0.0-dev" +dependencies: + - name: rails-application + version: "0.1.0-alpha2" + repository: https://klausmeyer.github.io/helm-charts diff --git a/charts/whatchy/README.md b/charts/whatchy/README.md deleted file mode 100644 index 7db8bbe..0000000 --- a/charts/whatchy/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Whatchy - -A Helm chart for https://github.com/klausmeyer/whatchy - -## Changelog - -see [RELEASENOTES.md](RELEASENOTES.md) - -## Usage - -```shell -helm repo add klausmeyer https://klausmeyer.github.io/helm-charts/ -helm install my-release klausmeyer/whatchy -``` - -## Warning - -The application isn't doing any versioning yet so this chart uses the `latest` Docker tag by default. diff --git a/charts/whatchy/RELEASENOTES.md b/charts/whatchy/RELEASENOTES.md deleted file mode 100644 index 0f4bf56..0000000 --- a/charts/whatchy/RELEASENOTES.md +++ /dev/null @@ -1,6 +0,0 @@ -# Changelog - -| Chart version | App version | Change description | -| :------------ | :------------ | :-------------------------- | -| `0.1.0` | `1.0.0-dev` | Initial chart version | -| `0.1.1` | `1.0.0-dev` | Changed health-check routes | diff --git a/charts/whatchy/templates/_helpers.tpl b/charts/whatchy/templates/_helpers.tpl deleted file mode 100644 index 1c53db8..0000000 --- a/charts/whatchy/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "whatchy.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 "whatchy.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 "whatchy.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "whatchy.labels" -}} -helm.sh/chart: {{ include "whatchy.chart" . }} -{{ include "whatchy.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "whatchy.selectorLabels" -}} -app.kubernetes.io/name: {{ include "whatchy.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "whatchy.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "whatchy.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/charts/whatchy/templates/cronjob.yaml b/charts/whatchy/templates/cronjob.yaml deleted file mode 100644 index 36c457f..0000000 --- a/charts/whatchy/templates/cronjob.yaml +++ /dev/null @@ -1,48 +0,0 @@ -apiVersion: batch/v1 -kind: CronJob -metadata: - name: {{ include "whatchy.fullname" . }}-crons-daily - labels: - {{- include "whatchy.labels" . | nindent 4 }} -spec: - schedule: {{ .Values.cronjob.schedule | quote }} - jobTemplate: - spec: - template: - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 12 }} - {{- end }} - serviceAccountName: {{ include "whatchy.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 12 }} - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- with .Values.environment }} - env: - {{- range $key, $value := . }} - - name: "{{ $key }}" - value: "{{ $value }}" - {{- end }} - {{- end }} - command: - - rake - - crons:daily - resources: - {{- toYaml .Values.resources | nindent 16 }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} - restartPolicy: OnFailure diff --git a/charts/whatchy/templates/db-prepare-job.yaml b/charts/whatchy/templates/db-prepare-job.yaml deleted file mode 100644 index cb6c911..0000000 --- a/charts/whatchy/templates/db-prepare-job.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ include "whatchy.fullname" . }}-db-prepare - annotations: - "helm.sh/hook": pre-install,pre-upgrade - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded -spec: - template: - spec: - containers: - - name: db-setup - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- with .Values.environment }} - env: - {{- range $key, $value := . }} - - name: "{{ $key }}" - value: "{{ $value }}" - {{- end }} - {{- end }} - command: ["rails", "db:prepare"] - restartPolicy: Never diff --git a/charts/whatchy/templates/deployment.yaml b/charts/whatchy/templates/deployment.yaml deleted file mode 100644 index e31750d..0000000 --- a/charts/whatchy/templates/deployment.yaml +++ /dev/null @@ -1,68 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "whatchy.fullname" . }} - labels: - {{- include "whatchy.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "whatchy.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "whatchy.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "whatchy.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 }} - {{- with .Values.environment }} - env: - {{- range $key, $value := . }} - - name: "{{ $key }}" - value: "{{ $value }}" - {{- end }} - {{- end }} - ports: - - name: http - containerPort: 8080 - protocol: TCP - livenessProbe: - httpGet: - path: /health - port: http - readinessProbe: - httpGet: - path: /health/all - port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- 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/whatchy/templates/hpa.yaml b/charts/whatchy/templates/hpa.yaml deleted file mode 100644 index 31c69a2..0000000 --- a/charts/whatchy/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "whatchy.fullname" . }} - labels: - {{- include "whatchy.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "whatchy.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/charts/whatchy/templates/ingress.yaml b/charts/whatchy/templates/ingress.yaml deleted file mode 100644 index 20cf761..0000000 --- a/charts/whatchy/templates/ingress.yaml +++ /dev/null @@ -1,61 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "whatchy.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 "whatchy.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/whatchy/templates/service.yaml b/charts/whatchy/templates/service.yaml deleted file mode 100644 index 623f00a..0000000 --- a/charts/whatchy/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "whatchy.fullname" . }} - labels: - {{- include "whatchy.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "whatchy.selectorLabels" . | nindent 4 }} diff --git a/charts/whatchy/templates/serviceaccount.yaml b/charts/whatchy/templates/serviceaccount.yaml deleted file mode 100644 index fb0b6b7..0000000 --- a/charts/whatchy/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "whatchy.serviceAccountName" . }} - labels: - {{- include "whatchy.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/charts/whatchy/values.yaml b/charts/whatchy/values.yaml index 27bd14b..aad3a4f 100644 --- a/charts/whatchy/values.yaml +++ b/charts/whatchy/values.yaml @@ -1,87 +1,42 @@ -# Default values for whatchy. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: klausmeyer/whatchy - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "latest" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: 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: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - -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 - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} - -environment: {} - -cronjob: - schedule: "30 6 * * *" +rails-application: + name: whatchy + version: "0.1.2" + + image: + repository: klausmeyer/whatchy + + environment: + # sealedSecrets: false + plain: {} + # AIRBRAKE_HOST: "<...>" + # AIRBRAKE_PROJECT_ID: "<...>" + # BANNER_CACHE_HOST: "<...>" + # DOMAIN: "<...>" + # S3_BUCKET: "<...>" + # S3_ENDPOINT: "<...>" + # S3_REGION: "<...>" + # SMTP_ENABLED: "<...>" + # SMTP_PORT: "<...>" + # SMTP_SERVER: "<...>" + secret: {} + # AIRBRAKE_API_KEY: <...> + # DATABASE_URL: "<...>" + # S3_ACCESS_KEY_ID: "<...>" + # S3_SECRET_ACCESS_KEY: "<...>" + # SECRET_KEY_BASE: "<...>" + # SMTP_PASSWORD: "<...>" + # SMTP_USERNAME: "<...>" + # THETVDB_APIKEY: "<...>" + + deployments: + web: + enabled: true + + cronjobs: + daily: + schedule: "30 6 * * *" + args: ["rake", "crons:daily"] + +redis: + haMode: + enabled: false