-
Notifications
You must be signed in to change notification settings - Fork 232
Read component version from ConfigMap #426
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
Conversation
|
The following is the coverage report on the affected files.
|
1d53cb8 to
1c3a75f
Compare
|
The following is the coverage report on the affected files.
|
1c3a75f to
0e3b49f
Compare
|
The following is the coverage report on the affected files.
|
0e3b49f to
056071e
Compare
|
/lgtm |
|
The following is the coverage report on the affected files.
|
| 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) | ||
| } |
There was a problem hiding this comment.
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. 🧑💻
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
}There was a problem hiding this comment.
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. 🧑💻
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😇
There was a problem hiding this comment.
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 !
There was a problem hiding this comment.
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.
|
/block |
056071e to
2bd5f92
Compare
2bd5f92 to
832371e
Compare
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
832371e to
582eb82
Compare
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
|
/lgtm |
|
/hold |
|
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) |
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.
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
thanks @nikhil-thomas for this 👍 |
|
/lgtm |
|
/approve |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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