-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract statefulset-runner to a standalone deployment
- Loading branch information
Showing
16 changed files
with
330 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: statefulset-runner | ||
name: statefulset-runner-controller-manager | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
replicas: {{ .Values.statefulsetRunner.replicas }} | ||
selector: | ||
matchLabels: | ||
app: statefulset-runner | ||
template: | ||
metadata: | ||
annotations: | ||
kubectl.kubernetes.io/default-container: manager | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "8080" | ||
prometheus.io/scrape: "true" | ||
labels: | ||
app: statefulset-runner | ||
spec: | ||
containers: | ||
- name: manager | ||
image: {{ .Values.statefulsetRunner.image }} | ||
{{- if .Values.debug }} | ||
command: | ||
- "/dlv" | ||
args: | ||
- "--listen=:40000" | ||
- "--headless=true" | ||
- "--api-version=2" | ||
- "exec" | ||
- "/manager" | ||
- "--continue" | ||
- "--accept-multiclient" | ||
- "--" | ||
- "--health-probe-bind-address=:8081" | ||
- "--leader-elect" | ||
{{- else }} | ||
args: | ||
- --health-probe-bind-address=:8081 | ||
- --leader-elect | ||
{{- end }} | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 8081 | ||
initialDelaySeconds: 15 | ||
periodSeconds: 20 | ||
ports: | ||
- containerPort: 8080 | ||
name: metrics | ||
protocol: TCP | ||
resources: | ||
{{- .Values.statefulsetRunner.resources | toYaml | nindent 10 }} | ||
{{- include "korifi.securityContext" . | indent 8 }} | ||
{{- include "korifi.podSecurityContext" . | indent 6 }} | ||
serviceAccountName: statefulset-runner-controller-manager | ||
{{- if .Values.statefulsetRunner.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml .Values.statefulsetRunner.nodeSelector | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.statefulsetRunner.tolerations }} | ||
tolerations: | ||
{{- toYaml .Values.statefulsetRunner.tolerations | nindent 8 }} | ||
{{- end }} | ||
terminationGracePeriodSeconds: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: statefulset-runner-controller-manager | ||
namespace: {{ .Release.Namespace }} | ||
imagePullSecrets: | ||
{{- range .Values.systemImagePullSecrets }} | ||
- name: {{ . | quote }} | ||
{{- end }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: statefulset-runner-leader-election-rolebinding | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: korifi-controllers-leader-election-role | ||
subjects: | ||
- kind: ServiceAccount | ||
name: statefulset-runner-controller-manager | ||
namespace: {{ .Release.Namespace }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: statefulset-runner-manager-rolebinding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: korifi-statefulset-runner-appworkload-manager-role | ||
subjects: | ||
- kind: ServiceAccount | ||
name: statefulset-runner-controller-manager | ||
namespace: {{ .Release.Namespace }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
{{- if .Values.debug }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: statefulset-runner-debug-port | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
ports: | ||
- name: debug-30055 | ||
nodePort: 30055 | ||
port: 30055 | ||
protocol: TCP | ||
targetPort: 40000 | ||
selector: | ||
app: statefulset-runner | ||
type: NodePort | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# syntax = docker/dockerfile:experimental | ||
FROM golang:1.23 as builder | ||
|
||
ARG version=dev | ||
|
||
WORKDIR /workspace | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN --mount=type=cache,target=/go/pkg/mod \ | ||
go mod download | ||
|
||
COPY api api | ||
COPY controllers controllers | ||
COPY statefulset-runner statefulset-runner | ||
COPY model model | ||
COPY tools tools | ||
COPY version version | ||
|
||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=cache,target=/go/pkg/mod \ | ||
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X code.cloudfoundry.org/korifi/version.Version=${version}" -o manager statefulset-runner/main.go | ||
|
||
# Use distroless as minimal base image to package the manager binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:nonroot | ||
|
||
WORKDIR / | ||
COPY --from=builder /workspace/manager . | ||
USER 65532:65532 | ||
|
||
ENTRYPOINT ["/manager"] |
Oops, something went wrong.