|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// microshift_running_apps/microshift-gitops.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="microshift-gitops-adding-apps_{context}"] |
| 7 | += Creating GitOps applications on {microshift-short} |
| 8 | + |
| 9 | +You can create a custom YAML configuration to deploy and manage applications in your {microshift-short} service. To install the necessary packages to run GitOps applications, follow the documentation in "Installing the GitOps Argo CD manifests from an RPM package". |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* You installed the `microshift-gitops` packages and the Argo CD pods are running in the `openshift-gitops` namespace. |
| 14 | +
|
| 15 | +.Procedure |
| 16 | + |
| 17 | +. Create a YAML file and add your customized configurations for the application: |
| 18 | ++ |
| 19 | +.Example YAML for a `cert-manager` application |
| 20 | +[source,yaml] |
| 21 | +---- |
| 22 | +kind: AppProject |
| 23 | +apiVersion: argoproj.io/v1alpha1 |
| 24 | +metadata: |
| 25 | + name: default |
| 26 | + namespace: openshift-gitops |
| 27 | +spec: |
| 28 | + clusterResourceWhitelist: |
| 29 | + - group: '*' |
| 30 | + kind: '*' |
| 31 | + destinations: |
| 32 | + - namespace: '*' |
| 33 | + server: '*' |
| 34 | + sourceRepos: |
| 35 | + - '*' |
| 36 | +--- |
| 37 | +apiVersion: argoproj.io/v1alpha1 |
| 38 | +kind: Application |
| 39 | +metadata: |
| 40 | + name: cert-manager |
| 41 | + namespace: openshift-gitops |
| 42 | +spec: |
| 43 | + destination: |
| 44 | + namespace: cert-manager |
| 45 | + server: https://kubernetes.default.svc |
| 46 | + project: default |
| 47 | + source: |
| 48 | + path: cert-manager |
| 49 | + repoURL: https://github.com/anandf/microshift-install |
| 50 | + syncPolicy: |
| 51 | + automated: {} |
| 52 | + syncOptions: |
| 53 | + - CreateNamespace=true |
| 54 | + - ServerSideApply=true |
| 55 | +---- |
| 56 | ++ |
| 57 | +.Example YAML for a `spring-petclinic` application |
| 58 | +[source,yaml] |
| 59 | +---- |
| 60 | +kind: AppProject |
| 61 | +apiVersion: argoproj.io/v1alpha1 |
| 62 | +metadata: |
| 63 | + name: default |
| 64 | + namespace: openshift-gitops |
| 65 | +spec: |
| 66 | + clusterResourceWhitelist: |
| 67 | + - group: '*' |
| 68 | + kind: '*' |
| 69 | + destinations: |
| 70 | + - namespace: '*' |
| 71 | + server: '*' |
| 72 | + sourceRepos: |
| 73 | + - '*' |
| 74 | +--- |
| 75 | +kind: Application |
| 76 | +apiVersion: argoproj.io/v1alpha1 |
| 77 | +metadata: |
| 78 | + name: spring-petclinic |
| 79 | + namespace: openshift-gitops |
| 80 | +spec: |
| 81 | + destination: |
| 82 | + namespace: spring-petclinic |
| 83 | + server: https://kubernetes.default.svc |
| 84 | + project: default |
| 85 | + source: |
| 86 | + directory: |
| 87 | + recurse: true |
| 88 | + path: app |
| 89 | + repoURL: https://github.com/siamaksade/openshift-gitops-getting-started |
| 90 | + syncPolicy: |
| 91 | + automated: {} |
| 92 | + syncOptions: |
| 93 | + - CreateNamespace=true |
| 94 | + - ServerSideApply=true |
| 95 | +---- |
| 96 | + |
| 97 | +. To deploy the applications defined in the YAML file, run the following command: |
| 98 | ++ |
| 99 | +[source,terminal] |
| 100 | +---- |
| 101 | +$ oc apply -f <filename>.yaml |
| 102 | +---- |
| 103 | + |
| 104 | +.Verification |
| 105 | + |
| 106 | +* To verify your application is deployed and synced, run the following command: |
| 107 | ++ |
| 108 | +[source,terminal] |
| 109 | +---- |
| 110 | +$ oc get applications -A |
| 111 | +---- |
| 112 | +It might take a few minutes for the application to show the `Healthy` status. |
| 113 | ++ |
| 114 | +.Example output |
| 115 | +[source,terminal] |
| 116 | +---- |
| 117 | +NAMESPACE NAME SYNC STATUS HEALTH STATUS |
| 118 | +openshift-gitops cert-manager Synced Healthy |
| 119 | +openshift-gitops spring-petclinic Synced Healthy |
| 120 | +---- |
0 commit comments