Skip to content

Commit

Permalink
add the helm charts
Browse files Browse the repository at this point in the history
  • Loading branch information
havardelnan committed Nov 18, 2024
1 parent 2437116 commit 37a2aeb
Show file tree
Hide file tree
Showing 19 changed files with 582 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ jobs:
publish-helm:
runs-on: ubuntu-latest
needs:
- build-container-image
- bump-version
env:
ROR_VERSION: ${{ needs.bump-version.outputs.ror_version }}
Expand Down
23 changes: 23 additions & 0 deletions charts/ror-cluster-agent-v1/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
25 changes: 25 additions & 0 deletions charts/ror-cluster-agent-v1/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
name: ror-cluster-agent
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.2

# 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: "0.9.1"
icon: https://raw.githubusercontent.com/NorskHelsenett/ror/main/media/ror.svg
62 changes: 62 additions & 0 deletions charts/ror-cluster-agent-v1/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ror-cluster-agent.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 "ror-cluster-agent.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 "ror-cluster-agent.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "ror-cluster-agent.labels" -}}
helm.sh/chart: {{ include "ror-cluster-agent.chart" . }}
{{ include "ror-cluster-agent.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "ror-cluster-agent.selectorLabels" -}}
app.kubernetes.io/name: "ror-cluster-agent"
app.kubernetes.io/instance: "ror-cluster-agent"
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "ror-cluster-agent.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ror-cluster-agent.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/ror-cluster-agent-v1/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "ror-cluster-agent.fullname" . }}:config-read-cr
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "watch", "list"]
71 changes: 71 additions & 0 deletions charts/ror-cluster-agent-v1/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ror-cluster-agent.fullname" . }}
labels:
{{- include "ror-cluster-agent.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "ror-cluster-agent.selectorLabels" . | nindent 6 }}
revisionHistoryLimit: 2
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ror-cluster-agent.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "ror-cluster-agent.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 }}
env:
- name: LOG_LEVEL
value: {{ .Values.debuglevel }}
- name: ROR_URL
value: {{ .Values.api }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: SECRET_NAME
value: {{ .Values.secretname }}
ports:
- name: liveness-probe
containerPort: 8100
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: 8100
readinessProbe:
httpGet:
path: /health
port: 8100
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 }}
10 changes: 10 additions & 0 deletions charts/ror-cluster-agent-v1/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: {{.Release.Namespace}}
name: {{ include "ror-cluster-agent.fullname" . }}:secret-role
rules:
- apiGroups: [""] # "" indicates the core API group
resources: ["secrets"]
verbs: ["get", "watch", "list","create", "update", "patch", "delete"]
40 changes: 40 additions & 0 deletions charts/ror-cluster-agent-v1/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ror-cluster-agent:config-reader-crb
subjects:
- kind: ServiceAccount
name: {{ include "ror-cluster-agent.serviceAccountName" . }}
namespace: {{.Release.Namespace}}
roleRef:
kind: ClusterRole
name: {{ include "ror-cluster-agent.fullname" . }}:config-read-cr
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "ror-cluster-agent.fullname" . }}-restricted-psp
namespace: {{.Release.Namespace}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: psp:vmware-system-restricted
subjects:
- kind: ServiceAccount
name: {{ include "ror-cluster-agent.serviceAccountName" . }}
namespace: {{.Release.Namespace}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "ror-cluster-agent.fullname" . }}:secret-rb
namespace: {{.Release.Namespace}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "ror-cluster-agent.fullname" . }}:secret-role
subjects:
- kind: ServiceAccount
name: {{ include "ror-cluster-agent.serviceAccountName" . }}
namespace: {{.Release.Namespace}}
13 changes: 13 additions & 0 deletions charts/ror-cluster-agent-v1/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "ror-cluster-agent.serviceAccountName" . }}
namespace: {{.Release.Namespace}}
labels:
{{- include "ror-cluster-agent.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
39 changes: 39 additions & 0 deletions charts/ror-cluster-agent-v1/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
debuglevel: INFO
replicaCount: 1
api: https://api.ror.sky.test.nhn.no
secretname: ror-secret
image:
repository: ncr.sky.nhn.no/ror/ror-cluster-agent
pullPolicy: Always
tag: "0.1.370"
imagePullSecrets: []
nameOverride: ""
fullnameOverride: "ror-cluster-agent"
serviceAccount:
create: true
name: ror-cluster-agent-sa
podAnnotations: {}
podSecurityContext:
runAsNonRoot: true
fsGroup: 2000
runAsUser: 1001
runAsGroup: 1001
supplementalGroups: [501]
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
seccompProfile:
type: RuntimeDefault
capabilities:
drop:
- ALL
resources:
limits:
cpu: 1000m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
23 changes: 23 additions & 0 deletions charts/ror-cluster-agent-v2/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
25 changes: 25 additions & 0 deletions charts/ror-cluster-agent-v2/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
name: ror-cluster-agent
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.2

# 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: "0.9.1"
icon: https://raw.githubusercontent.com/NorskHelsenett/ror/main/media/ror.svg
Loading

0 comments on commit 37a2aeb

Please sign in to comment.