この Topic では、Argo CD コマンドラインインターフェイス (CLI) と Argo CD コンソールを使用して、GitOps システムで Git ソースリポジトリと Helm ソースリポジトリを追加、表示、削除する方法について説明します。
前提条件
GitOps システムにログインしていること。詳細については、「GitOps システムにログインする」をご参照ください。
リポジトリの追加
Git ソースリポジトリの追加
次のいずれかの方法で Git ソースリポジトリを追加できます。
サンプルアプリケーションの Git ソースリポジトリを GitOps システムに追加します。
argocd repo add https://github.com/AliyunContainerService/gitops-demo.git期待される出力:
Repository 'https://github.com/AliyunContainerService/gitops-demo.git' addedユーザー名とパスワードを使用して、HTTPS 経由で非公開 Git ソースリポジトリを追加します。
argocd repo add https://git.example.com/repos/repo --username git --password secret秘密鍵を使用して Secure Shell (SSH) プロトコル経由で Git ソースリポジトリを追加し、サーバー証明書の検証を無視します。
argocd repo add git@git.example.com:repos/repo --insecure-ignore-host-key --ssh-private-key-path ~/id_rsa
次のコマンドを実行して、追加パラメーターの使用方法に関する説明を表示します。
argocd repo add --helpHelm ソースリポジトリの追加
次のいずれかの方法で Helm ソースリポジトリを追加できます。
HTTPS 経由でパブリック Helm リポジトリを追加し、名前を割り当てます。
argocd repo add https://charts.helm.sh/stable --type helm --name <local-repository-name>ユーザー名とパスワードを使用して HTTPS 経由で非公開 Helm リポジトリを追加し、名前を割り当てます。
argocd repo add https://charts.helm.sh/stable --type helm --name <local-repository-name> --username test --password testAlibaba Cloud Container Registry (ACR) Enterprise Edition インスタンスの Helm チャートを使用する場合は、完全なリポジトリパスを指定します。
argocd repo add https://<instance-name>-chart.<region-id>.cr.aliyuncs.com/<namespace>/<chart-repository> --type helm --name <local-repository-name> --username test --password testHTTPS 経由で非公開の OCI ベースの Helm リポジトリを追加し、名前を割り当てます。
argocd repo add helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type helm --name <local-repository-name> --enable-oci --username test --password test
リポジトリリストの表示
次のコマンドを実行して、リポジトリリストを表示します。
argocd repo list期待される出力:
TYPE NAME REPO INSECURE OCI LFS CREDS STATUS MESSAGE PROJECT
helm mystable https://charts.helm.sh/stable false false false false Successful
git https://github.com/AliyunContainerService/gitops-demo.git true false false false Successful defaultリポジトリの削除
次のコマンドを実行して、Git ソースリポジトリを削除します。Helm リポジトリを削除するには、コマンド内の Git リポジトリアドレスを Helm リポジトリアドレスに置き換えます。
argocd repo rm https://github.com/AliyunContainerService/gitops-demo.git期待される出力:
Repository 'https://github.com/AliyunContainerService/gitops-demo.git' removed関連操作
Argo CD CLI の使用に加えて、Argo CD コンソールでソースリポジトリを管理することもできます。
Argo CD UI にログインします。左側のナビゲーションウィンドウで、[設定] を選択し、次に を選択します。