Skip to content
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

[CI] Publish truefoundry to version 0.4.19-rc.8 #587

Closed
wants to merge 2 commits into from
Closed
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
6 changes: 3 additions & 3 deletions charts/truefoundry/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies:
- name: tfy-configs
repository: https://truefoundry.github.io/infra-charts
version: 0.1.0
version: 0.1.1
- name: nats
repository: https://nats-io.github.io/k8s/helm/charts/
version: 0.19.1
Expand All @@ -11,5 +11,5 @@ dependencies:
- name: tfy-buildkitd-service
repository: https://truefoundry.github.io/infra-charts/
version: 0.1.3
digest: sha256:08ccf5bebe5b9e4abc4121510d7a0fb9473a62ac06e497f06a31ee692863859d
generated: "2024-08-29T17:36:47.356247+05:30"
digest: sha256:d434b314a2f7f7f0398b591f951b7af06f5f6769f1d05ed581d36e3da704b9f4
generated: "2024-09-05T12:08:47.713039+05:30"
4 changes: 2 additions & 2 deletions charts/truefoundry/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: v2
name: truefoundry
version: 0.4.19-rc.1
version: 0.4.19-rc.8
description: "Truefoundry applications"
maintainers:
- name: truefoundry
dependencies:
- condition: servicefoundryServer.enabled
name: tfy-configs
repository: https://truefoundry.github.io/infra-charts
version: 0.1.0
version: 0.1.1
- condition: nats.enabled
name: nats
repository: https://nats-io.github.io/k8s/helm/charts/
Expand Down
935 changes: 650 additions & 285 deletions charts/truefoundry/README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions charts/truefoundry/templates/bootstrap/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{/*
Merge default nodeSelector with nodeSelector specified in truefoundryBootstrap nodeSelector
*/}}
{{- define "truefoundry-bootstrap.nodeSelector" -}}
{{- $defaultNodeSelector := dict "kubernetes.io/arch" "amd64" }}
{{- $mergedNodeSelector := merge $defaultNodeSelector .Values.truefoundryBootstrap.nodeSelector }}
{{- toYaml $mergedNodeSelector }}
{{- end }}
9 changes: 4 additions & 5 deletions charts/truefoundry/templates/bootstrap/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ spec:
{{- toYaml .Values.truefoundryBootstrap.extraVolumes | nindent 6 }}
{{- end }}
restartPolicy: Never
{{- with .Values.truefoundryBootstrap.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.truefoundryBootstrap.affinity }}
{{- include "truefoundry-bootstrap.nodeSelector" . | nindent 8 }}
{{- $mergedAffinity := dict | merge .Values.truefoundryBootstrap.affinity .Values.global.affinity }}
{{- if $mergedAffinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- toYaml $mergedAffinity | nindent 8 }}
{{- end }}
tolerations:
{{- .Values.global.tolerations | toYaml | nindent 8 }}
Expand Down
9 changes: 9 additions & 0 deletions charts/truefoundry/templates/mlfoundry-server/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Merge nodeSelector
*/}}
{{- define "mlfoundry-server.nodeSelector" -}}
{{- $defaultNodeSelector := dict "kubernetes.io/arch" "amd64" }}
{{- $mergedNodeSelector := merge $defaultNodeSelector .Values.mlfoundryServer.nodeSelector }}
{{- toYaml $mergedNodeSelector }}
{{- end }}
9 changes: 4 additions & 5 deletions charts/truefoundry/templates/mlfoundry-server/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@ spec:
{{- end }}
volumes:
{{- toYaml .Values.mlfoundryServer.extraVolumes | nindent 8 }}
{{- with .Values.mlfoundryServer.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.mlfoundryServer.affinity }}
{{- include "mlfoundry-server.nodeSelector" . | nindent 8 }}
{{- $mergedAffinity := dict | merge .Values.mlfoundryServer.affinity .Values.global.affinity }}
{{- if $mergedAffinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- toYaml $mergedAffinity | nindent 8 }}
{{- end }}
{{- with .Values.mlfoundryServer.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- $volumeMounts | toYaml -}}
{{- end -}}

{{/*
Merge default nodeSelector with nodeSelector specified in servicefoundry-server nodeSelector
*/}}
{{- define "servicefoundry-server.nodeSelector" -}}
{{- $defaultNodeSelector := dict "kubernetes.io/arch" "amd64" }}
{{- $mergedNodeSelector := merge $defaultNodeSelector .Values.servicefoundryServer.nodeSelector }}
{{- toYaml $mergedNodeSelector }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@ spec:
{{- end }}
volumes:
{{- include "servicefoundry-server.volumes" . | nindent 8 }}
{{- with .Values.servicefoundryServer.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.servicefoundryServer.affinity }}
{{- include "servicefoundry-server.nodeSelector" . | nindent 8 }}
{{- $mergedAffinity := dict | merge .Values.servicefoundryServer.affinity .Values.global.affinity }}
{{- if $mergedAffinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- toYaml $mergedAffinity | nindent 8 }}
{{- end }}
{{- with .Values.servicefoundryServer.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Merge nodeSelector
*/}}
{{- define "sfy-manifest-service.nodeSelector" -}}
{{- $defaultNodeSelector := dict "kubernetes.io/arch" "amd64" }}
{{- $mergedNodeSelector := merge $defaultNodeSelector .Values.sfyManifestService.nodeSelector }}
{{- toYaml $mergedNodeSelector }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ spec:
{{- end }}
volumes:
{{- toYaml .Values.sfyManifestService.extraVolumes | nindent 8 }}
{{- with .Values.sfyManifestService.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.sfyManifestService.affinity }}
{{- include "servicefoundry-server.nodeSelector" . | nindent 8 }}
{{- $mergedAffinity := dict | merge .Values.servicefoundryServer.affinity .Values.global.affinity }}
{{- if $mergedAffinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- toYaml $mergedAffinity | nindent 8 }}
{{- end }}
{{- with .Values.sfyManifestService.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
18 changes: 18 additions & 0 deletions charts/truefoundry/templates/tfy-build/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,21 @@ Expand the name of the chart.
{{- define "tfy-build.serviceAccountName" -}}
{{- default (include "tfy-build.fullname" .) "tfy-build" }}
{{- end }}

{{/*
Merge default nodeSelector with nodeSelector specified in tfy-build.nodeSelector
*/}}
{{- define "tfy-build.nodeSelector" -}}
{{- $defaultNodeSelector := dict "kubernetes.io/arch" "amd64" }}
{{- $mergedNodeSelector := merge $defaultNodeSelector .Values.tfyBuild.truefoundryWorkflows.nodeSelector }}
{{- toYaml $mergedNodeSelector }}
{{- end }}

{{/*
Merge default nodeSelector with nodeSelector specified in tfy-buildkitd.nodeSelector
*/}}
{{- define "tfy-buildkitd.nodeSelector" -}}
{{- $defaultNodeSelector := dict "kubernetes.io/arch" "amd64" }}
{{- $mergedNodeSelector := merge $defaultNodeSelector .Values.tfyBuild.truefoundryWorkflows.buildkitd.nodeSelector }}
{{- toYaml $mergedNodeSelector }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ spec:
- name: dockerTag
- name: buildkitServiceURL
steps:
{{- if .Values.tfyBuild.truefoundryWorkflows.preBuild.enabled }}
- - name: pre-build-script
template: pre-build-script
arguments:
parameters:
- name: buildSource
value: "{{`{{inputs.parameters.buildSource}}`}}"
- name: buildConfig
value: "{{`{{inputs.parameters.buildConfig}}`}}"
- name: dockerRegistryURL
value: "{{`{{inputs.parameters.dockerRegistryURL}}`}}"
- name: dockerRegistryUsername
value: "{{`{{inputs.parameters.dockerRegistryUsername}}`}}"
- name: dockerRegistryPassword
value: "{{`{{inputs.parameters.dockerRegistryPassword}}`}}"
- name: dockerRepo
value: "{{`{{inputs.parameters.dockerRepo}}`}}"
- name: dockerTag
value: "{{`{{inputs.parameters.dockerTag}}`}}"
{{- end }}
- - name: build-and-push
template: build-and-push
arguments:
Expand All @@ -56,6 +76,57 @@ spec:
value: "{{`{{inputs.parameters.dockerTag}}`}}"
- name: buildkitServiceURL
value: "127.0.0.1:1234"
{{- if .Values.tfyBuild.truefoundryWorkflows.postBuild.enabled }}
- - name: post-build-script
template: post-build-script
arguments:
parameters:
- name: buildSource
value: "{{`{{inputs.parameters.buildSource}}`}}"
- name: buildConfig
value: "{{`{{inputs.parameters.buildConfig}}`}}"
- name: dockerRegistryURL
value: "{{`{{inputs.parameters.dockerRegistryURL}}`}}"
- name: dockerRegistryUsername
value: "{{`{{inputs.parameters.dockerRegistryUsername}}`}}"
- name: dockerRegistryPassword
value: "{{`{{inputs.parameters.dockerRegistryPassword}}`}}"
- name: dockerRepo
value: "{{`{{inputs.parameters.dockerRepo}}`}}"
- name: dockerTag
value: "{{`{{inputs.parameters.dockerTag}}`}}"
{{- end }}
{{- if .Values.tfyBuild.truefoundryWorkflows.preBuild.enabled }}
- name: pre-build-script
inputs:
parameters:
- name: buildSource
- name: buildConfig
- name: dockerRegistryURL
- name: dockerRegistryUsername
- name: dockerRegistryPassword
- name: dockerRepo
- name: dockerTag
when: {{ .Values.tfyBuild.truefoundryWorkflows.preBuild.enabled }}
activeDeadlineSeconds: 5400
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: 'false'
karpenter.sh/do-not-disrupt: 'true'
karpenter.sh/do-not-evict: 'true'
{{- with .Values.tfyBuild.truefoundryWorkflows.preBuild.resources }}
podSpecPatch: |
containers:
- name: main
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
script:
image: {{ .Values.tfyBuild.truefoundryWorkflows.preBuild.image.repository }}:{{ .Values.tfyBuild.truefoundryWorkflows.preBuild.image.tag }}
command: {{ .Values.tfyBuild.truefoundryWorkflows.preBuild.command }}
source: |
{{ .Values.tfyBuild.truefoundryWorkflows.preBuild.script | nindent 8 }}
{{- end }}
- name: build-and-push
# activeDeadlineSeconds is the maximum time the step will run(It will be restarted after every retry)
activeDeadlineSeconds: 5400
Expand Down Expand Up @@ -295,6 +366,41 @@ spec:
- buildctl
- debug
- workers
{{- if .Values.tfyBuild.truefoundryWorkflows.postBuild.enabled }}
- name: post-build-script
inputs:
parameters:
- name: buildSource
- name: buildConfig
- name: dockerRegistryURL
- name: dockerRegistryUsername
- name: dockerRegistryPassword
- name: dockerRepo
- name: dockerTag
when: >-
'{{ .Values.tfyBuild.truefoundryWorkflows.postBuild.enabled }}' == 'true'
&&
{{`{{steps.build-and-push.status}}`}} == Succeeded
# activeDeadlineSeconds is the maximum time the step will run(It will be restarted after every retry)
activeDeadlineSeconds: 5400
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: 'false'
karpenter.sh/do-not-disrupt: 'true'
karpenter.sh/do-not-evict: 'true'
{{- with .Values.tfyBuild.truefoundryWorkflows.postBuild.resources }}
podSpecPatch: |
containers:
- name: main
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
script:
image: {{ .Values.tfyBuild.truefoundryWorkflows.postBuild.image.repository }}:{{ .Values.tfyBuild.truefoundryWorkflows.postBuild.image.tag }}
command: {{ .Values.tfyBuild.truefoundryWorkflows.postBuild.command }}
source: |
{{ .Values.tfyBuild.truefoundryWorkflows.postBuild.script | nindent 8 }}
{{- end }}
- name: exit-handler
inputs:
parameters:
Expand Down Expand Up @@ -558,9 +664,17 @@ spec:
REPOSITORY="{{`{{inputs.parameters.dockerRepo}}`}}"
TAG="{{`{{inputs.parameters.dockerTag}}`}}"
IMAGE=$REGISTRY/$REPOSITORY:$TAG
IMAGE_SIZE_THRESHOLD=$(printf '%.0f' {{ .Values.tfyBuild.truefoundryWorkflows.sociIndexBuildAndPush.imageSizeThresholdBytes | quote }})

docker login -u $USERNAME -p $PASSWORD $REGISTRY 2> /dev/null
IMAGE_SIZE_THRESHOLD=$(printf '%.0f' {{ .Values.tfyBuild.truefoundryWorkflows.sociIndexBuildAndPush.imageSizeThresholdBytes | int | quote }})

# if $REGISTRY starts with "index.docker.io" or "registry-1.docker.io" or "registry.hub.docker.com" or "docker.io"
# then skip mentioning url in docker login, because dockerhub has non standard behaviors
# This is a short term fix till we decouple registry url and login url
_REGISTRY=$(echo $REGISTRY | sed -e 's~http[s]*://~~g')
if [[ $_REGISTRY == index.docker.io* ]] || [[ $_REGISTRY == registry-1.docker.io* ]] || [[ $_REGISTRY == registry.hub.docker.com* ]] || [[ $_REGISTRY == docker.io* ]]; then
docker login -u $USERNAME -p $PASSWORD 2> /dev/null
else
docker login -u $USERNAME -p $PASSWORD $REGISTRY 2> /dev/null
fi

echo Registry is $REGISTRY

Expand Down Expand Up @@ -679,13 +793,12 @@ spec:
time soci push --platform=linux/amd64 $IMAGE

echo Done!
{{- with .Values.tfyBuild.truefoundryWorkflows.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.tfyBuild.truefoundryWorkflows.affinity }}
{{- include "tfy-build.nodeSelector" . | nindent 8 }}
{{- $mergedAffinity := dict | merge .Values.tfyBuild.truefoundryWorkflows.affinity .Values.global.affinity }}
{{- if $mergedAffinity }}
affinity:
{{- toYaml . | nindent 4 }}
{{- toYaml $mergedAffinity | nindent 8 }}
{{- end }}
{{- with .Values.tfyBuild.truefoundryWorkflows.tolerations }}
tolerations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.tfyBuild.truefoundryWorkflows.buildkitd.resources | nindent 12 }}
{{- with .Values.tfyBuild.truefoundryWorkflows.buildkitd.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tfyBuild.truefoundryWorkflows.buildkitd.affinity }}
{{- include "tfy-buildkitd.nodeSelector" . | nindent 8 }}
{{- $mergedAffinity := dict | merge .Values.tfyBuild.truefoundryWorkflows.buildkitd.affinity .Values.global.affinity }}
{{- if $mergedAffinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- toYaml $mergedAffinity | nindent 8 }}
{{- end }}
{{- with .Values.tfyBuild.truefoundryWorkflows.buildkitd.tolerations }}
tolerations:
Expand Down
9 changes: 9 additions & 0 deletions charts/truefoundry/templates/tfy-controller/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Merge default nodeSelector with nodeSelector specified in tfyController nodeSelector
*/}}
{{- define "tfy-controller.nodeSelector" -}}
{{- $defaultNodeSelector := dict "kubernetes.io/arch" "amd64" }}
{{- $mergedNodeSelector := merge $defaultNodeSelector .Values.tfyController.nodeSelector }}
{{- toYaml $mergedNodeSelector }}
{{- end }}
9 changes: 4 additions & 5 deletions charts/truefoundry/templates/tfy-controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ spec:
imagePullSecrets:
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with .Values.tfyController.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tfyController.affinity }}
{{- include "tfy-controller.nodeSelector" . | nindent 8 }}
{{- $mergedAffinity := dict | merge .Values.tfyController.affinity .Values.global.affinity }}
{{- if $mergedAffinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- toYaml $mergedAffinity | nindent 8 }}
{{- end }}
tolerations:
{{- .Values.global.tolerations | toYaml | nindent 8 }}
Expand Down
Loading