apiVersion: v1
kind: Namespace
metadata:
  name: knative-build-pipeline

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: knative-build-pipeline-admin
rules:
- apiGroups:
  - ""
  resources:
  - pods
  - namespaces
  - secrets
  - events
  - serviceaccounts
  - configmaps
  - persistentvolumeclaims
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - extensions
  resources:
  - deployments
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - admissionregistration.k8s.io
  resources:
  - mutatingwebhookconfigurations
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - pipeline.knative.dev
  resources:
  - tasks
  - clustertasks
  - taskruns
  - pipelines
  - pipelineruns
  - pipelineresources
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch
- apiGroups:
  - build.knative.dev
  resources:
  - builds
  - buildtemplates
  - clusterbuildtemplates
  verbs:
  - get
  - list
  - create
  - update
  - delete
  - patch
  - watch

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: build-pipeline-controller
  namespace: knative-build-pipeline

---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: build-pipeline-controller-admin
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: knative-build-pipeline-admin
subjects:
- kind: ServiceAccount
  name: build-pipeline-controller
  namespace: knative-build-pipeline

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: clustertasks.pipeline.knative.dev
spec:
  group: pipeline.knative.dev
  names:
    categories:
    - all
    - knative
    - build-pipeline
    kind: ClusterTask
    plural: clustertasks
  scope: Cluster
  version: v1alpha1

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: images.caching.internal.knative.dev
spec:
  group: caching.internal.knative.dev
  names:
    categories:
    - all
    - knative-internal
    - caching
    kind: Image
    plural: images
    shortNames:
    - img
    singular: image
  scope: Namespaced
  version: v1alpha1

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: pipelines.pipeline.knative.dev
spec:
  group: pipeline.knative.dev
  names:
    categories:
    - all
    - knative
    - build-pipeline
    kind: Pipeline
    plural: pipelines
  scope: Namespaced
  version: v1alpha1

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: pipelineruns.pipeline.knative.dev
spec:
  group: pipeline.knative.dev
  names:
    categories:
    - all
    - knative
    - build-pipeline
    kind: PipelineRun
    plural: pipelineruns
  scope: Namespaced
  version: v1alpha1

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: pipelineresources.pipeline.knative.dev
spec:
  group: pipeline.knative.dev
  names:
    categories:
    - all
    - knative
    - build-pipeline
    kind: PipelineResource
    plural: pipelineresources
  scope: Namespaced
  version: v1alpha1

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: tasks.pipeline.knative.dev
spec:
  group: pipeline.knative.dev
  names:
    categories:
    - all
    - knative
    - build-pipeline
    kind: Task
    plural: tasks
  scope: Namespaced
  version: v1alpha1

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: taskruns.pipeline.knative.dev
spec:
  group: pipeline.knative.dev
  names:
    categories:
    - all
    - knative
    - build-pipeline
    kind: TaskRun
    plural: taskruns
  scope: Namespaced
  version: v1alpha1

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: build-pipeline-controller
  name: build-pipeline-controller
  namespace: knative-build-pipeline
spec:
  ports:
  - name: metrics
    port: 9090
    protocol: TCP
    targetPort: 9090
  selector:
    app: build-pipeline-controller

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: build-pipeline-webhook
  name: build-pipeline-webhook
  namespace: knative-build-pipeline
spec:
  ports:
  - port: 443
    targetPort: 443
  selector:
    app: build-pipeline-webhook

---
apiVersion: v1
data:
  image: gcr.io/k8s-prow/entrypoint@sha256:7c7cd8906ce4982ffee326218e9fc75da2d4896d53cabc9833b9cc8d2d6b2b8f
kind: ConfigMap
metadata:
  name: config-entrypoint
  namespace: knative-build-pipeline

---
apiVersion: v1
data:
  loglevel.controller: info
  loglevel.webhook: info
  zap-logger-config: |
    {
      "level": "info",
      "development": false,
      "sampling": {
        "initial": 100,
        "thereafter": 100
      },
      "outputPaths": ["stdout"],
      "errorOutputPaths": ["stderr"],
      "encoding": "json",
      "encoderConfig": {
        "timeKey": "",
        "levelKey": "level",
        "nameKey": "logger",
        "callerKey": "caller",
        "messageKey": "msg",
        "stacktraceKey": "stacktrace",
        "lineEnding": "",
        "levelEncoder": "",
        "timeEncoder": "",
        "durationEncoder": "",
        "callerEncoder": ""
      }
    }
kind: ConfigMap
metadata:
  name: config-logging
  namespace: knative-build-pipeline

---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: build-pipeline-controller
  namespace: knative-build-pipeline
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: build-pipeline-controller
    spec:
      containers:
      - args:
        - -logtostderr
        - -stderrthreshold
        - INFO
        - -kubeconfig-writer-image
        - gcr.io/knative-nightly/github.com/knative/build-pipeline/cmd/kubeconfigwriter@sha256:53894f6a04bc99e62d997abbe57dd2d9f91136494c238c6a9a69d79cfe0ffcef
        - -creds-image
        - gcr.io/knative-nightly/github.com/knative/build-pipeline/cmd/creds-init@sha256:73fd4023ef851042c735f8ca99b98a49a4e77ad4c77f0d5c011e6891c0831fba
        - -git-image
        - gcr.io/knative-nightly/github.com/knative/build-pipeline/cmd/git-init@sha256:4c6e5f20082b6ea9535868b966acb525c922dbc7bac426bd34b3866574f0bd6d
        - -nop-image
        - gcr.io/knative-nightly/github.com/knative/build-pipeline/cmd/nop@sha256:e42e333401b498a83a695f8671231cb24ceb1dd2a90e7983bc02cab24f21e5d3
        - -bash-noop-image
        - gcr.io/knative-nightly/github.com/knative/build-pipeline/cmd/bash@sha256:b48c5ede317f096ef78cd68f6703b9c04086aa4ce6765851bb0650b3a8d1db66
        - -gsutil-image
        - gcr.io/knative-nightly/github.com/knative/build-pipeline/cmd/gsutil@sha256:fb7e55f7ac5f8de109a9edfbcfc99bba55ae4391fa42396a40f9bd85142e0fc4
        image: gcr.io/knative-nightly/github.com/knative/build-pipeline/cmd/controller@sha256:e8905ab8e1d9a5d7c737814076e3cd5dff1b510280417e512db123d11361a46d
        name: build-pipeline-controller
        volumeMounts:
        - mountPath: /etc/config-logging
          name: config-logging
      serviceAccountName: build-pipeline-controller
      volumes:
      - configMap:
          name: config-logging
        name: config-logging

---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: build-pipeline-webhook
  namespace: knative-build-pipeline
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: build-pipeline-webhook
    spec:
      containers:
      - image: gcr.io/knative-nightly/github.com/knative/build-pipeline/cmd/webhook@sha256:99fe6c98d81dcddd6853e56541dee5435659e35b22ab81773031de5165f29da4
        name: webhook
        volumeMounts:
        - mountPath: /etc/config-logging
          name: config-logging
      serviceAccountName: build-pipeline-controller
      volumes:
      - configMap:
          name: config-logging
        name: config-logging

---
