Repository: kubeflow/kfp-tekton (language: python)

Issue:
Feat(pipelineloop): upgrade to tekton version 0.43.2, tekton v1beta1 customRun .
**Which issue is resolved by this Pull Request:** 
Resolves #1113 

**Description of your changes:**

**Environment tested:**

* Python Version (use `python --version`):
* Tekton Version (use `tkn version`):
* Kubernetes Version (use `kubectl version`):
* OS (e.g. from `/etc/os-release`):

**Checklist:**
- [ ] The title for your pull request (PR) should follow our title convention. [Learn more about the pull request title convention used in this repository](https://github.com/kubeflow/pipelines/blob/master/CONTRIBUTING.md#pull-request-title-convention). 
<!--
   PR titles examples:
    * `fix(frontend): fixes empty page. Fixes #1234`
       Use `fix` to indicate that this PR fixes a bug.
    * `feat(backend): configurable service account. Fixes #1234, fixes #1235`
       Use `feat` to indicate that this PR adds a new feature. 
    * `chore: set up changelog generation tools`
       Use `chore` to indicate that this PR makes some changes that users don't need to know.
    * `test: fix CI failure. Part of #1234`
        Use `part of` to indicate that a PR is working on an issue, but shouldn't close the issue when merged.
-->



Discussion / hints:
[APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubeflow/kfp-tekton/pull/1119#" title="Author self-approved">ScrapCodes</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubeflow%2Fkfp-tekton).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubeflow/kfp-tekton/blob/master/OWNERS)~~ [ScrapCodes]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
@ScrapCodes this PR looks good to me right now. Although there are few examples we need to change from run to customrun, but that can be done in a separate PR. Is there anything else you want to add to this PR?
/lgtm
/hold

@ScrapCodes feel free to unhold it if you think this PR is ready
/unhold

@ScrapCodes I will be merging this first since the api pr is huge.

Fix patch:
diff --git a/manifests/kustomize/third-party/tekton-custom-task/pipeline-loops/201-clusterrole.yaml b/manifests/kustomize/third-party/tekton-custom-task/pipeline-loops/201-clusterrole.yaml
index c4514eeaf6..609d67d398 100644
--- a/manifests/kustomize/third-party/tekton-custom-task/pipeline-loops/201-clusterrole.yaml
+++ b/manifests/kustomize/third-party/tekton-custom-task/pipeline-loops/201-clusterrole.yaml
@@ -9,10 +9,10 @@ metadata:
 rules:
     # Controller needs cluster access to all of the CRDs that it is responsible for managing.
   - apiGroups: ["tekton.dev"]
-    resources: ["runs", "taskruns", "pipelineruns"]
+    resources: ["runs", "customruns", "taskruns", "pipelineruns"]
     verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
   - apiGroups: ["tekton.dev"]
-    resources: ["runs/status", "taskruns/status", "pipelineruns/status", "runs/finalizers"]
+    resources: ["runs/status", "customruns/status", "taskruns/status", "pipelineruns/status", "runs/finalizers", "customruns/finalizers",]
     verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
   - apiGroups: ["custom.tekton.dev"]
     resources: ["pipelineloops"]
@@ -49,6 +49,9 @@ rules:
   - apiGroups: ["apiextensions.k8s.io"]
     resources: ["customresourcedefinitions", "customresourcedefinitions/status"]
     verbs: ["get", "list", "update", "patch", "watch"]
+  - apiGroups: [""]
+    resources: ["namespaces"]
+    verbs: ["get", "list", "update", "patch", "watch"]
   - apiGroups: ["admissionregistration.k8s.io"]
     # The webhook performs a reconciliation on these two resources and continuously
     # updates configuration.
diff --git a/manifests/kustomize/third-party/tekton/upstream/manifests/base/tektoncd-install/tekton-config.yaml b/manifests/kustomize/third-party/tekton/upstream/manifests/base/tektoncd-install/tekton-config.yaml
index 8ec837133b..7fab8a8f39 100644
--- a/manifests/kustomize/third-party/tekton/upstream/manifests/base/tektoncd-install/tekton-config.yaml
+++ b/manifests/kustomize/third-party/tekton/upstream/manifests/base/tektoncd-install/tekton-config.yaml
@@ -9,3 +9,4 @@ metadata:
 data:
   enable-custom-tasks: "true"
   embedded-status: "full"
+  custom-task-version: "v1beta1"
diff --git a/tekton-catalog/pipeline-loops/config/201-clusterrole.yaml b/tekton-catalog/pipeline-loops/config/201-clusterrole.yaml
index 341e977908..7b10f3cb6b 100644
--- a/tekton-catalog/pipeline-loops/config/201-clusterrole.yaml
+++ b/tekton-catalog/pipeline-loops/config/201-clusterrole.yaml
@@ -23,10 +23,10 @@ metadata:
 rules:
     # Controller needs cluster access to all of the CRDs that it is responsible for managing.
   - apiGroups: ["tekton.dev"]
-    resources: ["runs", "taskruns", "pipelineruns"]
+    resources: ["runs", "customruns", "taskruns", "pipelineruns"]
     verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
   - apiGroups: ["tekton.dev"]
-    resources: ["runs/status", "taskruns/status", "pipelineruns/status", "runs/finalizers"]
+    resources: ["runs/status", "customruns/status", "taskruns/status", "pipelineruns/status", "runs/finalizers", "customruns/finalizers",]
     verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
   - apiGroups: ["custom.tekton.dev"]
     resources: ["pipelineloops"]
@@ -63,6 +63,9 @@ rules:
   - apiGroups: ["apiextensions.k8s.io"]
     resources: ["customresourcedefinitions", "customresourcedefinitions/status"]
     verbs: ["get", "list", "update", "patch", "watch"]
+  - apiGroups: [""]
+    resources: ["namespaces"]
+    verbs: ["get", "list", "update", "patch", "watch"]
   - apiGroups: ["admissionregistration.k8s.io"]
     # The webhook performs a reconciliation on these two resources and continuously
     # updates configuration.
diff --git a/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelinelooprun.go b/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelinelooprun.go
index 3e2ce8f46b..a9df0f7f4e 100644
--- a/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelinelooprun.go
+++ b/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelinelooprun.go
@@ -663,7 +663,7 @@ func (c *Reconciler) createPipelineRun(ctx context.Context, logger *zap.SugaredL
 			Name:      prName,
 			Namespace: run.Namespace,
 			OwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(run,
-				schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha1", Kind: "Run"})},
+				schema.GroupVersionKind{Group: "tekton.dev", Version: "v1beta1", Kind: "CustomRun"})},
 			Labels:      getPipelineRunLabels(run, strconv.Itoa(iteration)),
 			Annotations: pipelineRunAnnotations,
 		},


Test patch:
diff --git a/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelineloop_range_test.go b/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelineloop_range_test.go
index 0079c33da1..b678c4e0ff 100644
--- a/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelineloop_range_test.go
+++ b/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelineloop_range_test.go
@@ -37,8 +37,8 @@ var expectedPipelineRunWithRange1 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -73,8 +73,8 @@ var expectedPipelineRunWithRange2 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -108,8 +108,8 @@ var expectedPipelineRunWithRange3 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
diff --git a/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelinelooprun_test.go b/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelinelooprun_test.go
index 520ddccc7f..ba87b78add 100644
--- a/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelinelooprun_test.go
+++ b/tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelinelooprun_test.go
@@ -1046,8 +1046,8 @@ var expectedPipelineRunIterationDict = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1085,8 +1085,8 @@ var expectedParaPipelineRun = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1121,8 +1121,8 @@ var expectedParaPipelineRun1 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00002-mz4c7",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1157,8 +1157,8 @@ var expectedPipelineRunIteration1 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1193,8 +1193,8 @@ var expectedPipelineRunIterationEmptySpace = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1229,8 +1229,8 @@ var expectedPipelineRunIterationWithWhiteSpace = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1265,8 +1265,8 @@ var expectedPipelineRunFailed = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-failed",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1301,8 +1301,8 @@ var expectedPipelineRunRetry = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1337,8 +1337,8 @@ var expectedPipelineRunIterateNumeric1 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1373,8 +1373,8 @@ var expectedPipelineRunIterateNumeric2 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1409,8 +1409,8 @@ var expectedPipelineRunIterateNumericParam = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1446,8 +1446,8 @@ var expectedPipelineRunIteration2 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00002-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1482,8 +1482,8 @@ var expectedPipelineRunWithWorkSpace = &tektonv1beta1.PipelineRun{
 		Name:      "run-ws-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-ws-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1527,8 +1527,8 @@ var expectedPipelineRunWithPodTemplate = &tektonv1beta1.PipelineRun{
 		Name:      "run-new-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-new-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1581,8 +1581,8 @@ var expectedPipelineRunWithInlineTaskIteration1 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-with-inline-task-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop-with-inline-task",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1635,8 +1635,8 @@ var expectedNestedPipelineRun = &tektonv1beta1.PipelineRun{
 		Name:      "nested-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "nested-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,
@@ -1699,8 +1699,8 @@ var expectedConditionPipelineRunIteration1 = &tektonv1beta1.PipelineRun{
 		Name:      "run-pipelineloop-00001-9l9zj",
 		Namespace: "foo",
 		OwnerReferences: []metav1.OwnerReference{{
-			APIVersion:         "tekton.dev/v1alpha1",
-			Kind:               "Run",
+			APIVersion:         "tekton.dev/v1beta1",
+			Kind:               "CustomRun",
 			Name:               "run-pipelineloop",
 			Controller:         &trueB,
 			BlockOwnerDeletion: &trueB,