This topic introduces sample applications deployed based on ACK One GitOps.
Deployment repository directory tree
A complete CI/CD pipeline primarily involves two types of repositories: business code repositories and application deployment code repositories. Because the configuration of code repositories requires modification, you need to fork the following code repositories to your own account.
Business code repositories: echo-server project and echo-web-server project.
Application deployment code repository: used to store the YAML files of applications that you need to deploy to clusters. For more information, see Alibaba Cloud GitOps Demo project (example branch). The main directory structure is shown below. This best practice covers examples for the complete development process including Dev, Staging, and Production environments, with both Helm and Kustomize methods. You can use one of these methods for deployment based on your actual needs.
manifests ├── helm │ ├── echo-server │ │ ├── .argocd-source-app-helm-dev.yaml │ │ ├── .argocd-source-app-helm-production.yaml │ │ ├── .argocd-source-app-helm-staging.yaml │ │ ├── Chart.yaml │ │ ├── templates │ │ │ ├── NOTES.txt │ │ │ ├── _helpers.tpl │ │ │ ├── deployment-echo-server.yaml │ │ │ ├── deployment-echo-web-server.yaml │ │ │ ├── external-secret.yaml │ │ │ ├── hpa.yaml │ │ │ ├── ingress.yaml │ │ │ ├── rollout.yaml │ │ │ ├── service-echo-server.yaml │ │ │ ├── service-echo-web-server.yaml │ │ │ ├── serviceaccount.yaml │ │ │ └── tests │ │ │ └── test-connection.yaml │ │ ├── values-dev.yaml │ │ ├── values-production.yaml │ │ ├── values-staging.yaml │ │ └── values.yaml │ └── web-demo │ ├── Chart.yaml │ ├── templates │ │ ├── deployment.yaml │ │ └── service.yaml │ └── values.yaml └── kustomize ├── base │ ├── deployment.yaml │ ├── kustomization.yaml │ └── service.yaml └── overlay ├── dev │ ├── .argocd-source-app-kust-dev.yaml │ ├── deployment.yaml │ └── kustomization.yaml ├── production │ ├── .argocd-source-app-kust-production.yaml │ ├── deployment.yaml │ └── kustomization.yaml └── staging ├── .argocd-source-app-kust-staging.yaml ├── deployment.yaml └── kustomization.yamlThe echo-server project managed by Helm in this deployment repository directory structure includes capabilities for multiple environments or clusters, multiple Deployments, multi-cluster Secret management, and Rollout.
Multiple environments or multi-cluster deployment
The following section describes the configurations of applications managed by Helm and Kustomize.
Applications managed by Helm
You can use different
values.yamlfiles to deploy applications with different configurations, such as thevalues-dev.yaml,values-staging.yaml, andvalues-production.yamlfiles in the preceding directory structure.If you want to disable Rollout for the Dev environment and enable Rollout for the Staging and Production environments, you can configure different settings in the corresponding
values.yamlfiles.Please modify the image repository information in the
values-****.yamlfiles to the Container Registry Enterprise Edition instance (ACR EE) that you actually use. In this best practice, the ACR EE instance name isdemo-testand the namespace iscidemo. Configure as needed.
Applications managed by Kustomize
Because these applications need to modify resources based on the base+overlay approach, you can use different directories in overlay to implement different configurations for different environments.
After an application image is updated, Image Updater automatically updates the latest image information to the .argocd-source-app-helm-xxx.yaml and .argocd-source-app-kust-xxx.yaml files in the Git repository, as shown in the following figure. For more information about application configurations, see Use ACK One GitOps and Container Registry to build CI/CD pipelines.

Differentiated distribution of sensitive information across multiple clusters
If you want to deploy an application that uses different configurations in different clusters and need to use sensitive information such as database usernames and passwords, you can use Secrets Manager to encrypt the credentials after the multi-cluster differentiated deployment described above. Then, you can import the credentials to Key Management Service (KMS) from each cluster. For more information about Secrets Manager, see Getting started with secrets.
To use this capability, you need to add the corresponding YAML file (external-secret.yaml) to the application deployment repository. During application deployment, this file creates an ExternalSecret to retrieve service credentials from KMS, and mounts the corresponding Secret in deployment-echo-server.yaml.
In this best practice, you need to configure different information in the values-****.yaml files for different environments. For example, you can disable the secretManager capability in the Dev environment. Modify as needed.
Canary releases
In the Staging and Production environments, you typically need to use the Rollout capability to implement rolling deployments. Therefore, you need to add the corresponding YAML file to the application deployment repository to deploy Rollout resources that trigger canary releases and rolling updates, which is the rollout.yaml file in the directory structure. For more information about canary releases, see Use ACK One Gitops and Argo Rollouts to perform canary releases and Use Kruise Rollout to perform canary releases and A/B testing.
Applications corresponding to different environments
The following content shows YAML examples for deploying Applications in different environments (Dev, Staging, Production) using both Helm and Kustomize methods. Modify the argocd-image-updater.argoproj.io/image-list and repoURL configurations as needed.
Helm
The following code blocks show the Applications corresponding to different environments below the Helm directory in the preceding directory tree.
Dev environment
Staging environment
Production environment
Kustomize
The following code blocks show the Applications corresponding to different environments below the Kustomize directory in the preceding directory tree.
Dev environment
Staging environment
Production environment
References
Use an ACK One workflow cluster to build an image CI pipeline
Use ACK One GitOps and Container Registry to build CI/CD pipelines
Use ACK One Gitops and Argo Rollouts to perform canary releases
Use Kruise Rollout to implement canary releases based on ACK One GitOps
Use ACK One GitOps to deploy Container Registry Enterprise Edition OCI Helm charts