weaveworks / pipeline-controller

This repository contains the Pipeline CRD and associated controller for Weave GitOps Enterprise.
1 stars 4 forks source link

Pipeline Template - isolation by namespace #41

Closed sympatheticmoose closed 1 year ago

sympatheticmoose commented 2 years ago

AC

template created and tested we could create pipeline review with path functionality shipped as part of the getting started templates documentation updated

Sample:

apiVersion: clustertemplates.weave.works/v1alpha1
kind: GitOpsTemplate
metadata:
  name: pipeline
  namespace: default
  annotations: # may be able to remove following https://github.com/weaveworks/weave-gitops-enterprise/issues/1730
    templates.weave.works/profiles-enabled: false
    templates.weave.works/kustomizations-enabled: false
    templates.weave.works/credentials-enabled: false
  labels:
    weave.works/template-type: pipeline #used to determine 'Type'
spec:
  description: Creates an application Pipeline
  params:
  #metadata
    - name: PIPELINE_NAME
      description: Name of Pipeline
    - name: PIPELINE_NAMESPACE
  #Appdata
    - name: APP_NAME
      description: Name of the HelmRelease for your application
    - name: APP_NAMESPACE
      description: Namespace for the HelmRelease
    - name: APP_REPO_URL
      description: URL for source of HelmRelease in Git
    - name: APP_REPO_BRANCH
      description: Branch to write updates to in Git
    - name: GIT_TOKEN_SECRET
      description: Name of the secret containing PAT for Git
  resourcetemplates:
  - apiVersion: pipelines.weave.works/v1alpha1
    kind: ${PIPELINE_NAME}
    metadata:
      name: ${PIPELINE_NAME}
      namespace: ${PIPELINE_NAMESPACE}
    spec:
      appRef:
        apiVersion: helm.toolkit.fluxcd.io/v2beta1
        kind: HelmRelease
        name: ${APP_NAME}
      environments:
      - name: dev
        targets:
          - namespace: ${APP_NAMESPACE}
            clusterRef:
              kind: GitopsCluster
              name: dev
              namespace: flux-system
      - name: test
        targets:
          - namespace: ${APP_NAMESPACE}
            clusterRef:
              kind: GitopsCluster
              name: QA
              namespace: flux-system
          - namespace: ${APP_NAMESPACE}
            clusterRef:
              kind: GitopsCluster
              name: Perf
              namespace: flux-system
      - name: prod
        targets:
          - namespace: ${APP_NAMESPACE}
            clusterRef:
              kind: GitopsCluster
              name: prod
              namespace: flux-system
    promotion:
      pull-request:
        branch: ${APP_REPO_BRANCH}
        secretRef:
          name: ${GIT_TOKEN_SECRET}
        url: ${APP_REPO_URL}
enekofb commented 1 year ago

what is the AC of this issue, in particular, we expect that a user using this template is

If promoting is within the AC there is an overlap or dependency with https://github.com/weaveworks/pipeline-controller/issues/43

If feels that the AC for this should only cover the viewing outcome

sympatheticmoose commented 1 year ago

@enekofb given this follows on from 0.2 which introduces the promotion, I expect the template to include that capability. Whilst there is a relationship with #43 I do not see this as dependency or overlap. This particular template requires leaf cluster resources necessary for promotion to be present by whatever mechanism, that also includes the Source/HelmRelease which is not part of #43.

sympatheticmoose commented 1 year ago

Cancelling as part of 0.3 before we have the path function in templates

enekofb commented 1 year ago

PR to review https://github.com/weaveworks/weave-gitops-quickstart/pull/1