Skip to content

Commit

Permalink
small additions
Browse files Browse the repository at this point in the history
  • Loading branch information
blankdots committed Aug 8, 2024
1 parent 278e996 commit 3506b68
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 28 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
with:
cosign-release: 'v2.1.1'

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
Expand Down Expand Up @@ -78,22 +70,6 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max


# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

releasechart:
runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ COPY . .

RUN CGO_ENABLED=0 go build -o webhook -ldflags '-w -extldflags "-static"' .

FROM alpine:3.19

RUN apk add --no-cache ca-certificates
FROM scratch

COPY --from=build /workspace/webhook /usr/local/bin/webhook
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt


ENTRYPOINT ["webhook"]
9 changes: 8 additions & 1 deletion deploy/rcodezero-webhook/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ metadata:
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
{{- if .Values.podSecurityContext.enabled }}
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
selector:
matchLabels:
app: {{ include "example-webhook.name" . }}
Expand All @@ -24,16 +27,20 @@ spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --secure-port={{ .Values.service.port }}
- --tls-cert-file=/tls/tls.crt
- --tls-private-key-file=/tls/tls.key
env:
- name: GROUP_NAME
value: {{ .Values.groupName | quote }}
ports:
- name: https
containerPort: 443
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
Expand Down
45 changes: 45 additions & 0 deletions deploy/rcodezero-webhook/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,48 @@ nodeSelector: {}
tolerations: []

affinity: {}

## @section Security Contexts

containerSecurityContext:
## @param containerSecurityContext.enabled Whether to enable the container security context
##
enabled: true
## @param containerSecurityContext.runAsNonRoot Whether to run the container as a non-root user
##
runAsNonRoot: true
## @param containerSecurityContext.privileged Whether the container is privileged
##
privileged: false
## @param containerSecurityContext.readOnlyRootFilesystem Whether the root filesystem is read-only
##
readOnlyRootFilesystem: false
## @param containerSecurityContext.allowPrivilegeEscalation Whether to allow privilege escalation
##
allowPrivilegeEscalation: false
## @extra containerSecurityContext.capabilities Capabilities to add/drop for the container
## @skip containerSecurityContext.capabilities.drop
##
capabilities:
drop: ["ALL"]
## @extra containerSecurityContext.seccompProfile Seccomp profile for the container
## @skip containerSecurityContext.seccompProfile.type
##
seccompProfile:
type: "RuntimeDefault"


podSecurityContext:
## @param podSecurityContext.enabled Whether to enable the pod security context
##
enabled: true
## @param podSecurityContext.fsGroupChangePolicy Policy for changing the fsGroup
##
fsGroupChangePolicy: OnRootMismatch
## @param podSecurityContext.sysctls Sysctls for the pod
##
sysctls: []
## @param podSecurityContext.supplementalGroups Supplemental groups for the pod
##
supplementalGroups: []

0 comments on commit 3506b68

Please sign in to comment.