Skip to content

Conversation

@vinamra28
Copy link
Member

@vinamra28 vinamra28 commented Sep 24, 2021

Changes

Currently we were reading the component version from CRD but with
Pipelines version 0.25.x release and Triggers 0.15.x release the version
information is available in a ConfigMap and anyone who is
system:authenticated can read the version from ConfigMap. If the
configmap is not present then return Unknown as the version.

Closes #413

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.

Release Notes

Fetch release version from ConfigMap for Pipelines and Triggers and if ConfigMap not available then return Unknown.

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Sep 24, 2021
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 24, 2021
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 78.3% -0.3

@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 25, 2021
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 87.0% 8.4

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 93.3% 14.8

@sm43
Copy link
Member

sm43 commented Sep 27, 2021

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 27, 2021
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 93.3% 14.8

Comment on lines 34 to 57
if len(configMaps.Resources()) == 0 {
return "", fmt.Errorf("failed to find ConfigMap %s to get release version", configMapName)
}

crd := crds.Resources()[0]
version, ok := crd.GetLabels()[releaseLabel]
if !ok {
return version, fmt.Errorf("failed to find release label on crd")
versionConfigMap := configMaps.Resources()[0]
dataObj, _, _ := unstructured.NestedStringMap(versionConfigMap.Object, "data")
version := dataObj["version"]

if version != "" {
return version, nil
}

return version, nil
return "", fmt.Errorf("failed to find version data field on ConfigMap %s", configMapName)
}
Copy link
Member

Choose a reason for hiding this comment

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

@vinamra28 when version is unknown (configmap not exist, or version field not exist) let us return unknown, instead of returning error.

Let us not return error and block/break installation for this reason. 🧑‍💻

Copy link
Member Author

Choose a reason for hiding this comment

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

@nikhil-thomas maybe we can return error from here and handle that in TektonPipeline and TektonTriggers controller. This way our error would be logged and we can set version to unknown over there. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

like ⬇️

                var releaseVersion string = "unknown"

		// Read the release version of pipelines
		releaseVersion, err = common.FetchVersionFromConfigMap(manifest, versionConfigMap)
		if err != nil {
			logger.Infow("failed to read release version from ConfigMap", err)
		}

Copy link
Member

Choose a reason for hiding this comment

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

this could work,
but i would make it an internal implementation detail of releaseVersion(), because this error handling doesn't add more claritiy to the reconciler flow. 🧑‍💻

Copy link
Member

Choose a reason for hiding this comment

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

if you have already made this update, go ahead an push it. this should be fine 👍

Copy link
Member

@sm43 sm43 Sep 27, 2021

Choose a reason for hiding this comment

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

why do we wanna show unknown? in what case that would happen?
nightly, release version, dev release yaml
all have version set with some value.
then if version is not set then doesn't it mean something is wrong?

Copy link
Member

@nikhil-thomas nikhil-thomas Sep 27, 2021

Choose a reason for hiding this comment

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

then if version is not set then doesn't it mean something is wrong?

yes, but as this won't affect any critical functionality.
can we just do a warning. is the error and break necessary.

Copy link
Member

Choose a reason for hiding this comment

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

in addition, we will see the Unknown value in the CR status, i think that could be the necessary indicator that something is wrong 😇

Copy link
Member

@sm43 sm43 Sep 28, 2021

Choose a reason for hiding this comment

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

this won't affect any critical functionality

if the release yaml is missing something then it can !!
i don't mind keeping it this way 😄 ... but if we assume version is missing i.e. something is wrong with release yaml and still we allow everything to install then we might break an existing working pipelines, triggers
if we stop then only operator would fail !

Copy link
Member

Choose a reason for hiding this comment

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

we can "type" the error and have a IsUnknow error check. From this part of the code perspective, it make sense to return an error. The consumer of this is the one with the responsability to handle it.

@nikhil-thomas
Copy link
Member

/block

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 27, 2021
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 93.3% 14.8

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 93.3% 14.8

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 93.3% 14.8

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 87.5% 8.9

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 87.5% 8.9

@nikhil-thomas
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 5, 2021
@nikhil-thomas
Copy link
Member

/hold

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 5, 2021
@nikhil-thomas
Copy link
Member

adding a hold as @vinamra28 is making a minor change.

@vinamra28 please feel free to remove this hold at any point (with or without changes)

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 5, 2021
Currently we were reading the component version from CRD but with
Pipelines version 0.25.x release and Triggers 0.15.x release the version
information is available in a ConfigMap and anyone who is
system:authenticated can read the version from ConfigMap. If the
configmap is not present then return Unknown as the version.
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 87.5% 8.9

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/utils.go 78.6% 87.5% 8.9

@vinamra28
Copy link
Member Author

adding a hold as @vinamra28 is making a minor change.

@vinamra28 please feel free to remove this hold at any point (with or without changes)

thanks @nikhil-thomas for this 👍
did the changes.
/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 5, 2021
@nikhil-thomas
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2021
@nikhil-thomas
Copy link
Member

/approve

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nikhil-thomas

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

The pull request process is described here

Details 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 Oct 6, 2021
@tekton-robot tekton-robot merged commit f2113b6 into tektoncd:main Oct 6, 2021
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. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read component version from configmap instead of CRD label

5 participants