Skip to content

Commit 609e933

Browse files
committed
updated github actions and scsctl chart
1 parent 2fd0d91 commit 609e933

File tree

7 files changed

+72
-35
lines changed

7 files changed

+72
-35
lines changed

.github/workflows/container-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
branches:
66
- 'main'
7+
- 'feat/capten_integration'
78

89
jobs:
910
build:

.github/workflows/container.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- 'charts/**'
88
branches:
99
- 'main'
10+
- 'feat/capten_integration'
1011

1112
jobs:
1213

@@ -54,7 +55,9 @@ jobs:
5455
with:
5556
context: .
5657
file: ./Dockerfile
57-
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }}
58+
tags: |
59+
${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }},
60+
${{ env.REGISTRY }}/${{ github.repository }}:dev
5861
labels: ${{ steps.metadata.outputs.labels }}
5962

6063
push: true
File renamed without changes.

charts/scsctl/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.0
18+
version: 0.1.1
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/scsctl/templates/deployment.yaml

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ spec:
1818
{{- toYaml . | nindent 8 }}
1919
{{- end }}
2020
labels:
21-
{{- include "scsctl.labels" . | nindent 8 }}
22-
{{- with .Values.podLabels }}
23-
{{- toYaml . | nindent 8 }}
24-
{{- end }}
21+
{{- include "scsctl.selectorLabels" . | nindent 8 }}
2522
spec:
2623
{{- with .Values.imagePullSecrets }}
2724
imagePullSecrets:
@@ -30,6 +27,29 @@ spec:
3027
serviceAccountName: {{ include "scsctl.serviceAccountName" . }}
3128
securityContext:
3229
{{- toYaml .Values.podSecurityContext | nindent 8 }}
30+
initContainers:
31+
- name: create-postgres-datbase
32+
image: "docker.io/bitnami/postgresql:16.0.0-debian-11-r13"
33+
imagePullPolicy: Always
34+
command:
35+
- "/bin/sh"
36+
- "-c"
37+
- >
38+
echo "Creating database {{ .Values.postgresql.database }} if it does not exist..." &&
39+
psql -h {{ .Values.postgresql.host }} -p {{ .Values.postgresql.port }} -U {{ .Values.postgresql.username }} -lqt | cut -d \| -f 1 | grep -qw {{ .Values.postgresql.database }} || psql -h {{ .Values.postgresql.host }} -p {{ .Values.postgresql.port }} -U {{ .Values.postgresql.username }} -c "CREATE DATABASE {{ .Values.postgresql.database }};" &&
40+
echo "Database {{ .Values.postgresql.database }} created or already exists. Listing all databases:" &&
41+
psql -h {{ .Values.postgresql.host }} -p {{ .Values.postgresql.port }} -U {{ .Values.postgresql.username }} -l &&
42+
sleep 5
43+
env:
44+
- name: PGPASSWORD
45+
{{- if not .Values.postgresql.existingSecret }}
46+
value: "{{ .Values.postgresql.password }}"
47+
{{- else }}
48+
valueFrom:
49+
secretKeyRef:
50+
name: {{ .Values.postgresql.existingSecret.name }}
51+
key: {{ .Values.postgresql.existingSecret.passwordKey }}
52+
{{- end }}
3353
containers:
3454
- name: {{ .Chart.Name }}
3555
securityContext:
@@ -40,24 +60,39 @@ spec:
4060
- name: http
4161
containerPort: {{ .Values.service.port }}
4262
protocol: TCP
63+
args:
64+
- server
65+
env:
66+
- name: SCSCTL_PG_HOST
67+
value: "{{ .Values.postgresql.host }}"
68+
- name: SCSCTL_PG_PORT
69+
value: "{{ .Values.postgresql.port }}"
70+
- name: SCSCTL_PG_USER
71+
value: "{{ .Values.postgresql.username }}"
72+
- name: SCSCTL_PG_PASSWORD
73+
{{- if not .Values.postgresql.existingSecret }}
74+
value: "{{ .Values.postgresql.password }}"
75+
{{- else }}
76+
valueFrom:
77+
secretKeyRef:
78+
name: {{ .Values.postgresql.existingSecret.name }}
79+
key: {{ .Values.postgresql.existingSecret.passwordKey }}
80+
{{- end }}
81+
- name: SCSCTL_PG_DATABASE
82+
value: "{{ .Values.postgresql.database }}"
83+
- name: SCSCTL_ENVIRONMENT
84+
value: "{{ .Values.env.SCSCTL_ENVIRONMENT }}"
85+
4386
livenessProbe:
4487
httpGet:
45-
path: /
88+
path: /healthz
4689
port: http
4790
readinessProbe:
4891
httpGet:
49-
path: /
92+
path: /ready
5093
port: http
5194
resources:
5295
{{- toYaml .Values.resources | nindent 12 }}
53-
{{- with .Values.volumeMounts }}
54-
volumeMounts:
55-
{{- toYaml . | nindent 12 }}
56-
{{- end }}
57-
{{- with .Values.volumes }}
58-
volumes:
59-
{{- toYaml . | nindent 8 }}
60-
{{- end }}
6196
{{- with .Values.nodeSelector }}
6297
nodeSelector:
6398
{{- toYaml . | nindent 8 }}

charts/scsctl/templates/serviceaccount.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ metadata:
99
annotations:
1010
{{- toYaml . | nindent 4 }}
1111
{{- end }}
12-
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
1312
{{- end }}

charts/scsctl/values.yaml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
replicaCount: 1
66

77
image:
8-
repository: python:3.10-slim@sha256
8+
repository: ghcr.io/jegathintelops/scsctl
99
pullPolicy: IfNotPresent
1010
# Overrides the image tag whose default is the chart appVersion.
1111
tag: "latest"
@@ -17,16 +17,13 @@ fullnameOverride: ""
1717
serviceAccount:
1818
# Specifies whether a service account should be created
1919
create: true
20-
# Automatically mount a ServiceAccount's API credentials?
21-
automount: true
2220
# Annotations to add to the service account
2321
annotations: {}
2422
# The name of the service account to use.
2523
# If not set and create is true, a name is generated using the fullname template
2624
name: ""
2725

2826
podAnnotations: {}
29-
podLabels: {}
3027

3128
podSecurityContext: {}
3229
# fsGroup: 2000
@@ -41,7 +38,7 @@ securityContext: {}
4138

4239
service:
4340
type: ClusterIP
44-
port: 80
41+
port: 5000
4542

4643
ingress:
4744
enabled: false
@@ -78,21 +75,23 @@ autoscaling:
7875
targetCPUUtilizationPercentage: 80
7976
# targetMemoryUtilizationPercentage: 80
8077

81-
# Additional volumes on the output Deployment definition.
82-
volumes: []
83-
# - name: foo
84-
# secret:
85-
# secretName: mysecret
86-
# optional: false
87-
88-
# Additional volumeMounts on the output Deployment definition.
89-
volumeMounts: []
90-
# - name: foo
91-
# mountPath: "/etc/foo"
92-
# readOnly: true
93-
9478
nodeSelector: {}
9579

9680
tolerations: []
9781

9882
affinity: {}
83+
84+
postgresql:
85+
host: "postgresql"
86+
port: "5432"
87+
database: ""
88+
username: "postgres"
89+
password: ""
90+
existingSecret: {}
91+
# name: ""
92+
# passwordKey: ""
93+
94+
95+
# Configure the environment variables for the application
96+
env:
97+
SCSCTL_ENVIRONMENT: ""

0 commit comments

Comments
 (0)