diff --git a/packages/system/hetzner-robotlb/Chart.yaml b/packages/system/hetzner-robotlb/Chart.yaml new file mode 100644 index 00000000..c443842a --- /dev/null +++ b/packages/system/hetzner-robotlb/Chart.yaml @@ -0,0 +1,3 @@ +apiVersion: v2 +name: hetzner-robotlb +version: 0.1.3 # Placeholder, the actual version will be automatically set during the build process diff --git a/packages/system/hetzner-robotlb/Makefile b/packages/system/hetzner-robotlb/Makefile new file mode 100644 index 00000000..9cd69463 --- /dev/null +++ b/packages/system/hetzner-robotlb/Makefile @@ -0,0 +1,9 @@ +export NAME=hetzner-robotlb +export NAMESPACE=cozy-$(NAME) + +include ../../../scripts/package.mk + +update: + rm -rf charts + mkdir -p charts + helm pull oci://ghcr.io/intreecom/charts/robotlb --untar --untardir charts diff --git a/packages/system/hetzner-robotlb/charts/robotlb/.helmignore b/packages/system/hetzner-robotlb/charts/robotlb/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/packages/system/hetzner-robotlb/charts/robotlb/.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/packages/system/hetzner-robotlb/charts/robotlb/Chart.yaml b/packages/system/hetzner-robotlb/charts/robotlb/Chart.yaml new file mode 100644 index 00000000..743f255d --- /dev/null +++ b/packages/system/hetzner-robotlb/charts/robotlb/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +appVersion: 0.0.5 +description: A Helm chart for robotlb (loadbalancer on hetzner cloud). +name: robotlb +type: application +version: 0.1.3 diff --git a/packages/system/hetzner-robotlb/charts/robotlb/templates/NOTES.txt b/packages/system/hetzner-robotlb/charts/robotlb/templates/NOTES.txt new file mode 100644 index 00000000..edef6874 --- /dev/null +++ b/packages/system/hetzner-robotlb/charts/robotlb/templates/NOTES.txt @@ -0,0 +1,4 @@ +The RobotLB Operator was successfully installed. +Please follow the readme to create loadbalanced services. + +README: https://github.com/intreecom/robotlb diff --git a/packages/system/hetzner-robotlb/charts/robotlb/templates/_helpers.tpl b/packages/system/hetzner-robotlb/charts/robotlb/templates/_helpers.tpl new file mode 100644 index 00000000..14261e8a --- /dev/null +++ b/packages/system/hetzner-robotlb/charts/robotlb/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "robotlb.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 "robotlb.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 "robotlb.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "robotlb.labels" -}} +helm.sh/chart: {{ include "robotlb.chart" . }} +{{ include "robotlb.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "robotlb.selectorLabels" -}} +app.kubernetes.io/name: {{ include "robotlb.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "robotlb.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "robotlb.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/packages/system/hetzner-robotlb/charts/robotlb/templates/deployment.yaml b/packages/system/hetzner-robotlb/charts/robotlb/templates/deployment.yaml new file mode 100644 index 00000000..4fd71366 --- /dev/null +++ b/packages/system/hetzner-robotlb/charts/robotlb/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "robotlb.fullname" . }} + labels: + {{- include "robotlb.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + {{- include "robotlb.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "robotlb.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "robotlb.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 }} + command: + - /usr/local/bin/robotlb + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.envs }} + env: + {{- range $key, $val := . }} + - name: {{ $key | quote }} + value: {{ $val | quote }} + {{ end -}} + {{- end }} + {{- with .Values.existingSecrets }} + envFrom: + {{- range $val := . }} + - secretRef: + name: {{ $val | quote }} + {{ end -}} + {{- 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/packages/system/hetzner-robotlb/charts/robotlb/templates/role.yaml b/packages/system/hetzner-robotlb/charts/robotlb/templates/role.yaml new file mode 100644 index 00000000..3a7b9334 --- /dev/null +++ b/packages/system/hetzner-robotlb/charts/robotlb/templates/role.yaml @@ -0,0 +1,20 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "robotlb.fullname" . }}-cr +rules: {{- toYaml .Values.serviceAccount.permissions | nindent 2 }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "robotlb.fullname" . }}-crb +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "robotlb.fullname" . }}-cr +subjects: + - kind: ServiceAccount + name: {{ include "robotlb.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/packages/system/hetzner-robotlb/charts/robotlb/templates/serviceaccount.yaml b/packages/system/hetzner-robotlb/charts/robotlb/templates/serviceaccount.yaml new file mode 100644 index 00000000..ab3f843d --- /dev/null +++ b/packages/system/hetzner-robotlb/charts/robotlb/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "robotlb.serviceAccountName" . }} + labels: + {{- include "robotlb.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/packages/system/hetzner-robotlb/charts/robotlb/values.yaml b/packages/system/hetzner-robotlb/charts/robotlb/values.yaml new file mode 100644 index 00000000..739c7b73 --- /dev/null +++ b/packages/system/hetzner-robotlb/charts/robotlb/values.yaml @@ -0,0 +1,73 @@ +# Default values for robotlb. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: ghcr.io/intreecom/robotlb + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +envs: + ROBOTLB_LOG_LEVEL: "INFO" + +existingSecrets: [] + +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: "" + # This is a list of cluster permissions to apply to the service account. + # By default it grants all permissions. + permissions: + - apiGroups: [""] + resources: [services, services/status] + verbs: [get, list, patch, update, watch] + - apiGroups: [""] + resources: [nodes, pods] + verbs: [get, list, watch] + +podAnnotations: {} +podLabels: {} + +podSecurityContext: + {} + # fsGroup: 2000 + +securityContext: + {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +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 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/packages/system/hetzner-robotlb/values.yaml b/packages/system/hetzner-robotlb/values.yaml new file mode 100644 index 00000000..603da350 --- /dev/null +++ b/packages/system/hetzner-robotlb/values.yaml @@ -0,0 +1,3 @@ +robotlb: + replicas: 1 + existingSecrets: ["hetzner-robotlb-credentials"]