Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
fix: namespace inconsistency (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
YkeLit authored Mar 5, 2024
1 parent 9f4ae3f commit e0aa0a0
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: A Helm chart template for byzanteam application
# chart 类型
type: application
# chart 版本
version: 1.3.0
version: 1.3.1
# 项目源码的URL列表
sources:
- https://github.com/Byzanteam/application-chart-template/
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ A Helm chart template for byzanteam application
| imageCredentials | object | `{}` | |
| initContainers | list | `[]` | |
| nameOverride | string | `""` | |
| namespace | string | `"default"` | |
| replicaCount | int | `1` | |
| restartPolicy | string | `"Always"` | |
| service.name | string | `"http"` | |
Expand Down
2 changes: 1 addition & 1 deletion templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Selector labels
{{- define "application-chart-template.selectorLabels" -}}
app.kubernetes.io/name: {{ include "application-chart-template.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/namespace: {{ .Values.namespace }}
app.kubernetes.io/namespace: {{ .Release.Namespace }}
{{- end }}

{{/*
Expand Down
2 changes: 1 addition & 1 deletion templates/configMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ metadata:
labels:
{{- include "application-chart-template.labels" . | nindent 4 }}
name: {{ include "application-chart-template.fullname" . }}-env
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
data:
{{- .Values.env | toYaml | nindent 2 }}
2 changes: 1 addition & 1 deletion templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: {{ include "application-chart-template.fullname" . }}
labels:
{{- include "application-chart-template.labels" . | nindent 4 }}
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
Expand Down
2 changes: 1 addition & 1 deletion templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: {{ include "application-chart-template.fullname" . }}
labels:
{{- include "application-chart-template.labels" . | nindent 4 }}
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
9 changes: 4 additions & 5 deletions tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,27 @@ tests:
- isKind:
of: Deployment

- it: should set name and namespace label to nameOverride and namespace if no override is set
- it: should set name label to nameOverride if no override is set
asserts:
- isSubset:
path: spec.selector
content:
matchLabels:
app.kubernetes.io/name: application-chart-template
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/namespace: default
app.kubernetes.io/namespace: NAMESPACE

- it: should set name and namespace label to nameOverride and namespace if set
- it: should set name label to nameOverride if set
set:
nameOverride: unittest
namespace: unittest
asserts:
- isSubset:
path: spec.selector
content:
matchLabels:
app.kubernetes.io/name: unittest
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/namespace: unittest
app.kubernetes.io/namespace: NAMESPACE

- it: should change image when image value is specified
values:
Expand Down
3 changes: 0 additions & 3 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
nameOverride: ""
fullnameOverride: ""

# 设置 chart 的 namespace
namespace: default

# 设置此 Pod 的副本数
replicaCount: 1

Expand Down

0 comments on commit e0aa0a0

Please sign in to comment.