Skip to content

# Example: Offer Jenkins as a Service via Openslice

Before reading this example please make sure that you went through the Design Helm as a Service

We will use the `Kind: Application` of ArgoCD and create a ResourceFacingServiceSpecification for Jenkins

    1. Go to Service Specifications
    2. Create New Specification
    3. Give a Name, eg. jenkinsrfs
    4. Go to Resource Specification Relationships
    5. Assign ```Application@argoproj.io/v1alpha1@kubernetes@https://10.10.10.144:6443/```

Focus now on the characteristics configuration.

First we need to map the lifecycle of ArgoCD Application to TMF Resource State

In ArgoCD the field health.status has the value that we need to check (Healty, Progressing, etc)

The _CR_SPEC can be designed first in a YAML or json editor. Let's see a YAML definition:

```

apiVersion: argoproj.io/v1alpha1 kind: Application metadata: finalizers: - resources-finalizer.argocd.argoproj.io name: openslice-jenkins namespace: argocd spec: project: default destination: namespace: opencrdtest name: in-cluster source: repoURL: https://charts.jenkins.io targetRevision: 4.6.1 chart: jenkins helm: values: | controller: service: type: ClusterIP syncPolicy: automated: prune: true selfHeal: true allowEmpty: false syncOptions: - Validate=false - CreateNamespace=true - PrunePropagationPolicy=foreground - PruneLast=true - RespectIgnoreDifferences=true ```

NOTICE

On each installation OSOM will change the name of the resource in order to be unique (will have a UUID)

`name: openslice-jenkins`

destination namespace that ArgoCD will use is the name `opencrdtest`

`destination: namespace: opencrdtest`

This implies that ArgoCD installs the Jenkins always in the same namespace

To avoid this we will create a simple pre-provision rule to change the namespace properly

See the following image:

1. Drag-Drop the _CR_SPEC characteristic of jenkinsrfs from the Service>Text blocks
2. Drag-Drop Text>Formatted text block
3. Drag-Drop Text>Multi-line text input block
4. Copy paste the YAML text
5. Change the spec: destination:namespace to the value %s
6. Drag-Drop Lists>Create list with block delete 2 items (click the gear icon). Connect it to formatted text block
7. Drag-Drop Context>Current Service Order block and select the id. Connect it to the List
8. Save the PRE_PROVISION Rule

# Expose the service to your users

Expose then as CustomerFacingServiceSpecification by using the previous RFSS as Service Specification Relationship 1. Create a Jenkins service and mark as Bundle and save it 2. Go to Service Specification Relationships and assign Jenkinsrfs 3. Add also a Logo if you wish

Expose it now to a Category and a Catalog to be available for ordering.

# Order the service

Order the service from the catalog.

Soon the order will be completed and the Services will be active

# How to access the Jenkins installation:

From the Supporting services of the Service Order, select the ResourceFacingService (jenkinsrfs)

The ResourceFacingService has also supporting resources in resource inventory.

One is the resource reference to the application (e.g. cr_tmpname...), the other is a secret (e.g. cr87893...).

Click to go to the secret resource (This is in the Resource inventory of OpenSlice)

Use them to login in your Jenkins.

> Exposing Jenkins to you external is a matter of cluster configuration and request (nodeport, load balancing, etc)! This is not a topic for this example