Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the custom "name" parameter from cluster resources. #1474

Merged
merged 1 commit into from
Nov 26, 2019

Conversation

dlorenc
Copy link
Contributor

@dlorenc dlorenc commented Oct 25, 2019

Changes

This is redundant with the Name that Tasks already declare on Resources.
The name is used both to name the cluster in the kubeconfig and to set the
path for the kubeconfig. Using a name on the resource itself means Tasks can't
know where to expect this file.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

The 'name' parameter to the cluster resource is now deprecated. Please use the standard name parameter on the Task Resource binding instead.

@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Oct 25, 2019
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 25, 2019
@dlorenc dlorenc force-pushed the morecluster branch 2 times, most recently from d52ebb8 to 9820b08 Compare October 25, 2019 15:32
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the name param - see also #492 and #431

pkg/apis/pipeline/v1alpha1/cluster_resource.go Outdated Show resolved Hide resolved
@@ -62,11 +62,12 @@ func NewClusterResource(kubeconfigWriterImage string, r *PipelineResource) (*Clu
clusterResource := ClusterResource{
Type: r.Spec.Type,
KubeconfigWriterImage: kubeconfigWriterImage,
Name: r.Name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand this correctly, this uses the resource name as cluster name. Unfortunately this is not OK - which is the reason the name parameter was added - because the resource name must be a DNS valid name, while the cluster name may be not a valid DNS one e.g. my_cluster is a valid cluster name, but not a valid resource name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks for the explanation. Can you explain why the cluster name matters in your case?

Leaving the name parameter would be fine I think as long as we write to the /workspace/resource-name path instead of the /workspace/cluster-name-param path.

I can't actually see the use case for cluster name though - it's only used inside the .kubeconfig AFAICT, and can be literally anything.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, indeed it doesn't seem to matter at all, sorry about my bad review :(

@afrittoli
Copy link
Member

I tested if the cluster name is used at all when connecting to a OpenShift cluster on IBM Cloud - and it is not - see the cluster name set to foobar

$ tkn resource describe andreaf-tekton
Name:                    andreaf-tekton
Namespace:               default
PipelineResource Type:   cluster

Params
NAME       VALUE
name       foobar
url        [xyz]
username   release-testing
cadata

Secret Params
FIELDNAME   SECRETNAME
token       release-testing-token-txdjz
$ tkn task start test-cluster -i k8s-cluster=andreaf-tekton
Taskrun started: test-cluster-run-b2bn8
Showing logs...
Task still running ...

[deploy-tekton-project] + tkn resource list
[deploy-tekton-project] NAME   TYPE   DETAILS
[deploy-tekton-project] test   git    url: https://github.com/tektoncd/pipeline

@afrittoli afrittoli dismissed their stale review November 26, 2019 14:31

The name of the cluster is actually not used

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.
Since this is done in a backward compatible way, it should be fine to merge it in v0.9.0

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2019
@bobcatfish
Copy link
Collaborator

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bobcatfish

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 26, 2019
@bobcatfish
Copy link
Collaborator

testing.tRunner
==================
WARNING: DATA RACE
Write at 0x00c0005c2fa0 by goroutine 57:
  github.com/tektoncd/pipeline/pkg/reconciler/taskrun.(*Reconciler).updateStatus()
      /go/src/github.com/tektoncd/pipeline/pkg/reconciler/taskrun/taskrun.go:428 +0x33e
  github.com/tektoncd/pipeline/pkg/reconciler/taskrun.(*Reconciler).updateStatusLabelsAndAnnotations()
      /go/src/github.com/tektoncd/pipeline/pkg/reconciler/taskrun/taskrun.go:172 +0x550
  github.com/tektoncd/pipeline/pkg/reconciler/taskrun.(*Reconciler).Reconcile()
      /go/src/github.com/tektoncd/pipeline/pkg/reconciler/taskrun/taskrun.go:161 +0xcfe
  github.com/tektoncd/pipeline/pkg/reconciler/taskrun.TestReconcile_ExplicitDefaultSA.func1()
      /go/src/github.com/tektoncd/pipeline/pkg/reconciler/taskrun/taskrun_test.go:385 +0x682
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:909 +0x199

🏎️

This is redundant with the Name that Tasks already declare on Resources.
The name is used both to name the cluster in the kubeconfig and to set the
path for the kubeconfig. Using a name on the resource itself means Tasks can't
know where to expect this file.
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2019
@bobcatfish
Copy link
Collaborator

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2019
@tekton-robot tekton-robot merged commit 124f101 into tektoncd:master Nov 26, 2019
dlorenc added a commit to dlorenc/build-pipeline that referenced this pull request Dec 3, 2019
This was deprecated in tektoncd#1474 which was released in 0.9.0. It can safely
be deleted in the next release.
dlorenc added a commit to dlorenc/build-pipeline that referenced this pull request Dec 3, 2019
This was deprecated in tektoncd#1474 which was released in 0.9.0. It can safely
be deleted in the next release.
tekton-robot pushed a commit that referenced this pull request Dec 4, 2019
This was deprecated in #1474 which was released in 0.9.0. It can safely
be deleted in the next release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants