Compare commits

...

4 Commits

Author SHA1 Message Date
2496b12a7c feat: Add security context
All checks were successful
Build and deploy / build (push) Successful in 11m49s
2025-12-22 01:16:24 +01:00
3c387ca803 fix: Outdated glibc 2025-12-22 01:15:50 +01:00
dba119951b chore: Renamed credentials secret in deployment 2025-12-22 01:15:50 +01:00
8072de7c4b feat: Update to new workflow 2025-12-21 22:22:26 +01:00
4 changed files with 46 additions and 10 deletions

View File

@@ -9,8 +9,8 @@ on:
jobs: jobs:
build: build:
uses: dreaded_x/workflows/.gitea/workflows/rust-kubernetes.yaml@66ab50c3ac239dbdd1e42e6276ec2e65b6a79379 uses: infra/workflows/.gitea/workflows/docker.yaml@956337b9bd5e72a93d3a57513cd421e7554dd61d
secrets: inherit secrets: inherit
with: with:
generate_crds: true
webhook_url: ${{ secrets.WEBHOOK_URL }} webhook_url: ${{ secrets.WEBHOOK_URL }}

View File

@@ -15,9 +15,11 @@ RUN cargo chef cook --release --recipe-path recipe.json
COPY . . COPY . .
ARG RELEASE_VERSION ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION} ENV RELEASE_VERSION=${RELEASE_VERSION}
RUN cargo auditable build --release RUN cargo auditable build --release && /app/target/release/crdgen > /crds.yaml
FROM gcr.io/distroless/cc-debian12:nonroot AS runtime FROM scratch AS manifests
COPY --from=builder /crds.yaml /
FROM gcr.io/distroless/cc-debian13:nonroot AS runtime
COPY --from=builder /app/target/release/lldap-controller /lldap-controller COPY --from=builder /app/target/release/lldap-controller /lldap-controller
COPY --from=builder /app/target/release/crdgen /crdgen
CMD ["/lldap-controller"] CMD ["/lldap-controller"]

23
docker-bake.hcl Normal file
View File

@@ -0,0 +1,23 @@
variable "TAG_BASE" {}
variable "RELEASE_VERSION" {}
group "default" {
targets = ["lldap-controller", "manifests"]
}
target "docker-metadata-action" {}
target "lldap-controller" {
inherits = ["docker-metadata-action"]
context = "./"
dockerfile = "Dockerfile"
tags = [for tag in target.docker-metadata-action.tags : "${TAG_BASE}:${tag}"]
target = "runtime"
}
target "manifests" {
context = "./"
dockerfile = "Dockerfile"
target = "manifests"
output = [{ type = "cacheonly" }, "manifests"]
}

View File

@@ -18,12 +18,17 @@ spec:
kubectl.kubernetes.io/default-container: lldap-controller kubectl.kubernetes.io/default-container: lldap-controller
spec: spec:
serviceAccountName: lldap-controller serviceAccountName: lldap-controller
securityContext: {} securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers: containers:
- name: lldap-controller - name: lldap-controller
image: git.huizinga.dev/dreaded_x/lldap-controller@${DIGEST} image: '{{ index .images "lldap-controller" }}'
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
securityContext: {}
resources: resources:
limits: limits:
cpu: 200m cpu: 200m
@@ -43,10 +48,16 @@ spec:
- name: LLDAP_USERNAME - name: LLDAP_USERNAME
value: admin value: admin
- name: LLDAP_PASSWORD_FILE - name: LLDAP_PASSWORD_FILE
value: /secrets/credentials/lldap-ldap-user-pass value: /secrets/credentials/admin-pass
- name: LLDAP_BIND_DN - name: LLDAP_BIND_DN
value: uid={username},ou=people,dc=huizinga,dc=dev value: uid={username},ou=people,dc=huizinga,dc=dev
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop:
- ALL
volumes: volumes:
- name: credentials - name: credentials
secret: secret:
secretName: lldap-credentials secretName: credentials