Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Install CN2 Pipelines

SUMMARY This section guides you through installing CN2 Pipelines.

Download CN2 Pipelines

Download the CN2 Pipelines files to update the files with the needed tokens prior to installation.

To download the CN2 Pipelines tar file:

  1. Download CN2 Pipelines Deployer files from Juniper Networks Downloads.
  2. Untar the downloaded files to the management server.

Install the CN2 Pipelines Helm Chart

The CN2 Pipelines Helm chart is used to install and configure the CN2 Pipelines management cluster.

To install the CN2 Pipelines Helm chart on your management cluster:

  1. In your downloaded CN2 Pipelines Deployer files, locate the values.yaml in the folder contrail-pipelines-x.x.x/values.
  2. Input the chart values. For parameter descriptions, see Explanation of values.yaml.

    Example CN2 Pipelines values.yaml for the management cluster:

  3. Run the following command to install the CN2 Pipelines Helm chart with the release name cn2-pipeline:

Verify the CN2 Pipelines Helm Chart Installation

To verify the CN2 Pipelines Helm chart Installation, run the following commands:

  1. List the Helm release in the current namespace.

    Output:

  2. Display all pods in all namespaces.

    Output:

Argo CD and Helm Configuration

This topic lists the Argo components and configurations that are automated as part of the CN2 Pipelines Helm chart install.

  • Argo CD External Service—Creates a Kubernetes service with service type as NodePort or LoadBalancer. This creates the Argo CD external service that provides access to the Argo CD API server and the Argo CD GUI.

  • Register Git Repository with CN2 Configurations—Configures repository credentials and connects your Git repository to Argo CD. Argo CD is configured to your Git repository to watch and pull the configuration changes from your Git repository. This Git repository should only contain Kubernetes resources. Argo CD does not understand any other type of YAML or files.

  • Register Kubernetes Clusters—Registers a Kubernetes cluster to Argo CD. This process configures Argo CD to provision the Kubernetes resources in any Kubernetes cluster. Multiple Kubernetes clusters can be configured in Argo CD.

  • Create an Argo CD Application—Creates an application using the Argo CD GUI. Any application created in Argo CD needs to be associated with a Git repository and one Kubernetes cluster.

Argo Log In

After installing the CN2 Pipelines Helm chart, you have access to the Argo Workflow GUI and the Argo CD GUI.

Access Argo Workflow UI

To access the Argo CD GUI, you need connectivity from the management cluster to access the GUI using the NodePort service. The Argo CD GUI is accessed using the management server IP address and port 30550.

  1. Access the Argo CD GUI from your browser.

  2. On the management node, run the following command to receive the token.

Access Argo CD GUI

To access the Argo CD GUI, you need connectivity from the management cluster to access the GUI using the NodePort service. The Argo CD GUI is accessed using the management server IP address and port 30551.

  1. Access the Argo CD GUI from your browser.

  2. On the management node, run the following command to receive the token. The username is admin.

CN2 and Workflows

Argo Workflows is an open source container-native workflow engine for orchestrating parallel jobs on Kubernetes. You can define workflows where each step in the workflow is a container. You can also model multi-step workflows as a sequence of tasks or capture dependencies between tasks using a directed acyclic graph (DAG).

Why Workflows Are Needed

Workflows are used to invoke and run CN2 test cases after provisioning CN2 resources by using the GitOps engine. These workflows qualify the CN2 application configurations and generates test results for the configuration that is being deployed.

How Workflows Work and How CN2 Uses Workflows

Workflows are triggered whenever a CN2 resource is provisioned by the GitOps engine. Each of the CN2 resources or a group of CN2 resources are mapped to a specific workflow test DAG. After successful completion of these test suites, the CN2 configurations are qualified to be promoted to production environments from the Staging or Test environments.

CN2 Pipelines Service

The pipeline service listens for notifications from Argo Events for any changes in Kubernetes resources. The pipeline service exposes a service which is used by Argo Events to consume and trigger the service with the data related to the CN2 configuration that you applied. It is the responsibility of the CN2 Pipelines service to identify the test workflow to be triggered for the type of CN2 configuration that you applied. Workflows change dynamically depending on the objects being notified. The CN2 Pipelines listener service invokes the respective workflow dependent on the CN2 configuration that gets applied.

CN2 Pipelines Configurations

This topic shows examples for the CN2 Pipelines configurations.

Pipeline Configuration

The pipeline configuration is used by the pipeline engine and includes:

  • Pipeline commit threshold

  • Config map: cn2pipeline-configs

  • Namespace: argo-events

Example CN2 Pipelines configuration:

Test Workflow Template Parameter Configuration

All workflow template inputs are stored as configuration maps. These configuration maps are dynamically selected during the execution by the pipeline service.

Workflow to Kind Map

This mapping configuration contains the workflow template to CN2 resource kind mapping. Only one template is selected for execution and the first map that matches has the higher priority. An asterisk (*) in kind: ['*'] indicates that template has higher priority than any other kind matches and overrides every mapping.

A workflow template for a CN2 resource kind mapping template includes:

  • Config map: cn2tmpl-to-kind-map

  • Namespace: argo-events

Following is an example configuration for the workflow template to CN2 resource kind mapping. Note the asterisk (*) in kind: ['*'] kindmap.

Create Custom Workflows for the CN2 Pipelines

You can create custom workflows tests to test your container network functions (CNFs).

To create a custom workflow, you can use the example custom test workflow templates provided with the CN2 Pipelines files. Every workflow has a set of input parameters, volume mounts, container creation, and so on. To understand the workflow template creation see Argo Workflows.

The following example custom test workflow templates are provided:

  • Input parameters to workflow

  • Mount volumes

  • Create Kubernetes resource using workflow (Template name: create-cnf-tf and create-cnf-service-tf)

  • Embedded code in workflow (Template name: test-access-tf)

  • Pull external code and execute within a container (Template name: test-service-tf)

To automate the inputs to the workflow during the pipeline run, a workflow parameter configuration map is created which has the inputs for the workflow. The configuration map must have the same name as the workflow template.

In the following example, the template name is custom-cnf-sample-test. A configuration map is created automatically with the same name. As a part of the pipeline run, the pipeline service looks for the configuration map with the template name, gets the inputs, which are then automatically added to the workflow when the pipeline triggers the workflow.

Another update that happens in the test case which triggers the custom workflow is to change the configuration map name to <cn2tmpl-to-kind-map>.

The following is an example workflow configuration for the template custom-cnf-sample-test: