Closed6

helmを学ぶ

not75743not75743

勉強しよう
argocdのappで作成しながら遊んでみる

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: helm-test
  namespace: argocd
spec:
  project: default
  source:
    repoURL: '<repo>'
    targetRevision: HEAD
    path: '<path>'
    helm:
  destination:
    server: 'https://kubernetes.default.svc'
    namespace: default
  syncPolicy:
    automated:
not75743not75743

adding-a-simple-template-call

https://helm.sh/docs/chart_template_guide/getting_started/#adding-a-simple-template-call

.Release.Name

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  myvalue: "Hello World"

ローカルで確認

❯ helm template helm-test ./helm
---
# Source: helm/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-test-configmap
data:
  myvalue: "Hello World"

argocdで展開してもhelm-testが頭にくっついた
app名が.Release.Nameで指定される?

not75743not75743

Values Files

https://helm.sh/docs/chart_template_guide/values_files/

ファイル構成

├── helm
│   ├── Chart.yaml
│   ├── templates
│   │   └── configmap.yaml
│   ├── values.yaml # 変数1
│   └── values2.yaml  # 変数2
└── helm-test.yaml

ローカルで確認

-f <valueファイル>で使う変数ファイルを設定

### values.yaml
❯ helm template helm-test ./helm -f ./helm/values.yaml
---
# Source: helm/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-test-configmap
data:
  myvalue: "Hello World"
  drink: coffee

### values2.yaml
❯ helm template helm-test ./helm -f ./helm/values2.yaml
---
# Source: helm/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-test-configmap
data:
  myvalue: "Hello World"
  drink: tea

argocd

spec:
  project: default
  source:
    repoURL: '<repo>'
    targetRevision: HEAD
    path: '<path>'
    helm:
      valueFiles:
        - values.yaml
このスクラップは4ヶ月前にクローズされました