Skip to content
Snippets Groups Projects
Commit 21d1c929 authored by Benjamin Wingfield's avatar Benjamin Wingfield
Browse files

add deployment

parent cb424a06
No related branches found
No related tags found
No related merge requests found
pyvatti/helmvatti/values.yaml pyvatti/helmvatti/values.yaml
\ No newline at end of file chart/values.yaml
...@@ -15,6 +15,8 @@ RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR ...@@ -15,6 +15,8 @@ RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
FROM python:3.12-slim-bullseye FROM python:3.12-slim-bullseye
ARG TARGETARCH
ENV VIRTUAL_ENV=/app/.venv \ ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH" PATH="/app/.venv/bin:$PATH"
...@@ -26,9 +28,15 @@ ADD pyvatti/helmvatti /opt/helmvatti ...@@ -26,9 +28,15 @@ ADD pyvatti/helmvatti /opt/helmvatti
ENV HELM_CHART_PATH=/opt/helmvatti ENV HELM_CHART_PATH=/opt/helmvatti
WORKDIR /tmp
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y curl \ && apt-get install -y curl \
&& curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash && curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl" \
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \
&& curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash \
&& rm /tmp/* \
&& apt-get -y clean
WORKDIR /app/ WORKDIR /app/
......
# 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/
apiVersion: v2
name: hattivatti
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: "dev"
{{/*
Expand the name of the chart.
*/}}
{{- define "hattivatti.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 "hattivatti.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 "hattivatti.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "hattivatti.labels" -}}
helm.sh/chart: {{ include "hattivatti.chart" . }}
{{ include "hattivatti.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "hattivatti.selectorLabels" -}}
app.kubernetes.io/name: {{ include "hattivatti.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "hattivatti.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "hattivatti.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "hattivatti.fullname" . }}
labels:
{{- include "hattivatti.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "hattivatti.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "hattivatti.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "hattivatti.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
resources:
requests:
cpu: 500m
ephemeral-storage: 1Gi
memory: 512Mi
env:
{{- range $envVarName, $secretKey := .Values.envMapping }}
- name: {{ $envVarName }}
valueFrom:
secretKeyRef:
name: {{ $.Release.Name }}-secrets
key: {{ $envVarName }}
{{- end }}
\ No newline at end of file
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: helm
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""]
resources: ["serviceaccounts", "configmaps", "pods", "secrets"]
verbs: ["get", "create", "list", "delete"]
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["get", "create", "list", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: helm
namespace: {{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: helm
apiGroup: rbac.authorization.k8s.io
\ No newline at end of file
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-secrets
data:
{{- range $envVarName, $secretKey := .Values.envMapping }}
{{ $envVarName }}: {{ index $.Values.secrets $secretKey | b64enc }}
{{- end }}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: {{ include "hattivatti.fullname" . }}
labels:
{{- include "hattivatti.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "hattivatti.selectorLabels" . | nindent 4 }}
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "hattivatti.serviceAccountName" . }}
labels:
{{- include "hattivatti.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}
# Default values for hattivatti.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: dockerhub.ebi.ac.uk/gdp-public/hattivatti
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: "dev"
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: "hattivatti"
service:
type: ClusterIP
port: 80
secrets:
globusDomain: dummy
globusClientId: dummy
globusClientSecret: dummy
globusScopes: dummy
towerToken: dummy
towerId: dummy
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment