Skip to content

Commit

Permalink
Merge pull request #78 from intelops/scsctl-dev
Browse files Browse the repository at this point in the history
updated github actions and scsctl chart
  • Loading branch information
jebjohns authored Feb 15, 2024
2 parents 2fd0d91 + 8032219 commit bc16e9e
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 35 deletions.
1 change: 1 addition & 0 deletions .github/workflows/container-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- 'main'
- 'feat/capten_integration'

jobs:
build:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- 'charts/**'
branches:
- 'main'
- 'feat/capten_integration'

jobs:

Expand Down Expand Up @@ -54,7 +55,9 @@ jobs:
with:
context: .
file: ./Dockerfile
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }}
tags: |
${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }},
${{ env.REGISTRY }}/${{ github.repository }}:dev
labels: ${{ steps.metadata.outputs.labels }}

push: true
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion charts/scsctl/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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
version: 0.1.1

# 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
Expand Down
63 changes: 49 additions & 14 deletions charts/scsctl/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "scsctl.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "scsctl.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand All @@ -30,6 +27,29 @@ spec:
serviceAccountName: {{ include "scsctl.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: create-postgres-datbase
image: "docker.io/bitnami/postgresql:16.0.0-debian-11-r13"
imagePullPolicy: Always
command:
- "/bin/sh"
- "-c"
- >
echo "Creating database {{ .Values.postgresql.database }} if it does not exist..." &&
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 }};" &&
echo "Database {{ .Values.postgresql.database }} created or already exists. Listing all databases:" &&
psql -h {{ .Values.postgresql.host }} -p {{ .Values.postgresql.port }} -U {{ .Values.postgresql.username }} -l &&
sleep 5
env:
- name: PGPASSWORD
{{- if not .Values.postgresql.existingSecret }}
value: "{{ .Values.postgresql.password }}"
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.postgresql.existingSecret.name }}
key: {{ .Values.postgresql.existingSecret.passwordKey }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand All @@ -40,24 +60,39 @@ spec:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
args:
- server
env:
- name: SCSCTL_PG_HOST
value: "{{ .Values.postgresql.host }}"
- name: SCSCTL_PG_PORT
value: "{{ .Values.postgresql.port }}"
- name: SCSCTL_PG_USER
value: "{{ .Values.postgresql.username }}"
- name: SCSCTL_PG_PASSWORD
{{- if not .Values.postgresql.existingSecret }}
value: "{{ .Values.postgresql.password }}"
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.postgresql.existingSecret.name }}
key: {{ .Values.postgresql.existingSecret.passwordKey }}
{{- end }}
- name: SCSCTL_PG_DATABASE
value: "{{ .Values.postgresql.database }}"
- name: SCSCTL_ENVIRONMENT
value: "{{ .Values.env.SCSCTL_ENVIRONMENT }}"

livenessProbe:
httpGet:
path: /
path: /healthz
port: http
readinessProbe:
httpGet:
path: /
path: /ready
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 0 additions & 1 deletion charts/scsctl/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ metadata:
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}
35 changes: 17 additions & 18 deletions charts/scsctl/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: python:3.10-slim@sha256
repository: ghcr.io/intelops/scsctl
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "latest"
Expand All @@ -17,16 +17,13 @@ fullnameOverride: ""
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: ""

podAnnotations: {}
podLabels: {}

podSecurityContext: {}
# fsGroup: 2000
Expand All @@ -41,7 +38,7 @@ securityContext: {}

service:
type: ClusterIP
port: 80
port: 5000

ingress:
enabled: false
Expand Down Expand Up @@ -78,21 +75,23 @@ autoscaling:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

nodeSelector: {}

tolerations: []

affinity: {}

postgresql:
host: "postgresql"
port: "5432"
database: ""
username: "postgres"
password: ""
existingSecret: {}
# name: ""
# passwordKey: ""


# Configure the environment variables for the application
env:
SCSCTL_ENVIRONMENT: ""

0 comments on commit bc16e9e

Please sign in to comment.