-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
documentation added for pipelines (#2793)
* scaffolding for pipelines * added rbac for view pipelines * just an intro added * adding getting started for pipelines * changed to podinfo02 * added pipeline spec as flux docs * pipelines moved into enterprise * reviewed links * reviewed rbac * fixed broken link * Update website/docs/enterprise/pipelines/getting-started.mdx Co-authored-by: Yiannis <[email protected]> * Update website/docs/enterprise/pipelines/getting-started.mdx Co-authored-by: Yiannis <[email protected]> * Update website/docs/enterprise/pipelines/getting-started.mdx Co-authored-by: Yiannis <[email protected]> * Update website/docs/enterprise/pipelines/intro.mdx Co-authored-by: Yiannis <[email protected]> * Update website/docs/enterprise/pipelines/getting-started.mdx Co-authored-by: Yiannis <[email protected]> * Update website/docs/enterprise/pipelines/getting-started.mdx Co-authored-by: Yiannis <[email protected]> * Update website/docs/enterprise/pipelines/getting-started.mdx Co-authored-by: Yiannis <[email protected]> * Update website/docs/enterprise/pipelines/spec/v1alpha1/pipeline.mdx Co-authored-by: Yiannis <[email protected]> * Update website/docs/enterprise/pipelines/intro.mdx Co-authored-by: Yiannis <[email protected]> * removed not wrapped Co-authored-by: Yiannis <[email protected]>
- Loading branch information
1 parent
3c126f9
commit 7bb985e
Showing
9 changed files
with
347 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"label": "Pipelines", | ||
"position": 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: Authorization | ||
sidebar_position: 2 | ||
hide_title: true | ||
--- | ||
|
||
import TierLabel from "../../_components/TierLabel"; | ||
|
||
import CodeBlock from "@theme/CodeBlock"; | ||
import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
|
||
# Authorization <TierLabel tiers="enterprise" /> | ||
|
||
This section provides a recommended way to configure RBAC in the context of pipelines. It is oriented to the journey | ||
that you expect your users to have. | ||
|
||
## View pipelines | ||
|
||
In order to view pipelines, users would need to have read access to the `pipeline` resource and the underlying `application` resources. | ||
|
||
An example of configuration to achieve this purpose could be seen below with `pipeline-reader` role and `search-pipeline-reader` | ||
role-binding to allow a group `search-developer` to access pipeline resources within `search` namespace. | ||
|
||
```yaml | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: pipeline-reader | ||
rules: | ||
- apiGroups: [ "pipelines.weave.works" ] | ||
resources: [ "pipelines" ] | ||
verbs: [ "get", "list", "watch"] | ||
- apiGroups: ["helm.toolkit.fluxcd.io"] | ||
resources: [ "helmreleases" ] | ||
verbs: [ "get", "list", "watch"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: search-pipeline-reader | ||
namespace: search | ||
subjects: | ||
- kind: Group | ||
name: search-developer | ||
apiGroup: rbac.authorization.k8s.io | ||
roleRef: | ||
kind: ClusterRole | ||
name: pipeline-reader | ||
apiGroup: rbac.authorization.k8s.io | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
title: Getting started | ||
sidebar_position: 1 | ||
hide_title: true | ||
--- | ||
|
||
import TierLabel from "../../_components/TierLabel"; | ||
|
||
import CodeBlock from "@theme/CodeBlock"; | ||
import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
|
||
# Getting started with pipelines <TierLabel tiers="enterprise" /> | ||
|
||
## Requirements | ||
- You have configured Weave GitOps Enterprise [RBAC for pipelines](../authorization) | ||
|
||
## Define a pipeline | ||
|
||
A pipeline allows you to define the route your application is taking in order to make it to production. | ||
There are three main concepts playing in a pipeline: | ||
- the `application` to deliver | ||
- the `environments` that your app will go through in its way to production (general) | ||
- the `deployment targets` or the clusters that each environment has | ||
|
||
You can define a delivery pipeline using a `Pipeline` custom resource. | ||
An example of how it looks for an application `podinfo` is shown below. | ||
|
||
```yaml | ||
apiVersion: pipelines.weave.works/v1alpha1 | ||
kind: Pipeline | ||
metadata: | ||
name: podinfo-02 | ||
namespace: default | ||
spec: | ||
appRef: | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
name: podinfo | ||
environments: | ||
- name: dev | ||
targets: | ||
- namespace: podinfo-02-dev | ||
clusterRef: | ||
kind: GitopsCluster | ||
name: dev | ||
namespace: flux-system | ||
- name: test | ||
targets: | ||
- namespace: podinfo-02-qa | ||
clusterRef: | ||
kind: GitopsCluster | ||
name: dev | ||
namespace: flux-system | ||
- namespace: podinfo-02-perf | ||
clusterRef: | ||
kind: GitopsCluster | ||
name: dev | ||
namespace: flux-system | ||
- name: prod | ||
targets: | ||
- namespace: podinfo-02-prod | ||
clusterRef: | ||
kind: GitopsCluster | ||
name: prod | ||
namespace: flux-system | ||
``` | ||
In the previous example, `podinfo` application is delivered to a traditional pipeline composed by `dev`, `qa`, `perf` and `production` environments. | ||
Each environment is backed by a `GitopsCluster` [deployment target](../../../cluster-management/managing-existing-clusters/). | ||
|
||
For more details about the spec of a pipeline [see here](spec/v1alpha1/pipeline.mdx) | ||
|
||
## View the list of pipelines | ||
|
||
Once flux has created your pipeline you can navigate to the pipelines view to see it. | ||
|
||
![view pipelines](img/view-pipelines.png) | ||
|
||
Pipeline list view show the list of pipelines you have access to. For each pipeline, a simplified view of the pipeline | ||
is shown with the application `Type` and `Environments` it goes through. | ||
|
||
## View the details of a pipeline | ||
|
||
Once you have selected a pipeline from the list, you will navigate to its details view. | ||
In pipeline details view you could view the current status of your application by environment and deployment | ||
target. | ||
|
||
![view pipeline details](img/view-pipeline-details.png) | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: Introduction | ||
sidebar_position: 0 | ||
hide_title: true | ||
--- | ||
|
||
import TierLabel from "../../_components/TierLabel"; | ||
|
||
<h1> | ||
{frontMatter.title} <TierLabel tiers="Enterprise" /> | ||
</h1> | ||
|
||
## Pipelines | ||
|
||
As [wikipedia defines](https://en.wikipedia.org/wiki/Continuous_delivery), Continuous delivery is | ||
|
||
>a software engineering approach in which teams produce software in short cycles, | ||
>ensuring that the software can be reliably released at any time and, when releasing the software, without doing so manually. | ||
>It aims at building, testing, and releasing software with greater speed and frequency. | ||
|
||
>Continuous delivery is enabled through the deployment pipeline. | ||
>The purpose of the deployment pipeline has three components: visibility, feedback, and continually deploy.[12] | ||
|
||
Weave Gitops Enterprise Pipelines allows you to define your deployment pipelines to enable continuous delivery for | ||
your gitops applications. | ||
|
||
As part of Weave GitOps Enterprise, you can | ||
|
||
- [Define a delivery pipeline](../getting-started/#define-a-pipeline) that you want you application to follow | ||
- [View a pipeline](../getting-started/#view-pipeline-list) and check the status of your deployments. | ||
|
||
Now that you know what delivery pipelines can do for you, follow the [guide to get started](../getting-started). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"label": "Reference", | ||
"position": 2 | ||
} |
167 changes: 167 additions & 0 deletions
167
website/docs/enterprise/pipelines/spec/v1alpha1/pipeline.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
--- | ||
title: Pipeline | ||
sidebar_position: 1 | ||
hide_title: true | ||
--- | ||
# Pipeline <TierLabel tiers="enterprise" /> | ||
|
||
The Pipeline API defines a resource for continuous delivery pipelines. | ||
|
||
An example of a fully defined pipeline is shown below. | ||
|
||
```yaml | ||
apiVersion: pipelines.weave.works/v1alpha1 | ||
kind: Pipeline | ||
metadata: | ||
name: podinfo-02 | ||
namespace: default | ||
spec: | ||
appRef: | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
name: podinfo | ||
environments: | ||
- name: dev | ||
targets: | ||
- namespace: podinfo-02-dev | ||
clusterRef: | ||
kind: GitopsCluster | ||
name: dev | ||
namespace: flux-system | ||
- name: test | ||
targets: | ||
- namespace: podinfo-02-qa | ||
clusterRef: | ||
kind: GitopsCluster | ||
name: dev | ||
namespace: flux-system | ||
- namespace: podinfo-02-perf | ||
clusterRef: | ||
kind: GitopsCluster | ||
name: dev | ||
namespace: flux-system | ||
- name: prod | ||
targets: | ||
- namespace: podinfo-02-prod | ||
clusterRef: | ||
kind: GitopsCluster | ||
name: prod | ||
namespace: flux-system | ||
``` | ||
## Specification | ||
The documentation for version `v1alpha1` of a `Pipeline` resource is found next. | ||
|
||
### Pipeline | ||
|
||
|
||
```go | ||
// Pipeline is the Schema for the pipelines API | ||
type Pipeline struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec PipelineSpec `json:"spec,omitempty"` | ||
// +kubebuilder:default={"observedGeneration":-1} | ||
Status PipelineStatus `json:"status,omitempty"` | ||
} | ||
|
||
type PipelineSpec struct { | ||
// Environments is a list of environments to which the pipeline's application is supposed to be deployed. | ||
// +required | ||
Environments []Environment `json:"environments"` | ||
// AppRef denotes the name and type of the application that's governed by the pipeline. | ||
// +required | ||
AppRef LocalAppReference `json:"appRef"` | ||
} | ||
|
||
type Environment struct { | ||
// Name defines the name of this environment. This is commonly something such as "dev" or "prod". | ||
// +required | ||
Name string `json:"name"` | ||
// Targets is a list of targets that are part of this environment. Each environment should have | ||
// at least one target. | ||
// +required | ||
Targets []Target `json:"targets"` | ||
} | ||
|
||
type Target struct { | ||
// Namespace denotes the namespace of this target on the referenced cluster. This is where | ||
// the app pointed to by the environment's `appRef` is searched. | ||
// +required | ||
Namespace string `json:"namespace"` | ||
// ClusterRef points to the cluster that's targeted by this target. If this field is not set, then the target is assumed | ||
// to point to a Namespace on the cluster that the Pipeline resources resides on (i.e. a local target). | ||
// +optional | ||
ClusterRef *CrossNamespaceClusterReference `json:"clusterRef,omitempty"` | ||
} | ||
|
||
``` | ||
|
||
### References | ||
|
||
```go | ||
// LocalAppReference is used together with a Target to find a single instance of an application on a certain cluster. | ||
type LocalAppReference struct { | ||
// API version of the referent. | ||
// +required | ||
APIVersion string `json:"apiVersion"` | ||
|
||
// Kind of the referent. | ||
// +required | ||
Kind string `json:"kind"` | ||
|
||
// Name of the referent. | ||
// +required | ||
Name string `json:"name"` | ||
} | ||
|
||
// CrossNamespaceClusterReference contains enough information to let you locate the | ||
// typed Kubernetes resource object at cluster level. | ||
type CrossNamespaceClusterReference struct { | ||
// API version of the referent. | ||
// +optional | ||
APIVersion string `json:"apiVersion,omitempty"` | ||
|
||
// Kind of the referent. | ||
// +required | ||
Kind string `json:"kind"` | ||
|
||
// Name of the referent. | ||
// +required | ||
Name string `json:"name"` | ||
|
||
// Namespace of the referent, defaults to the namespace of the Kubernetes resource object that contains the reference. | ||
// +optional | ||
Namespace string `json:"namespace,omitempty"` | ||
} | ||
``` | ||
|
||
### Status | ||
|
||
```go | ||
type PipelineStatus struct { | ||
// ObservedGeneration is the last observed generation. | ||
// +optional | ||
ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
|
||
// Conditions holds the conditions for the Pipeline. | ||
// +optional | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
} | ||
``` | ||
|
||
#### Condition Reasons | ||
```go | ||
// Reasons are provided as utility, and are not part of the declarative API. | ||
const ( | ||
// TargetClusterNotFoundReason signals a failure to locate a cluster resource on the management cluster. | ||
TargetClusterNotFoundReason string = "TargetClusterNotFound" | ||
// TargetClusterNotReadyReason signals that a cluster pointed to by a Pipeline is not ready. | ||
TargetClusterNotReadyReason string = "TargetClusterNotReady" | ||
// ReconciliationSucceededReason signals that a Pipeline has been successfully reconciled. | ||
ReconciliationSucceededReason string = "ReconciliationSucceeded" | ||
) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters