-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b359be
commit 587638f
Showing
13 changed files
with
315 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Helm Charts | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
# Deduplicate jobs from pull requests and branch pushes within the same repo. | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4.1.2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Helm | ||
uses: azure/setup-helm@v3.5 | ||
|
||
- name: Setup chart-testing | ||
uses: helm/chart-testing-action@v2.6.1 | ||
|
||
- name: Lint | ||
run: > | ||
ct | ||
lint | ||
--target-branch=${{ github.event.repository.default_branch }} | ||
--validate-maintainers=false | ||
build_publish: | ||
needs: | ||
- lint | ||
# Deduplicate jobs from pull requests and branch pushes within the same repo. | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4.1.2 | ||
|
||
- name: Retrieve chart dependencies | ||
working-directory: charts/datasets | ||
run: helm dependency update | ||
|
||
- name: Package chart | ||
working-directory: charts/datasets | ||
run: helm package . | ||
|
||
- name: Generate Image Name | ||
run: echo IMAGE_REPOSITORY=oci://ghcr.io/$(echo "${{ github.repository }}-chart" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV | ||
|
||
- name: Log in to GitHub Docker Registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish chart | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
working-directory: charts/datasets | ||
run: helm push $(ls datasets-*.tgz) ${{ env.IMAGE_REPOSITORY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Chart Bundles | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dependencies: | ||
- name: datasets | ||
repository: "" | ||
version: 0.1.0 | ||
digest: sha256:bac0b96b8e2519051015ea74ef616cbc76de21a1803714ef9fa25ab896a10f93 | ||
generated: "2024-03-28T11:43:46.834271769Z" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v2 | ||
name: datasets | ||
description: A deployment providing data collected during beamline session as part of the graph federation | ||
type: application | ||
|
||
version: 0.1.0 | ||
|
||
dependencies: | ||
- name: datasets | ||
version: 0.1.0 | ||
condition: datasets.enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v2 | ||
name: datasets | ||
description: A service providing data collected during beamline sessions as part of the graph federation | ||
type: application | ||
|
||
version: 0.1.0 | ||
|
||
appVersion: 0.1.0-rc1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "datasets.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 "datasets.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 "datasets.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "datasets.labels" -}} | ||
helm.sh/chart: {{ include "datasets.chart" . }} | ||
{{ include "datasets.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "datasets.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "datasets.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "datasets.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "datasets.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the database URL string | ||
*/}} | ||
{{- define "datasets.databaseURL" -}} | ||
{{- $host_parts := urlParse .Values.database.host }} | ||
{{- $raw_user_info := printf "%s:$DATABASE_PASSWORD" .Values.database.user }} | ||
{{- $url_parts := set $host_parts "userinfo" $raw_user_info }} | ||
{{- $raw_database_url := urlJoin $url_parts }} | ||
{{- replace "$DATABASE_PASSWORD" "$(DATABASE_PASSWORD)" $raw_database_url }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "datasets.fullname" . }} | ||
labels: | ||
{{- include "datasets.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "datasets.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "datasets.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "datasets.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 }} | ||
args: | ||
- serve | ||
env: | ||
- name: DATABASE_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.database.password.secretName }} | ||
key: {{ .Values.database.password.secretKey }} | ||
- name: DATABASE_URL | ||
value: {{ include "datasets.databaseURL" . }} | ||
- name: LOG_LEVEL | ||
value: {{ .Values.logLevel }} | ||
- name: OTEL_COLLECTOR_URL | ||
value: {{ tpl .Values.otelCollectorUrl . }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.service.port }} | ||
protocol: TCP | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "datasets.fullname" . }} | ||
labels: | ||
{{- include "datasets.labels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "datasets.selectorLabels" . | nindent 4 }} |
12 changes: 12 additions & 0 deletions
12
charts/datasets/charts/datasets/templates/serviceaccount.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "datasets.serviceAccountName" . }} | ||
labels: | ||
{{- include "datasets.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
image: | ||
repository: ghcr.io/diamondlightsource/graph-datasets | ||
pullPolicy: Always | ||
tag: "" | ||
|
||
imagePullSecrets: [] | ||
|
||
logLevel: Warn | ||
otelCollectorUrl: "" | ||
|
||
database: | ||
host: "" | ||
user: "" | ||
password: | ||
secretName: "" | ||
secretKey: "" | ||
|
||
opa: | ||
url: "" | ||
|
||
replicaCount: 1 | ||
|
||
service: | ||
type: ClusterIP | ||
port: 80 | ||
|
||
serviceAccount: | ||
create: true | ||
annotations: {} | ||
name: "" | ||
|
||
podAnnotations: {} | ||
|
||
podSecurityContext: {} | ||
|
||
securityContext: {} | ||
|
||
resources: {} | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
datasets: | ||
enabled: true | ||
logLevel: Trace | ||
database: | ||
host: mysql://ispyb-mariadb-galera-headless/ispyb | ||
user: ispyb_ro | ||
password: | ||
secretName: ispyb | ||
secretKey: password | ||
otelCollectorUrl: http://federation-opentelemetry-collector:4317 |