Links tham khảo
https://medium.com/dzerolabs/turbocharge-argocd-with-app-of-apps-pattern-and-kustomized-helm-ea4993190e7c
Và nếu bạn lười đọc bài trên thì đọc bài của mình.

Từ trước đến giờ thì các App của mình thì nó show hết trên web và khá là rời rạc

vậy giờ làm sao.

Đây là helm chart appcation Argocd nhé.
1) Simple tutorial
Link helm chart ở dưới, nếu bạn biết helm rồi khá dễ hiểu
https://github.com/mrnim94/argocd-example-apps
Các đầu tiên tạo bằng UI




Nhiều ảnh chứ click nhanh lắm. Create thôi.
Cách 2: viết file yaml và apply
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: root-app
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
destination:
namespace: default
name: in-cluster
project: default
source:
path: apps
repoURL: https://github.com/argoproj/argocd-example-apps
targetRevision: HEAD
Rồi dùng kubectl apply -f ….

Giờ bạn thử sync 1 app con





2) Practice – step by step (Mon 13 Dec 2021)
Mình sẽ tạo 1 folder: addons-istio-multi-cluster và trong này chứa các folder và file như ảnh:

prometheus-multi-app.yaml: để dẫn vào chart app argocd, nó được design như helm ấy
>>>>kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: argocd
resources:
- prometheus-multi-app.yaml
file kustomization.yaml bảo với argocd là mày vào đọc file và apply file prometheus-multi-app.yaml
>>>>>prometheus-multi-app.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: prometheus-config
namespace: argocd ##namepace này là nơi apply application argocd
labels:
type: root-app
spec:
destination:
namespace: argocd ##namepace này là nơi apply chart of argocd
name: in-cluster
project: default
source:
path: tiki/addons-istio-multi-cluster/app
repoURL: https://gitlab.nimtechnology.com/nim/manifest-k8s
targetRevision: HEAD
Giờ khám phá folder app có j?

templates: Bộ sương của file manifest được gen ra
Chart.yaml và values.yaml: nó thêm data vào template.
>>>>>Chart.yaml
apiVersion: v2
name: prometheus ##trong file này mình chỉ khuyên bạn change chỗ này thôi he!!!
description: Applications
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0"
chúng ta sẽ đi vào file template trước
>>template(folder)
>>>>cluster.yaml
{{- range .Values.spec.destinations }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: app-prometheus-{{ .name }}
namespace: argocd
spec:
{{- if eq .autoSync "yes" }}
syncPolicy:
automated: {}
{{- end }}
destination:
name: {{ .argoClusterName }}
namespace: {{ .argoNamespace }}
project: default
source:
{{- if .argoPath }}
path: {{ .argoPath }}
{{- else }}
path: production/{{ .argoClusterName }}/{{ .argoNamespace }}
{{- end }}
repoURL: {{ $.Values.spec.source.repoURL }}
targetRevision: {{ $.Values.spec.source.targetRevision }}
---
{{- end }}
Giờ chúng ta đến file value.yaml nó đưa data vào trong template
>>>>values.yaml
# Default values for app.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
spec:
source:
repoURL: https://gitlab.nimtechnology.com/nim/manifest-k8s
targetRevision: HEAD
destinations:
- name: "istio-1.12.0-addons"
autoSync: "no"
argoClusterName: "in-cluster"
argoNamespace: istio-system
argoPath: istio/istio-1.12.0/samples/addons
Giờ bạn vào UI và tạo bình thường:


Giờ bạn click vào đó

Và giờ click tiếp
