Skip to content

Commit

Permalink
chart: repo over
Browse files Browse the repository at this point in the history
Signed-off-by: weizhoublue <[email protected]>
  • Loading branch information
weizhoublue committed Dec 25, 2024
1 parent 4d13ad6 commit 067af7c
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 7 deletions.
44 changes: 44 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,47 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
return the controller image
*/}}
{{- define "bmc-operator.controller.image" -}}
{{- $registryName := .Values.image.registry -}}
{{- $repositoryName := .Values.image.repository -}}
{{- if .Values.global.imageRegistryOverride }}
{{- printf "%s/%s" .Values.global.imageRegistryOverride $repositoryName -}}
{{- else -}}
{{- printf "%s/%s" $registryName $repositoryName -}}
{{- end -}}
{{- if .Values.image.digest }}
{{- print "@" .Values.image.digest -}}
{{- else if .Values.global.imageTagOverride -}}
{{- printf ":%s" .Values.global.imageTagOverride -}}
{{- else if .Values.image.tag -}}
{{- printf ":%s" .Values.image.tag -}}
{{- else -}}
{{- printf ":v%s" .Chart.AppVersion -}}
{{- end -}}
{{- end -}}

{{/*
return the agent image
*/}}
{{- define "bmc-operator.agent.image" -}}
{{- $registryName := .Values.clusterAgent.agentYaml.image.registry -}}
{{- $repositoryName := .Values.clusterAgent.agentYaml.image.repository -}}
{{- if .Values.global.imageRegistryOverride }}
{{- printf "%s/%s" .Values.global.imageRegistryOverride $repositoryName -}}
{{- else -}}
{{- printf "%s/%s" $registryName $repositoryName -}}
{{- end -}}
{{- if .Values.clusterAgent.agentYaml.image.digest }}
{{- print "@" .Values.clusterAgent.agentYaml.image.digest -}}
{{- else if .Values.global.imageTagOverride -}}
{{- printf ":%s" .Values.global.imageTagOverride -}}
{{- else if .Values.clusterAgent.agentYaml.image.tag -}}
{{- printf ":%s" .Values.clusterAgent.agentYaml.image.tag -}}
{{- else -}}
{{- printf ":v%s" .Chart.AppVersion -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion chart/templates/clusteragent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
spec:
agentYaml:
replicas: {{ .Values.clusterAgent.agentYaml.replicas }}
image: "{{ .Values.clusterAgent.agentYaml.image.repository }}:{{ default .Chart.Version .Values.clusterAgent.agentYaml.image.tag }}"
image: "{{ include "bmc-operator.agent.image" . }}"
underlayInterface: "{{ .Values.clusterAgent.agentYaml.underlayInterface }}"
{{- with .Values.clusterAgent.agentYaml.nodeAffinity }}
nodeAffinity:
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ default .Chart.Version .Values.image.tag }}"
image: {{ include "bmc-operator.controller.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --metrics-bind-address=:{{ .Values.webhook.metricsPort }}
Expand All @@ -39,7 +39,7 @@ spec:
- --leader-elect
env:
- name: AGENT_IMAGE
value: "{{ .Values.clusterAgent.agentYaml.image.repository }}:{{ default .Chart.Version .Values.clusterAgent.agentYaml.image.tag }}"
value: {{ include "bmc-operator.agent.image" . }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
Expand Down
17 changes: 15 additions & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ replicaCount: 1
logLevel: "debug"

image:
repository: ghcr.io/spidernet-io/bmc-controller
registry: "ghcr.io"
repository: "spidernet-io/bmc-controller"
pullPolicy: IfNotPresent
# tag will be overridden by version from Chart.yaml
tag: ""
# Optional: image digest
digest: ""
resources:
limits:
cpu: 500m
Expand All @@ -22,10 +25,13 @@ securityContext: {}
clusterAgent:
agentYaml:
image:
repository: ghcr.io/spidernet-io/bmc-agent
registry: "ghcr.io"
repository: "spidernet-io/bmc-agent"
pullPolicy: IfNotPresent
# tag will be overridden by version from Chart.yaml
tag: ""
# Optional: image digest
digest: ""
# Optional: network interface configuration
underlayInterface: ""
# Optional: Use host network for agent pods
Expand Down Expand Up @@ -139,3 +145,10 @@ nodeSelector: {}
tolerations: []

affinity: {}

# Global configuration
global:
# Override image registry for all images
imageRegistryOverride: ""
# Override image tag for all images
imageTagOverride: ""
2 changes: 0 additions & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ deploy:
--namespace bmc \
--create-namespace \
--wait \
--set image.repository=$(CONTROLLER_IMAGE) \
--set image.tag=$(VERSION) \
--set clusterAgent.agentYaml.image.repository=$(AGENT_IMAGE) \
--set clusterAgent.agentYaml.image.tag=$(VERSION) \
--set clusterAgent.endpoint.https=false \
--set clusterAgent.agentYaml.hostNetwork=false \
Expand Down

0 comments on commit 067af7c

Please sign in to comment.