Skip to content

Conversation

@openshift-cherrypick-robot

This is an automated cherry-pick of #423

/assign awgreene

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>

Co-authored-by: Per Goncalves da Silva <pegoncal@redhat.com>
Upstream-repository: operator-lifecycle-manager
Upstream-commit: 1bdf969e6dff317e975de21078d60dd1406235e0
@openshift-ci-robot
Copy link

@openshift-cherrypick-robot: Jira Issue OCPBUGS-4948 has been cloned as Jira Issue OCPBUGS-5527. Retitling PR to link against new bug.
/retitle [release-4.8] OCPBUGS-5527: Fix label key truncation for subscription annotations (#2731)

Details

In response to this:

This is an automated cherry-pick of #423

/assign awgreene

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot changed the title [release-4.8] OCPBUGS-4948: Fix label key truncation for subscription annotations (#2731) [release-4.8] OCPBUGS-5527: Fix label key truncation for subscription annotations (#2731) Jan 10, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 10, 2023

@openshift-cherrypick-robot: No Bugzilla bug is referenced in the title of this pull request.
To reference a bug, add 'Bug XXX:' to the title of this pull request and request another bug refresh with /bugzilla refresh.

Details

In response to this:

[release-4.8] OCPBUGS-5527: Fix label key truncation for subscription annotations (#2731)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Jan 10, 2023
@openshift-ci-robot
Copy link

@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-5527, which is valid. The bug has been moved to the POST state.

6 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.8.z) matches configured target version for branch (4.8.z)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
  • dependent bug Jira Issue OCPBUGS-4948 is in the state Closed (Done), which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE))
  • dependent Jira Issue OCPBUGS-4948 targets the "4.9.z" version, which is one of the valid target versions: 4.9.0, 4.9.z
  • bug has dependents

Requesting review from QA contact:
/cc @jianzhangbjz

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

This is an automated cherry-pick of #423

/assign awgreene

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@awgreene
Copy link
Contributor

awgreene commented Jan 10, 2023

@grokspawn we spoke about this before Holiday Shutdown, IIRC we had planned to backport this to 4.8 as some operator could hit this issue and SPAM the api server. Can you confirm that we had planned to backport this to 4.8?

@awgreene
Copy link
Contributor

/retest

2 similar comments
@awgreene
Copy link
Contributor

/retest

@awgreene
Copy link
Contributor

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 19, 2023

@openshift-cherrypick-robot: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@awgreene
Copy link
Contributor

/label backport-risk-assessed

@openshift-ci openshift-ci bot added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Jan 28, 2023
@awgreene
Copy link
Contributor

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 28, 2023
@awgreene
Copy link
Contributor

awgreene commented Feb 3, 2023

@jianzhangbjz could you review and add the cherry-pick-approved label?

@dtfranz
Copy link
Contributor

dtfranz commented Feb 3, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 3, 2023
Copy link
Contributor

@tmshort tmshort left a comment

Choose a reason for hiding this comment

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

Depends on whether one has to worry about illegal characters on short names, or only when it's truncated.

Comment on lines +138 to +155

// Remove trailing illegal characters
idx := len(name) - 1
for ; idx >= 0; idx-- {
lastChar := name[idx]
if lastChar != '.' && lastChar != '_' && lastChar != '-' {
break
}
}

// Just being defensive. This is unlikely to happen since the operator name should
// be compatible kubernetes naming constraints
if idx < 0 {
return "", fmt.Errorf(componentLabelKeyError, "unsupported name field")
}

// Update Label
name = name[0 : idx+1]
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why no one seems to:

if name = strings.TrimRight(name[0:63], "._-"); len(name) <= 0 {
    return ....
}

Should the illegal characters be checked outside the len(name) check? Is it possible to set a name with an illegal trailing character? Could that happen?

Copy link
Contributor

@awgreene awgreene Feb 3, 2023

Choose a reason for hiding this comment

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

Not sure why no one seems to:

if name = strings.TrimRight(name[0:63], "._-"); len(name) <= 0 {
return ....
}

I actually prefer your suggestion, but this is a backport of a fix and we attempt to avoid altering the code. We can always create a PR on master to do this though.

Is it possible to set a name with an illegal trailing character? Could that happen?

The kube api server will reject the create request and OLM will constantly try to create it even with the error, which is why we're backporting this.

expectedLabel: "",
returnsError: true,
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't have the case for a small label key with illegal characters...

Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need to fix this in master.

Copy link
Contributor

@tmshort tmshort left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 3, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: awgreene, openshift-cherrypick-robot, tmshort

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

@jianzhangbjz
Copy link
Member

Test pass, details: https://issues.redhat.com/browse/OCPBUGS-5527
/lgtm
/label qe-approved
/label cherry-pick-approved

@openshift-ci openshift-ci bot added qe-approved Signifies that QE has signed off on this PR cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. labels Feb 6, 2023
@openshift-merge-robot openshift-merge-robot merged commit 1250b91 into openshift:release-4.8 Feb 6, 2023
@openshift-ci-robot
Copy link

@openshift-cherrypick-robot: An error was encountered updating to the MODIFIED state for bug OCPBUGS-5527 on the Jira server at https://issues.redhat.com/. No known errors were detected, please see the full error message for details.

Full error message. No transition status with name `MODIFIED` could be found. Please select from the following list: []

Please contact an administrator to resolve this issue, then request a bug refresh with /jira refresh.

Details

In response to this:

This is an automated cherry-pick of #423

/assign awgreene

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@awgreene
Copy link
Contributor

awgreene commented Feb 6, 2023

/jira refresh

@openshift-ci-robot
Copy link

@awgreene: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-5527 has been moved to the MODIFIED state.

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

grokspawn pushed a commit to grokspawn/operator-framework-olm that referenced this pull request Jul 15, 2025
…ift#427)

Upstream-repository: api
Upstream-commit: 56393459804e944ea1107fb8e23e3ef7def801b7
grokspawn pushed a commit to grokspawn/operator-framework-olm that referenced this pull request Jul 15, 2025
…ift#427)

Upstream-repository: api
Upstream-commit: 56393459804e944ea1107fb8e23e3ef7def801b7
grokspawn pushed a commit to grokspawn/operator-framework-olm that referenced this pull request Jul 15, 2025
…ift#427)

Upstream-repository: api
Upstream-commit: 56393459804e944ea1107fb8e23e3ef7def801b7
grokspawn pushed a commit to grokspawn/operator-framework-olm that referenced this pull request Jul 16, 2025
…ift#427)

Upstream-repository: api
Upstream-commit: 56393459804e944ea1107fb8e23e3ef7def801b7
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. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged. qe-approved Signifies that QE has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.