Skip to content

Commit

Permalink
Add Admin UI to Helm chart (#196)
Browse files Browse the repository at this point in the history
* WIP

* chore: remove unneeded Admin API chart

* refactor: cleanup values.yaml

* fix: remove unintentionally added values

* feat: add ASPNETCORE_URLS env var to adminui

* feat: add settings for adminui

* feat: increase adminui version to 1.0.0

* feat: change the way rabbitmq is configured

* feat: increase version of consumerapi to 1.2.0

* feat: update adminui to 1.1.0

* chore: add .prettierrc

* chore: remove README.md

* feat: rename helm value "useDevEventbus" to "useBuiltInEventbus"

* chore: remove outdated aapi scripts
  • Loading branch information
tnotheis authored Jul 10, 2023
1 parent 3d1f663 commit 4cc99e9
Show file tree
Hide file tree
Showing 12 changed files with 425 additions and 171 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/publish-aapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Admin API Container Image

on:
push:
tags:
- "aapi/*"

jobs:
publish-aapi-container-image:
name: Publish Admin API Container Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install script dependencies
run: npm install --prefix ./.ci
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from git tag
id: extract-version-from-git-tag
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.ts)" >> $GITHUB_OUTPUT
env:
GIT_TAG: ${{ github.ref_name }}
- name: Build Container Image
run: ./.ci/aapi/buildContainerImage.ts
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
- name: Push Container Image
run: ./.ci/aapi/pushContainerImage.ts
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
16 changes: 16 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"endOfLine": "lf",
"printWidth": 200,
"tabWidth": 4,
"singleQuote": false,
"trailingComma": "none",
"semi": true,
"overrides": [
{
"files": ["*.yaml", "*.yml"],
"options": {
"tabWidth": 2
}
}
]
}
3 changes: 3 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ dependencies:
- name: admincli
version: "1.0.0"
repository: file://charts/admincli
- name: adminui
version: "1.0.0"
repository: file://charts/adminui
- name: consumerapi
version: "1.0.0"
repository: file://charts/consumerapi
Expand Down
9 changes: 9 additions & 0 deletions helm/charts/adminui/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
name: adminui
description: A Helm chart for Kubernetes

type: application

version: "1.0.0"

appVersion: "v1.1.0"
97 changes: 97 additions & 0 deletions helm/charts/adminui/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "global.name" . }}
labels:
{{- include "global.labels" . | nindent 4 }}
app: {{ include "global.name" . }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: {{ include "global.name" . }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "global.labels" . | nindent 8 }}
app: {{ include "global.name" . }}
spec:
serviceAccountName: {{ include "global.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- end }}
{{- with .Values.image.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: settings-override
configMap:
name: configuration
containers:
- name: {{ include "global.name" . }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
image: "{{ .Values.image.repository }}:{{- default .Chart.AppVersion .Values.image.tagOverride }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 15
failureThreshold: 5
volumeMounts:
- name: settings-override
mountPath: /app/appsettings.override.json
subPath: appsettings.override.json
readOnly: true
env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
{{- if .Values.global.useBuiltInEventbus }}
- name: infrastructure__eventBus__vendor
value: RabbitMQ
- name: infrastructure__eventBus__connectionInfo
value: "rabbitmq"
- name: infrastructure__eventBus__rabbitMQUsername
value: "admin"
- name: infrastructure__eventBus__rabbitMQPassword
valueFrom:
secretKeyRef:
name: rabbitmq-password
key: "VALUE"
{{- end }}
{{- with .Values.env }}
{{- toYaml . | nindent 12 }}
{{- 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 }}
28 changes: 28 additions & 0 deletions helm/charts/adminui/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "global.name" . }}
labels:
{{- include "global.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "global.name" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions helm/charts/adminui/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "global.name" . }}
labels:
{{- include "global.labels" . | nindent 4 }}
app: {{ include "global.name" . }}
{{- if eq .Values.global.provider "GoogleCloud" }}
annotations:
cloud.google.com/backend-config: '{"default": "{{ include "global.name" . }}"}'
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
- port: 80
targetPort: {{ .Values.service.port }}
selector:
app: {{ include "global.name" . }}
2 changes: 1 addition & 1 deletion helm/charts/consumerapi/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ type: application

version: "1.0.0"

appVersion: "v1.1.0"
appVersion: "v1.2.0"
10 changes: 9 additions & 1 deletion helm/charts/consumerapi/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,19 @@ spec:
subPath: appsettings.override.json
readOnly: true
env:
- name: Infrastructure__EventBus__RabbitMQPassword
{{- if .Values.global.useBuiltInEventbus }}
- name: infrastructure__eventBus__vendor
value: RabbitMQ
- name: infrastructure__eventBus__connectionInfo
value: "rabbitmq"
- name: infrastructure__eventBus__rabbitMQUsername
value: "admin"
- name: infrastructure__eventBus__rabbitMQPassword
valueFrom:
secretKeyRef:
name: rabbitmq-password
key: "VALUE"
{{- end }}
{{- with .Values.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
9 changes: 7 additions & 2 deletions helm/templates/rabbitmq/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.rabbitmq.create }}
{{- if .Values.global.useBuiltInEventbus }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -25,7 +25,12 @@ spec:
containerPort: 5672
protocol: TCP
resources:
{{- toYaml .Values.rabbitmq.resources | nindent 12 }}
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "200m"
memory: "256Mi"
env:
- name: RABBITMQ_DEFAULT_USER
value: admin
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/rabbitmq/service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.rabbitmq.create }}
{{- if .Values.global.useBuiltInEventbus }}
apiVersion: v1
kind: Service
metadata:
Expand Down
Loading

0 comments on commit 4cc99e9

Please sign in to comment.