1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/microshift-gitops-adding-apps.adoc
2024-04-15 12:12:42 +00:00

120 lines
2.8 KiB
Plaintext

// Module included in the following assemblies:
//
// microshift_running_apps/microshift-gitops.adoc
:_mod-docs-content-type: PROCEDURE
[id="microshift-gitops-adding-apps_{context}"]
= Creating GitOps applications on {microshift-short}
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".
.Prerequisites
* You installed the `microshift-gitops` packages and the Argo CD pods are running in the `openshift-gitops` namespace.
.Procedure
. Create a YAML file and add your customized configurations for the application:
+
.Example YAML for a `cert-manager` application
[source,yaml]
----
kind: AppProject
apiVersion: argoproj.io/v1alpha1
metadata:
name: default
namespace: openshift-gitops
spec:
clusterResourceWhitelist:
- group: '*'
kind: '*'
destinations:
- namespace: '*'
server: '*'
sourceRepos:
- '*'
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cert-manager
namespace: openshift-gitops
spec:
destination:
namespace: cert-manager
server: https://kubernetes.default.svc
project: default
source:
path: cert-manager
repoURL: https://github.com/anandf/microshift-install
syncPolicy:
automated: {}
syncOptions:
- CreateNamespace=true
- ServerSideApply=true
----
+
.Example YAML for a `spring-petclinic` application
[source,yaml]
----
kind: AppProject
apiVersion: argoproj.io/v1alpha1
metadata:
name: default
namespace: openshift-gitops
spec:
clusterResourceWhitelist:
- group: '*'
kind: '*'
destinations:
- namespace: '*'
server: '*'
sourceRepos:
- '*'
---
kind: Application
apiVersion: argoproj.io/v1alpha1
metadata:
name: spring-petclinic
namespace: openshift-gitops
spec:
destination:
namespace: spring-petclinic
server: https://kubernetes.default.svc
project: default
source:
directory:
recurse: true
path: app
repoURL: https://github.com/siamaksade/openshift-gitops-getting-started
syncPolicy:
automated: {}
syncOptions:
- CreateNamespace=true
- ServerSideApply=true
----
. To deploy the applications defined in the YAML file, run the following command:
+
[source,terminal]
----
$ oc apply -f <filename>.yaml
----
.Verification
* To verify your application is deployed and synced, run the following command:
+
[source,terminal]
----
$ oc get applications -A
----
It might take a few minutes for the application to show the `Healthy` status.
+
.Example output
[source,terminal]
----
NAMESPACE NAME SYNC STATUS HEALTH STATUS
openshift-gitops cert-manager Synced Healthy
openshift-gitops spring-petclinic Synced Healthy
----