From f14fa7f2436d2ba6551b47a7eb2100d6fbe9b572 Mon Sep 17 00:00:00 2001 From: ace Date: Fri, 9 Jan 2026 22:14:50 +0300 Subject: [PATCH] radicle: bump to 1.5.0, helm chart 0.1.1 --- radicle/.helmignore | 23 +++ radicle/Chart.yaml | 24 +++ radicle/templates/_helpers.tpl | 62 ++++++ radicle/templates/configmap.yaml | 14 ++ radicle/templates/deployment.yaml | 174 ++++++++++++++++ radicle/templates/hpa.yaml | 32 +++ radicle/templates/ingress.yaml | 43 ++++ radicle/templates/persistentvolumeclaim.yaml | 28 +++ radicle/templates/service.yaml | 19 ++ radicle/templates/serviceaccount.yaml | 13 ++ radicle/templates/tests/test-connection.yaml | 15 ++ radicle/values.yaml | 196 +++++++++++++++++++ 12 files changed, 643 insertions(+) create mode 100644 radicle/.helmignore create mode 100644 radicle/Chart.yaml create mode 100644 radicle/templates/_helpers.tpl create mode 100644 radicle/templates/configmap.yaml create mode 100644 radicle/templates/deployment.yaml create mode 100644 radicle/templates/hpa.yaml create mode 100644 radicle/templates/ingress.yaml create mode 100644 radicle/templates/persistentvolumeclaim.yaml create mode 100644 radicle/templates/service.yaml create mode 100644 radicle/templates/serviceaccount.yaml create mode 100644 radicle/templates/tests/test-connection.yaml create mode 100644 radicle/values.yaml diff --git a/radicle/.helmignore b/radicle/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/radicle/.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/radicle/Chart.yaml b/radicle/Chart.yaml new file mode 100644 index 0000000..ecd1a97 --- /dev/null +++ b/radicle/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: radicle +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.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.5.0" diff --git a/radicle/templates/_helpers.tpl b/radicle/templates/_helpers.tpl new file mode 100644 index 0000000..7eafd8c --- /dev/null +++ b/radicle/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "radicle.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 "radicle.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 "radicle.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "radicle.labels" -}} +helm.sh/chart: {{ include "radicle.chart" . }} +{{ include "radicle.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "radicle.selectorLabels" -}} +app.kubernetes.io/name: {{ include "radicle.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "radicle.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "radicle.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/radicle/templates/configmap.yaml b/radicle/templates/configmap.yaml new file mode 100644 index 0000000..849f270 --- /dev/null +++ b/radicle/templates/configmap.yaml @@ -0,0 +1,14 @@ +{{- if .Values.configAsCode.enabled }} +kind: ConfigMap +apiVersion: v1 +metadata: + name: {{ include "radicle.fullname" . }}-config + labels: + app.kubernetes.io/name: {{ include "radicle.name" . }} + helm.sh/chart: {{ include "radicle.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +data: + config.json: | + {{- toYaml .Values.configAsCode.config | fromYaml | toPrettyJson | nindent 4 }} +{{- end }} diff --git a/radicle/templates/deployment.yaml b/radicle/templates/deployment.yaml new file mode 100644 index 0000000..257e57b --- /dev/null +++ b/radicle/templates/deployment.yaml @@ -0,0 +1,174 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "radicle.fullname" . }} + labels: + {{- include "radicle.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + type: {{ .Values.strategyType }} + selector: + matchLabels: + {{- include "radicle.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "radicle.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "radicle.serviceAccountName" . }} + {{- with .Values.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + initContainers: + - name: {{ .Chart.Name }}-init + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + image: "{{ .Values.image.radicleNode.repository }}:{{ .Values.image.radicleNode.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + tty: true + command: ["/bin/sh", "-c"] + args: ["rad auth --alias {{ .Values.configAsCode.config.node.alias }}"] + env: + {{- range $key, $value := .Values.env }} + - name: {{ tpl $key $ }} + value: {{ tpl $value $ | quote }} + {{- end }} + {{- with .Values.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: {{ include "radicle.fullname" . }}-data + mountPath: /root/.radicle + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + containers: + - name: {{ .Chart.Name }}-node + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + image: "{{ .Values.image.radicleNode.repository }}:{{ .Values.image.radicleNode.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: tcp + containerPort: {{ .Values.service.tcp }} + protocol: TCP + env: + {{- range $key, $value := .Values.env }} + - name: {{ tpl $key $ }} + value: {{ tpl $value $ | quote }} + {{- end }} + {{- with .Values.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: {{ include "radicle.fullname" . }}-data + mountPath: /root/.radicle + - name: {{ include "radicle.fullname" . }}-config + mountPath: /root/.radicle/config.json + subPath: config.json + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + - name: {{ .Chart.Name }}-httpd + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + image: "{{ .Values.image.radicleHttpd.repository }}:{{ .Values.image.radicleHttpd.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.http }} + protocol: TCP + env: + {{- range $key, $value := .Values.env }} + - name: {{ tpl $key $ }} + value: {{ tpl $value $ | quote }} + {{- end }} + {{- with .Values.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: {{ include "radicle.fullname" . }}-data + mountPath: /root/.radicle + - name: {{ include "radicle.fullname" . }}-config + mountPath: /root/.radicle/config.json + subPath: config.json + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + {{- with .Values.volumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + - name: {{ include "radicle.fullname" . }}-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "radicle.fullname" .) }} + {{- else }} + emptyDir: {} + {{- end }} + {{- if .Values.configAsCode.enabled }} + - name: {{ include "radicle.fullname" . }}-config + configMap: + name: {{ include "radicle.fullname" . }}-config + {{- 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/radicle/templates/hpa.yaml b/radicle/templates/hpa.yaml new file mode 100644 index 0000000..c944b7a --- /dev/null +++ b/radicle/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "radicle.fullname" . }} + labels: + {{- include "radicle.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "radicle.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/radicle/templates/ingress.yaml b/radicle/templates/ingress.yaml new file mode 100644 index 0000000..6751fa6 --- /dev/null +++ b/radicle/templates/ingress.yaml @@ -0,0 +1,43 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "radicle.fullname" . }} + labels: + {{- include "radicle.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- with .Values.ingress.className }} + ingressClassName: {{ . }} + {{- 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 }} + {{- with .pathType }} + pathType: {{ . }} + {{- end }} + backend: + service: + name: {{ include "radicle.fullname" $ }} + port: + number: {{ $.Values.service.http }} + {{- end }} + {{- end }} +{{- end }} diff --git a/radicle/templates/persistentvolumeclaim.yaml b/radicle/templates/persistentvolumeclaim.yaml new file mode 100644 index 0000000..05d184c --- /dev/null +++ b/radicle/templates/persistentvolumeclaim.yaml @@ -0,0 +1,28 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "radicle.fullname" . }} + labels: + app: {{ template "radicle.name" . }} + chart: {{ template "radicle.chart" . }} + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- if .Values.persistence.annotations }} + annotations: +{{ toYaml .Values.persistence.annotations | indent 4 }} +{{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/radicle/templates/service.yaml b/radicle/templates/service.yaml new file mode 100644 index 0000000..ff4f1cc --- /dev/null +++ b/radicle/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "radicle.fullname" . }} + labels: + {{- include "radicle.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.tcp }} + targetPort: tcp + protocol: TCP + name: tcp + - port: {{ .Values.service.http }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "radicle.selectorLabels" . | nindent 4 }} diff --git a/radicle/templates/serviceaccount.yaml b/radicle/templates/serviceaccount.yaml new file mode 100644 index 0000000..fec3324 --- /dev/null +++ b/radicle/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "radicle.serviceAccountName" . }} + labels: + {{- include "radicle.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/radicle/templates/tests/test-connection.yaml b/radicle/templates/tests/test-connection.yaml new file mode 100644 index 0000000..717c1ea --- /dev/null +++ b/radicle/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "radicle.fullname" . }}-test-connection" + labels: + {{- include "radicle.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "radicle.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/radicle/values.yaml b/radicle/values.yaml new file mode 100644 index 0000000..74c9a6e --- /dev/null +++ b/radicle/values.yaml @@ -0,0 +1,196 @@ +# Default values for radicle. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ +replicaCount: 1 +strategyType: Recreate + +# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ +image: + radicleNode: + repository: gitea.geekhome.org/ghp/radicle-node + tag: "1.5.0-1" + pullPolicy: IfNotPresent + radicleHttpd: + repository: gitea.geekhome.org/ghp/radicle-httpd + tag: "0.22.0-1" + pullPolicy: IfNotPresent + +# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# This is to override the chart name. +nameOverride: "" +fullnameOverride: "" + +env: + RAD_PASSPHRASE: 'changeme!' + +configAsCode: + enabled: true + config: + publicExplorer: https://app.radicle.xyz/nodes/$host/$rid$path + preferredSeeds: + - z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@seed.radicle.garden:8776 + - z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@ash.radicle.garden:8776 + web: + pinned: + repositories: [] + cli: + hints: true + node: + alias: 'seed.radicle.example.com' + listen: ['0.0.0.0:8776'] + peers: + type: dynamic + connect: [] + externalAddresses: ['seed.radicle.example.com:8776'] + network: main + log: INFO + relay: auto + limits: + routingMaxSize: 1000 + routingMaxAge: 604800 + gossipMaxAge: 1209600 + fetchConcurrency: 1 + maxOpenFiles: 4096 + rate: + inbound: + fillRate: 5 + capacity: 1024 + outbound: + fillRate: 10 + capacity: 2048 + connection: + inbound: 128 + outbound: 16 + fetchPackReceive: 500.0 MiB + workers: 8 + seedingPolicy: + default: block + +# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ +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 for setting Kubernetes Annotations to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +podAnnotations: {} +# This is for setting Kubernetes Labels to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/ +service: + # This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + type: ClusterIP + # This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports + tcp: 8776 + http: 8080 + +# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/ +ingress: + enabled: false + className: "" + annotations: + # cert-manager.io/cluster-issuer: "letsencrypt-prod" + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: seed.radicle.example.com + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: seed.radicle.example.com-tls + # hosts: + # - seed.radicle.example.com + +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 + +# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ +#livenessProbe: +# httpGet: +# path: / +# port: http +#readinessProbe: +# httpGet: +# path: / +# port: http + +persistence: + # Radicle node Data (/root/.radicle) + enabled: false + annotations: {} + ## PeerTube data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + + ## A manually managed Persistent Volume and Claim + ## Requires persistence.enabled: true + ## If defined, PVC must be created manually before volume will be bound + # existingClaim: + + accessMode: ReadWriteOnce + size: 100Gi + +# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/ +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: {}