Skip to content

Commit 30f5f08

Browse files
committed
Corrected core mode commands after testing
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
1 parent 70713d3 commit 30f5f08

1 file changed

Lines changed: 80 additions & 37 deletions

File tree

docs/OpenShift GitOps CLI User Guide.md

Lines changed: 80 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -214,44 +214,52 @@ In the normal mode (default mode), the `argocd` CLI client makes API requests to
214214
215215
#### Core mode
216216
217-
In the `core` mode (`--core` argument specified), the CLI talks directly to the Kubernetes API server (unlike in normal mode, where the CLI talks to the ArgoCD Server) using the credentials set in the kubeconfig file. The default kubeconfig file is available at location `$HOME/.kube/config` can be customized using the `KUBECONFIG` environment variable. Unlike the normal mode, there is no explicit login step required for user authentication. The command would be executed using the credentials provided in the `kubeconfig` file. ArgoCD commands can be executed in the core mode using one of the following options.
217+
In the `core` mode (`--core` argument specified), the CLI talks directly to the Kubernetes API server (unlike in normal mode, where the CLI talks to the ArgoCD Server) using the credentials set in the kubeconfig file. The default kubeconfig file is available at location `$HOME/.kube/config` can be customized using the `KUBECONFIG` environment variable. Unlike the normal mode, there is no explicit login step required for user authentication. The command would be executed using the credentials provided in the `kubeconfig` file.
218218
219-
##### Option 1: With default kubeconfig file (using the default context)
219+
##### Steps to execute command in the core mode
220+
221+
1. ArgoCD commands can be executed in the core mode using one of the following options.
222+
223+
###### Option 1: With default kubeconfig file (using the default context)
220224
```
221225
# argocd --core [command or options] [arguments…​]
222226
```
223227
eg:
224228
```
225-
# argocd --core app list
229+
# ARGOCD_REPO_SERVER_NAME=openshift-gitops-repo-server argocd --core app list
230+
(or)
231+
# argocd --core app list --repo-server-name openshift-gitops-repo-server
226232
```
227-
##### Option 2: With default kubeconfig file (using a custom context)
233+
###### Option 2: With default kubeconfig file (using a custom context)
228234
```
229235
# argocd --core --kube-context [context] [command or options] [arguments…​]
230236
```
231237
eg:
232238
```
233-
# argocd --core --kube-context kubeadmin-local app list
239+
# ARGOCD_REPO_SERVER_NAME=openshift-gitops-repo-server argocd --core --kube-context kubeadmin-local app list
240+
(or)
241+
# argocd --core --kube-context kubeadmin-local app list --repo-server-name openshift-gitops-repo-server
234242
```
235243
236-
##### Option 3: With a custom kubeconfig file (using the default context)
244+
###### Option 3: With a custom kubeconfig file (using the default context)
237245
```
238246
# KUBECONFIG=~/.kube/custom_config argocd --core [command or options] [arguments…​]
239247
```
240248
eg:
241249
```
242-
# KUBECONFIG=~/.kube/custom_config argocd --core app list
250+
# KUBECONFIG=~/.kube/custom_config argocd --core app list --repo-server-name openshift-gitops-repo-server
243251
```
244252
245-
##### Option 4: With a custom kubeconfig file (using a custom context)
253+
###### Option 4: With a custom kubeconfig file (using a custom context)
246254
```
247255
# KUBECONFIG=~/.kube/custom_config argocd --core --kube-context [context] [command or options] [arguments…​]
248256
```
249257
eg:
250258
```
251-
# KUBECONFIG=~/.kube/custom_config argocd --kube-context kubeadmin-local --core app list
259+
# KUBECONFIG=~/.kube/custom_config argocd --kube-context kubeadmin-local --core app list --repo-server-name openshift-gitops-repo-server
252260
```
253261
254-
**NOTE** If there are multiple ArgoCD instances, then set the default namespace of the current context to interact with the right ArgoCD instance.
262+
**NOTE** If there are multiple ArgoCD instances, then set the default namespace of the current context to the namespace of the ArgoCD instance that you want to interact with. Also set the environment variable `ARGOCD_REPO_SERVER_NAME` or use the command line option `--repo-server-name` to specify the repo server component name in the format `<argocd-instance-name>-repo-server`.
255263
256264
### Global options
257265
Global options are options applicable to all sub-commands of `argocd`.
@@ -547,10 +555,13 @@ $ compinit
547555
--sync-policy automated \
548556
--self-heal \
549557
--sync-option Prune=true \
550-
--sync-option CreateNamespace=true \
551-
--annotations "argocd.argoproj.io/managed-by=openshift-gitops"
558+
--sync-option CreateNamespace=true
559+
```
560+
5. Label the destination namespace `spring-petclinic` to be managed by `openshif-gitops` argocd instance as below
561+
```
562+
# oc label ns spring-petclinic "argocd.argoproj.io/managed-by=openshift-gitops"
552563
```
553-
5. List the application to confirm that the application is created successfully and repeat the command till the application reaches the state `Synced` and `Healthy`
564+
6. List the application to confirm that the application is created successfully and repeat the command till the application reaches the state `Synced` and the health of the application is `Healthy`.
554565
```
555566
# argocd app list
556567
```
@@ -580,15 +591,19 @@ $ compinit
580591
```
581592
# oc config set-context --current --namespace openshift-gitops
582593
```
583-
4. Validate that you are able to run `argocd` commands in core mode by executing the following command to list all Applications.
594+
4. Set the following environment variables to override the argocd component names
595+
```
596+
# export ARGOCD_REPO_SERVER_NAME=openshift-gitops-repo-server
597+
```
598+
5. Validate that you are able to run `argocd` commands in core mode by executing the following command to list all Applications.
584599
```
585600
# argocd app list --core
586601
```
587602
If the configuration is correct, then existing Applications will be listed with header as below
588603
```
589604
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
590605
```
591-
5. Let's create an application in core mode
606+
6. Let's create an application in core mode
592607
```
593608
# argocd app create app-spring-petclinic --core \
594609
--repo https://github.com/redhat-developer/openshift-gitops-getting-started.git \
@@ -600,10 +615,13 @@ $ compinit
600615
--sync-policy automated \
601616
--self-heal \
602617
--sync-option Prune=true \
603-
--sync-option CreateNamespace=true \
604-
--annotations "argocd.argoproj.io/managed-by=openshift-gitops"
618+
--sync-option CreateNamespace=true
605619
```
606-
6. List the application to confirm that the application is created successfully and repeat the command till the application reaches the state `Synced` and `Healthy`
620+
7. Label the destination namespace `spring-petclinic` to be managed by `openshif-gitops` argocd instance as below
621+
```
622+
# oc label ns spring-petclinic "argocd.argoproj.io/managed-by=openshift-gitops"
623+
```
624+
8. List the application to confirm that the application is created successfully and repeat the command till the application reaches the state `Synced` and the health of the application is `Healthy`.
607625
```
608626
# argocd app list --core
609627
```
@@ -637,11 +655,14 @@ $ compinit
637655
# argocd login --username admin --password '<password>' openshift-gitops.openshift-gitops.apps-crc.testing
638656
```
639657
**IMPORTANT** passwords can contain special characters like `$` which would be interpreted as shell variables. This can cause the command to fail as a wrong value (shell interpreted) of password would be sent to the server. Always use single quotes '' to enclose the actual value of the password to avoid such errors.
640-
641-
3. If the argo application is created with manual sync policy, then the user has to trigger the sync operation manually. This can be done by using the `argocd` CLI in normal mode as below
658+
4. If the argo application is created with `none` sync policy, then the user has to trigger the sync operation manually. This can be done by using the `argocd` CLI in normal mode as below
642659
```
643660
# argocd app sync openshift-gitops/app-spring-petclinic
644661
```
662+
5. List the application to confirm that the application has reached the state `Synced` and the health of the application is `Healthy`.
663+
```
664+
# argocd app list
665+
```
645666
### Syncing an application in core mode
646667
#### Prerequisites
647668
@@ -666,11 +687,18 @@ $ compinit
666687
```
667688
# oc config set-context --current --namespace openshift-gitops
668689
```
669-
670-
4. If the argo application is created with manual sync policy, then the user has to trigger the sync operation manually. This can be done by using the `argocd` CLI in core mode as below
690+
4. Set the following environment variables to override the argocd component names
691+
```
692+
# export ARGOCD_REPO_SERVER_NAME=openshift-gitops-repo-server
693+
```
694+
5. If the argo application is created with `none` sync policy, then the user has to trigger the sync operation manually. This can be done by using the `argocd` CLI in core mode as below
671695
```
672696
# argocd app sync --core openshift-gitops/app-spring-petclinic
673697
```
698+
6. List the application to confirm that the application has reached the state `Synced` and the health of the application is `Healthy`.
699+
```
700+
# argocd app list --core
701+
```
674702
675703
## Declarative cluster configuration using OpenShift GitOps argocd CLI
676704
@@ -718,13 +746,15 @@ $ compinit
718746
--dest-server https://kubernetes.default.svc \
719747
--dest-namespace spring-petclinic \
720748
--directory-recurse \
721-
--sync-policy manual \
722-
--self-heal \
749+
--sync-policy none \
723750
--sync-option Prune=true \
724-
--sync-option CreateNamespace=true \
725-
--annotations "argocd.argoproj.io/managed-by=openshift-gitops"
751+
--sync-option CreateNamespace=true
752+
```
753+
5. Label the destination namespace `spring-petclinic` to be managed by `openshif-gitops` argocd instance as below
726754
```
727-
5. List the application to confirm that the application is created successfully and repeat the command till the application reaches the state `Synced` and `Healthy`
755+
# oc label ns spring-petclinic "argocd.argoproj.io/managed-by=openshift-gitops"
756+
```
757+
6. List the application to confirm that the application is created successfully. The application will stay in the state `OutOfSync` since the sync policy is set to `none`and the health of the application is `Healthy`.
728758
```
729759
# argocd app list
730760
```
@@ -754,15 +784,19 @@ $ compinit
754784
```
755785
# oc config set-context --current --namespace openshift-gitops
756786
```
757-
4. Validate that you are able to run `argocd` commands in core mode by executing the following command to list all Applications.
787+
4. Set the following environment variables to override the argocd component names
788+
```
789+
# export ARGOCD_REPO_SERVER_NAME=openshift-gitops-repo-server
790+
```
791+
5. Validate that you are able to run `argocd` commands in core mode by executing the following command to list all Applications.
758792
```
759793
# argocd app list --core
760794
```
761795
If the configuration is correct, then existing Applications will be listed with header as below
762796
```
763797
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
764798
```
765-
5. Let's create an application in core mode
799+
6. Let's create an application in core mode
766800
```
767801
# argocd app create cluster-configs --core \
768802
--repo https://github.com/redhat-developer/openshift-gitops-getting-started.git \
@@ -771,13 +805,11 @@ $ compinit
771805
--dest-server https://kubernetes.default.svc \
772806
--dest-namespace spring-petclinic \
773807
--directory-recurse \
774-
--sync-policy manual \
775-
--self-heal \
808+
--sync-policy none \
776809
--sync-option Prune=true \
777-
--sync-option CreateNamespace=true \
778-
--annotations "argocd.argoproj.io/managed-by=openshift-gitops"
810+
--sync-option CreateNamespace=true
779811
```
780-
6. List the application to confirm that the application is created successfully and repeat the command till the application reaches the state `Synced` and `Healthy`
812+
7. List the application to confirm that the application is created successfully. The application will stay in the state `OutOfSync` since the sync policy is set to `none` and the health of the application is `Healthy`.
781813
```
782814
# argocd app list --core
783815
```
@@ -809,10 +841,14 @@ $ compinit
809841
# argocd login --username admin --password '<password>' openshift-gitops.openshift-gitops.apps-crc.testing
810842
```
811843
**IMPORTANT** passwords can contain special characters like `$` which would be interpreted as shell variables. This can cause the command to fail as a wrong value (shell interpreted) of password would be sent to the server. Always use single quotes '' to enclose the actual value of the password to avoid such errors.
812-
3. If the argo application is created with manual sync policy, then the user has to trigger the sync operation manually. This can be done by using the `argocd` CLI in normal mode as below
844+
4. Since the argo application is created with a `none` sync policy, user has to trigger the sync operation manually. This can be done by using the `argocd` CLI in core mode as below
813845
```
814846
# argocd app sync openshift-gitops/cluster-configs
815847
```
848+
5. List the application to confirm that the application has reached the state `Synced` and the health of the application is `Healthy`.
849+
```
850+
# argocd app list
851+
```
816852
### Syncing cluster configuration application in core mode
817853
818854
#### Prerequisites
@@ -838,11 +874,18 @@ $ compinit
838874
```
839875
# oc config set-context --current --namespace openshift-gitops
840876
```
841-
842-
4. If the argo application is created with manual sync policy, then the user has to trigger the sync operation manually. This can be done by using the `argocd` CLI in core mode as below
877+
4. Set the following environment variables to override the argocd component names
878+
```
879+
# export ARGOCD_REPO_SERVER_NAME=openshift-gitops-repo-server
880+
```
881+
5. Since the argo application is created with a `none` sync policy, user has to trigger the sync operation manually. This can be done by using the `argocd` CLI in core mode as below
843882
```
844883
# argocd app sync --core openshift-gitops/cluster-configs
845884
```
885+
6. List the application to confirm that the application has reached the state `Synced` and the health of the application is `Healthy`.
886+
```
887+
# argocd app list --core
888+
```
846889
847890
848891
## References

0 commit comments

Comments
 (0)