@@ -424,4 +424,156 @@ compinit
424
424
* [argocd repocreds](./cli/argocd_repocreds.md) - Repository credentials command
425
425
* [argocd repocreds add](./cli/argocd_repocreds_add.md) - Add git repository connection parameters
426
426
* [argocd repocreds list](./cli/argocd_repocreds_list.md) - List configured repository credentials
427
- * [argocd repocreds rm](./cli/argocd_repocreds_rm.md) - Remove repository credentials
427
+ * [argocd repocreds rm](./cli/argocd_repocreds_rm.md) - Remove repository credentials
428
+
429
+
430
+ ## Creating an application by using OpenShift GitOps argocd CLI
431
+
432
+ ### Create an application in Normal mode
433
+
434
+ #### Prerequisites
435
+
436
+ - OpenShift CLI (oc)
437
+ - OpenShift GitOps CLI (argocd)
438
+
439
+ #### Procedure
440
+ 1. Get the admin password for the ArgoCD server
441
+ ```
442
+ ADMIN_PASSWD=$(kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath='{.data.password}' | base64 -d)
443
+ ```
444
+ 2. Login to the ArgoCD server using the login command
445
+ ```
446
+ argocd login --username admin --password ${ADMIN_PASSWD} <server url>
447
+ #eg:
448
+ argocd login --username admin --password ${ADMIN_PASSWD} openshift-gitops.openshift-gitops.apps-crc.testing
449
+ ```
450
+ 3. Validate that you are able to run `argocd` commands in normal mode by executing the following command to list all Applications.
451
+ ```
452
+ # argocd app list
453
+ ```
454
+ If the configuration is correct, then existing Applications will be listed with header as below
455
+ ```
456
+ NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
457
+ ```
458
+ 4. Let's create an application in normal mode
459
+ ```
460
+ # argocd app create app-spring-petclinic \
461
+ --repo https://github.com/redhat-developer/openshift-gitops-getting-started.git \
462
+ --path app \
463
+ --revision main \
464
+ --dest-server https://kubernetes.default.svc \
465
+ --dest-namespace spring-petclinic \
466
+ --directory-recurse \
467
+ --sync-policy automated \
468
+ --self-heal \
469
+ --sync-option Prune=true \
470
+ --sync-option CreateNamespace=true \
471
+ --annotations "argocd.argoproj.io/managed-by=openshift-gitops"
472
+ ```
473
+ 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`
474
+ ```
475
+ # argocd app list
476
+ ```
477
+
478
+ ### Create an application in Core mode
479
+
480
+ #### Prerequisites
481
+
482
+ - OpenShift CLI (oc)
483
+ - OpenShift GitOps CLI (argocd)
484
+
485
+ #### Procedure
486
+
487
+ 1. Login to the OpenShift Cluster using the `oc` CLI tool
488
+ ```
489
+ # oc login -u [username] -p [password] [server_url]
490
+ eg:
491
+ # oc login -u kubeadmin -p ${ADMIN_PASSWD} https://api.crc.testing:6443
492
+ ```
493
+ 2. Check if the context is set correctly in the kubeconfig file
494
+ ```
495
+ # oc config current-context
496
+ ```
497
+ 3. Set the default namespace of the current context to `openshift-gitops`
498
+ ```
499
+ # oc config set-context --current --namespace openshift-gitops
500
+ ```
501
+ 4. Validate that you are able to run `argocd` commands in core mode by executing the following command to list all Applications.
502
+ ```
503
+ # argocd app list --core
504
+ ```
505
+ If the configuration is correct, then existing Applications will be listed with header as below
506
+ ```
507
+ NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
508
+ ```
509
+ 5. Let's create an application in core mode
510
+ ```
511
+ # argocd app create app-spring-petclinic --core \
512
+ --repo https://github.com/redhat-developer/openshift-gitops-getting-started.git \
513
+ --path app \
514
+ --revision main \
515
+ --dest-server https://kubernetes.default.svc \
516
+ --dest-namespace spring-petclinic \
517
+ --directory-recurse \
518
+ --sync-policy automated \
519
+ --self-heal \
520
+ --sync-option Prune=true \
521
+ --sync-option CreateNamespace=true \
522
+ --annotations "argocd.argoproj.io/managed-by=openshift-gitops"
523
+ ```
524
+ 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`
525
+ ```
526
+ # argocd app list --core
527
+ ```
528
+
529
+
530
+ ## Syncing an application by using OpenShift GitOps argocd CLI
531
+
532
+ ### Syncing an application in normal mode
533
+ #### Prerequisites
534
+
535
+ - OpenShift CLI (oc)
536
+ - OpenShift GitOps CLI (argocd)
537
+ #### Procedure
538
+
539
+ 1. Get the admin password for the ArgoCD server
540
+ ```
541
+ ADMIN_PASSWD=$(kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath='{.data.password}' | base64 -d)
542
+ ```
543
+ 2. Login to the ArgoCD server using the login command
544
+ ```
545
+ argocd login --username admin --password ${ADMIN_PASSWD} <server url>
546
+ #eg:
547
+ argocd login --username admin --password ${ADMIN_PASSWD} openshift-gitops.openshift-gitops.apps-crc.testing
548
+ ```
549
+ 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
550
+ ```
551
+ argocd app sync --core openshift-gitops/app-spring-petclinic
552
+ ```
553
+ ### Syncing an application in core mode
554
+ #### Prerequisites
555
+
556
+ - OpenShift CLI (oc)
557
+ - OpenShift GitOps CLI (argocd)
558
+
559
+ #### Procedure
560
+
561
+ 1. Login to the OpenShift Cluster using the `oc` CLI tool
562
+ ```
563
+ # oc login -u [username] -p [password] [server_url]
564
+ eg:
565
+ # oc login -u kubeadmin -p ${ADMIN_PASSWD} https://api.crc.testing:6443
566
+ ```
567
+ 2. Check if the context is set correctly in the kubeconfig file
568
+ ```
569
+ # oc config current-context
570
+ ```
571
+ 3. Set the default namespace of the current context to `openshift-gitops`
572
+ ```
573
+ # oc config set-context --current --namespace openshift-gitops
574
+ ```
575
+
576
+ 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
577
+ ```
578
+ # argocd app sync --core openshift-gitops/app-spring-petclinic
579
+ ```
0 commit comments