Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ concurrency:

env:
IMAGE: ghcr.io/textyly/crossly-ui
MANIFESTS: ghcr.io/textyly/crossly-ui-manifests

jobs:
test:
Expand Down Expand Up @@ -77,6 +78,16 @@ jobs:
test "$(docker exec smoke id -u)" != 0
docker rm -f smoke

- name: Check that the manifests render
run: kubectl kustomize deploy/k8s > /dev/null

- uses: fluxcd/flux2/action@3fa784edd773d56630bb9f62645e08f70c2cff0a # v2.10.0
with:
version: 2.10.0

- name: Check that the manifests package
run: flux build artifact --path deploy/k8s --output "$RUNNER_TEMP/manifests.tgz"

- name: Log in to the container registry
if: github.event_name == 'push'
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
Expand All @@ -100,6 +111,16 @@ jobs:
org.opencontainers.image.licenses=Apache-2.0
cache-from: type=gha

- name: Publish the manifests with the new image tag
if: github.event_name == 'push'
env:
TAG: ${{ steps.meta.outputs.tag }}
run: |
sed -i "s|newTag: .*|newTag: ${TAG}|" deploy/k8s/kustomization.yaml
grep -q "newTag: ${TAG}" deploy/k8s/kustomization.yaml
flux push artifact "oci://${MANIFESTS}:${TAG}" --path=deploy/k8s --source="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" --revision="${GITHUB_REF_NAME}@sha1:${GITHUB_SHA}"
flux tag artifact "oci://${MANIFESTS}:${TAG}" --tag main

- name: Summary
if: github.event_name == 'push'
run: echo "Published \`${IMAGE}:${{ steps.meta.outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
run: echo "Published \`${IMAGE}:${{ steps.meta.outputs.tag }}\` and \`${MANIFESTS}:${{ steps.meta.outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
13 changes: 13 additions & 0 deletions deploy/k8s/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: crossly

resources:
- ui-deployment.yaml
- ui-service.yaml
- ui-ingress.yaml

images:
- name: ghcr.io/textyly/crossly-ui
newTag: main-8064a8b-1793537585
76 changes: 76 additions & 0 deletions deploy/k8s/ui-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: crossly-ui
labels:
app.kubernetes.io/name: crossly-ui
app.kubernetes.io/component: ui
app.kubernetes.io/part-of: crossly
spec:
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: crossly-ui
template:
metadata:
labels:
app.kubernetes.io/name: crossly-ui
app.kubernetes.io/component: ui
app.kubernetes.io/part-of: crossly
spec:
automountServiceAccountToken: false
securityContext:
runAsNonRoot: true
runAsUser: 101
runAsGroup: 101
seccompProfile:
type: RuntimeDefault
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app.kubernetes.io/name: crossly-ui
containers:
- name: ui
# tag comes from the images entry in kustomization.yaml
image: ghcr.io/textyly/crossly-ui
ports:
- name: http
containerPort: 8080
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 2
periodSeconds: 5
timeoutSeconds: 2
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 5
periodSeconds: 20
timeoutSeconds: 2
resources:
requests:
cpu: 10m
memory: 16Mi
limits:
cpu: 200m
memory: 64Mi
volumeMounts:
- name: tmp
mountPath: /tmp
volumes:
- name: tmp
emptyDir:
sizeLimit: 16Mi
19 changes: 19 additions & 0 deletions deploy/k8s/ui-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: crossly
labels:
app.kubernetes.io/name: crossly
app.kubernetes.io/part-of: crossly
spec:
rules:
- host: crossly.localhost
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: crossly-ui
port:
name: http
15 changes: 15 additions & 0 deletions deploy/k8s/ui-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: crossly-ui
labels:
app.kubernetes.io/name: crossly-ui
app.kubernetes.io/component: ui
app.kubernetes.io/part-of: crossly
spec:
selector:
app.kubernetes.io/name: crossly-ui
ports:
- name: http
port: 80
targetPort: http
Loading