-
Notifications
You must be signed in to change notification settings - Fork 26
update helm deploy yamls #62
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,3 +50,17 @@ Selector labels | |
| {{- printf "http://controller.%s.svc.cluster.local:8080" .Values.metadata.namespace -}} | ||
| {{ end }} | ||
| {{ end }} | ||
|
|
||
| {{- define "api-service.scheduleType" -}} | ||
| {{ if .Values.scheduleType }} | ||
| {{- .Values.scheduleType -}} | ||
| {{ else }} | ||
| {{- printf "k8s" .Values.metadata.namespace -}} | ||
| {{ end }} | ||
| {{ end }} | ||
|
|
||
| {{- define "api-service.qps" -}} | ||
| {{- if .Values.qps }}{{ printf "%v" .Values.qps }}{{ else }}{{ "10" }}{{ end }} | ||
| {{- end }} | ||
|
Comment on lines
+54
to
+64
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic in these new helper templates can be significantly simplified and made more idiomatic. The |
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,8 +48,11 @@ spec: | |
| args: | ||
| - --namespace | ||
| - {{ include "controller.sandboxNamespace" . }} | ||
| - --leader-elect | ||
| - {{ .Values.leaderElect | quote }} | ||
| {{- if .Values.leaderElect }} | ||
| - --leader-elect=true | ||
| {{- else }} | ||
| - --leader-elect=false | ||
| {{- end }} | ||
|
Comment on lines
+51
to
+55
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ports: | ||
| - name: http | ||
| containerPort: {{ .Values.service.port }} | ||
|
|
@@ -67,6 +70,9 @@ spec: | |
| periodSeconds: 5 | ||
| successThreshold: 1 | ||
| timeoutSeconds: 1 | ||
| env: | ||
| - name: SERVICE_DOMAIN_SUFFIX | ||
| value: {{ .Values.serviceDomainSuffix | quote }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The template uses value: {{ .Values.serviceDomainSuffix | default "" | quote }} |
||
| resources: | ||
| {{ toYaml .Values.resources | nindent 12 }} | ||
| {{- if .Values.podTemplates }} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,38 +35,30 @@ spec: | |
| image: {{ .Values.image }} | ||
| imagePullPolicy: {{.Values.imagePullPolicy }} | ||
| env: | ||
| - name: ACI_ACCESS | ||
| - name: OSS_ENDPOINT | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: envhub-secret | ||
| key: ACI_ACCESS | ||
| - name: ACI_SECRET | ||
| name: oss-secret | ||
| key: oss-endpoint | ||
| - name: OSS_BUCKET | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: envhub-secret | ||
| key: ACI_SECRET | ||
| {{- if .Values.oss.endpoint }} | ||
| - name: OSS_ENDPOINT | ||
| value: {{ .Values.oss.endpoint | quote }} | ||
| {{- end }} | ||
| {{- if .Values.oss.bucket }} | ||
| - name: OSS_BUCKET | ||
| value: {{ .Values.oss.bucket | quote }} | ||
| {{- end }} | ||
| name: oss-secret | ||
| key: oss-bucket | ||
| - name: OSS_KEY_PREFIX | ||
| value: {{ .Values.oss.keyPrefix | quote }} | ||
| - name: OSS_REGION | ||
| value: {{ .Values.oss.region | quote }} | ||
| - name: OSS_ACCESS_KEY_ID | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: envhub-secret | ||
| key: OSS_ACCESS_KEY_ID | ||
| name: oss-secret | ||
| key: oss-ak | ||
| - name: OSS_ACCESS_KEY_SECRET | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: envhub-secret | ||
| key: OSS_ACCESS_KEY_SECRET | ||
| name: oss-secret | ||
| key: oss-sk | ||
|
|
||
| args: | ||
| - --storage-backend | ||
|
|
@@ -79,6 +71,12 @@ spec: | |
| - {{ .Values.service.port | quote }} | ||
| - --metrics-port | ||
| - {{ .Values.service.metricsPort | quote }} | ||
| {{if .Values.deploy.templateId}} | ||
| - --template-id={{ .Values.deploy.templateId }} | ||
| {{end}} | ||
| {{if .Values.deploy.callbackURL}} | ||
| - --callback-url={{ .Values.deploy.callbackURL }} | ||
| {{end}} | ||
|
Comment on lines
+74
to
+79
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a couple of improvements to be made here for style and whitespace control. It's a Helm convention to include a space after {{- if .Values.deploy.templateId }}
- --template-id={{ .Values.deploy.templateId }}
{{- end }}
{{- if .Values.deploy.callbackURL }}
- --callback-url={{ .Values.deploy.callbackURL }}
{{- end }} |
||
| ports: | ||
| - name: http | ||
| containerPort: {{ .Values.service.port }} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,60 @@ | ||
| # 创建Secret | ||
| # 为 envhub namespace 创建 OSS secret | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: envhub-secret | ||
| name: oss-secret | ||
| namespace: {{ .Values.metadata.namespace }} | ||
| type: Opaque | ||
| data: | ||
| # base64编码的值 | ||
| ACI_ACCESS: "" | ||
| ACI_SECRET: "" | ||
| OSS_ACCESS_KEY_ID: "" | ||
| OSS_ACCESS_KEY_SECRET: "" | ||
| # OSS credentials (base64 encoded) | ||
| {{- if .Values.oss.accessKeyId }} | ||
| oss-ak: {{ .Values.oss.accessKeyId | b64enc | quote }} | ||
| {{- else }} | ||
| oss-ak: "" | ||
| {{- end }} | ||
| {{- if .Values.oss.accessKeySecret }} | ||
| oss-sk: {{ .Values.oss.accessKeySecret | b64enc | quote }} | ||
| {{- else }} | ||
| oss-sk: "" | ||
| {{- end }} | ||
| {{- if .Values.oss.endpoint }} | ||
| oss-endpoint: {{ .Values.oss.endpoint | b64enc | quote }} | ||
| {{- else }} | ||
| oss-endpoint: "" | ||
| {{- end }} | ||
| {{- if .Values.oss.bucket }} | ||
| oss-bucket: {{ .Values.oss.bucket | b64enc | quote }} | ||
| {{- else }} | ||
| oss-bucket: "" | ||
| {{- end }} | ||
| --- | ||
| # 为 aenv-sandbox namespace 创建相同的 OSS secret | ||
| # 用于 service pod 访问 OSS | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: oss-secret | ||
| namespace: {{ .Values.global.sandboxNamespace }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an inconsistency in how |
||
| type: Opaque | ||
| data: | ||
| # OSS credentials (base64 encoded) | ||
| {{- if .Values.oss.accessKeyId }} | ||
| oss-ak: {{ .Values.oss.accessKeyId | b64enc | quote }} | ||
| {{- else }} | ||
| oss-ak: "" | ||
| {{- end }} | ||
| {{- if .Values.oss.accessKeySecret }} | ||
| oss-sk: {{ .Values.oss.accessKeySecret | b64enc | quote }} | ||
| {{- else }} | ||
| oss-sk: "" | ||
| {{- end }} | ||
| {{- if .Values.oss.endpoint }} | ||
| oss-endpoint: {{ .Values.oss.endpoint | b64enc | quote }} | ||
| {{- else }} | ||
| oss-endpoint: "" | ||
| {{- end }} | ||
| {{- if .Values.oss.bucket }} | ||
| oss-bucket: {{ .Values.oss.bucket | b64enc | quote }} | ||
| {{- else }} | ||
| oss-bucket: "" | ||
| {{- end }} | ||
|
Comment on lines
+1
to
+60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file defines the same A better approach is to define a helper template in For example, in {{- define "envhub.ossSecretData" -}}
# OSS credentials (base64 encoded)
...
{{- end -}}And then in ...
data:
{{ include "envhub.ossSecretData" . | nindent 2 }}
---
...
data:
{{ include "envhub.ossSecretData" . | nindent 2 }} |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicating the
api-servicedependency introduces a maintenance risk. If the version of theapi-servicesubchart changes, it will need to be updated in two places, which is error-prone. While this is a common Helm pattern for deploying multiple instances of a subchart, it's important to be aware of this potential for inconsistency.