-
Notifications
You must be signed in to change notification settings - Fork 10
Metrics Deployment #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Metrics Deployment #401
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
af2117a
feat(helm): updated skaha helm chart to include the service, rbac for…
shinybrar 1345968
fix(skaha): gate metrics Kueue RBAC with rbac.create, not enabled alone
shinybrar 5a3f687
fix(skaha): default metrics-backend.rbac.create to false
shinybrar a8528c4
revert(skaha): restore metrics rbac.create default true
shinybrar 0b819f1
refactor(skaha): metricsBackend values key, single enabled gate
shinybrar 955e7ad
docs(skaha): helm-docs via pre-commit; install ordering in README.gotmpl
shinybrar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
77 changes: 77 additions & 0 deletions
77
helm/applications/skaha/templates/metricsBackend-deployment.yaml
This file contains hidden or 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,77 @@ | ||
| {{- $mb := .Values.metricsBackend | default dict }} | ||
| {{- if (default false $mb.enabled) }} | ||
| {{- $img := $mb.image | default dict }} | ||
| {{- $customEnv := $mb.env | default dict }} | ||
| {{- $redis := $mb.redis | default dict }} | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{ include "skaha.metricsBackend.deploymentName" . }} | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "skaha.metricsBackend.labels" . | nindent 4 }} | ||
| spec: | ||
| replicas: {{ $mb.replicaCount | default 1 }} | ||
| revisionHistoryLimit: {{ $mb.revisionHistoryLimit | default 3 }} | ||
| selector: | ||
| matchLabels: | ||
| {{- include "skaha.metricsBackend.selectorLabels" . | nindent 6 }} | ||
| template: | ||
| metadata: | ||
| labels: | ||
| {{- include "skaha.metricsBackend.selectorLabels" . | nindent 8 }} | ||
| spec: | ||
| serviceAccountName: {{ .Values.deployment.skaha.serviceAccountName }} | ||
| automountServiceAccountToken: true | ||
| securityContext: | ||
| runAsNonRoot: true | ||
| runAsUser: 65532 | ||
| fsGroup: 65532 | ||
| containers: | ||
| - name: metrics-api | ||
| image: "{{ $img.repository }}:{{ $img.tag | default "v0.1.4" }}" | ||
| imagePullPolicy: {{ $img.pullPolicy | default "IfNotPresent" }} | ||
| ports: | ||
| - name: http | ||
| containerPort: 8000 | ||
| protocol: TCP | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| capabilities: | ||
| drop: | ||
| - ALL | ||
| env: | ||
| {{- if and (default true $redis.enabled) (not (hasKey $customEnv "METRICS_REDIS_URL")) }} | ||
| - name: METRICS_REDIS_URL | ||
| value: {{ include "skaha.metricsBackend.chartRedisURL" . | quote }} | ||
| {{- end }} | ||
| {{- range $k, $v := $customEnv }} | ||
| - name: {{ $k }} | ||
| value: {{ $v | quote }} | ||
| {{- end }} | ||
| startupProbe: | ||
| httpGet: | ||
| path: /healthz | ||
| port: http | ||
| failureThreshold: 40 | ||
| periodSeconds: 3 | ||
| timeoutSeconds: 3 | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /healthz | ||
| port: http | ||
| initialDelaySeconds: 0 | ||
| periodSeconds: 20 | ||
| timeoutSeconds: 5 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /healthz | ||
| port: http | ||
| initialDelaySeconds: 0 | ||
| periodSeconds: 10 | ||
| timeoutSeconds: 3 | ||
| {{- with $mb.resources }} | ||
| resources: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| {{- end }} |
34 changes: 34 additions & 0 deletions
34
helm/applications/skaha/templates/metricsBackend-rbac.yaml
This file contains hidden or 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,34 @@ | ||
| {{- $mb := .Values.metricsBackend | default dict }} | ||
| {{- if (default false $mb.enabled) }} | ||
| {{/* | ||
| Kueue read ClusterRole / ClusterRoleBinding. With metricsBackend.enabled Helm renders these | ||
| before the metrics Deployment and Service (Helm builtin kind install order applies RBAC before | ||
| typical workload kinds). Apply failures (for example forbidden cluster RBAC) fail the release | ||
| before those workload resources reconcile. | ||
| */}} | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: {{ include "skaha.metricsBackend.clusterRoleName" . }} | ||
| labels: | ||
| {{- include "skaha.metricsBackend.labels" . | nindent 4 }} | ||
| rules: | ||
| - apiGroups: ["kueue.x-k8s.io"] | ||
| resources: ["clusterqueues", "cohorts"] | ||
| verbs: ["get", "list"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: {{ include "skaha.metricsBackend.clusterRoleName" . }} | ||
| labels: | ||
| {{- include "skaha.metricsBackend.labels" . | nindent 4 }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: {{ include "skaha.metricsBackend.clusterRoleName" . }} | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ .Values.deployment.skaha.serviceAccountName }} | ||
| namespace: {{ .Release.Namespace }} | ||
| {{- end }} |
19 changes: 19 additions & 0 deletions
19
helm/applications/skaha/templates/metricsBackend-service.yaml
This file contains hidden or 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,19 @@ | ||
| {{- $mb := .Values.metricsBackend | default dict }} | ||
| {{- if (default false $mb.enabled) }} | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: {{ include "skaha.metricsBackend.serviceName" . }} | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "skaha.metricsBackend.labels" . | nindent 4 }} | ||
| spec: | ||
| type: ClusterIP | ||
| selector: | ||
| {{- include "skaha.metricsBackend.selectorLabels" . | nindent 4 }} | ||
| ports: | ||
| - name: http | ||
| port: 8000 | ||
| targetPort: http | ||
| protocol: TCP | ||
| {{- end }} |
This file contains hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
helm/applications/skaha/templates/tests/test-metricsBackend.yaml
This file contains hidden or 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 @@ | ||
| {{- $mb := .Values.metricsBackend | default dict }} | ||
| {{- $test := $mb.test | default dict }} | ||
| {{- if and (default false $mb.enabled) (default true $test.enabled) }} | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: {{ include "skaha.fullname" . }}-metrics-backend-test | ||
| labels: | ||
| {{- include "skaha.labels" . | nindent 4 }} | ||
| annotations: | ||
| helm.sh/hook: test | ||
| helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded | ||
| spec: | ||
| containers: | ||
| - name: wget | ||
| image: {{ $test.image | default "busybox:1.37.0" }} | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - | | ||
| set -e | ||
| url="http://{{ include "skaha.metricsBackend.serviceName" . }}.{{ .Release.Namespace }}.svc.{{ .Values.kubernetesClusterDomain }}:8000/healthz" | ||
| max={{ $test.maxWaitSeconds | default 180 }} | ||
| i=0 | ||
| while [ "$i" -lt "$max" ]; do | ||
| if wget -q -T 3 -O /dev/null "$url" 2>/dev/null; then | ||
| echo "metricsBackend health check ok" | ||
| exit 0 | ||
| fi | ||
| i=$((i+1)) | ||
| sleep 1 | ||
| done | ||
| echo "metricsBackend health check failed after ${max}s" >&2 | ||
| exit 1 | ||
| restartPolicy: Never | ||
| {{- end }} |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.