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

adding logic to deployablebyolm to validate packagename #1167

Merged

Conversation

acornett21
Copy link
Contributor

@acornett21 acornett21 commented May 15, 2024

Testing

  • Stage ProjectID: 664646cee2c5eef0d5b58e40
  • Files with prefixed name uploaded successfully
    Screenshot from 2024-05-16 13-51-35

Copy link

openshift-ci bot commented May 15, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 15, 2024
@dcibot
Copy link

dcibot commented May 15, 2024

@acornett21 acornett21 changed the title adding logic to deployablebyolm to validate that packagename complies… adding logic to deployablebyolm to validate that packagename May 15, 2024
@acornett21 acornett21 changed the title adding logic to deployablebyolm to validate that packagename adding logic to deployablebyolm to validate packagename May 15, 2024
@dcibot
Copy link

dcibot commented May 15, 2024

appName := packageName
if msgs := validation.IsDNS1035Label(packageName); len(msgs) != 0 {
logger.V(log.DBG).Info(fmt.Sprintf("package name %s does not comply with DNS-1035, prefixing to avoid errors", packageName))
appName = "preflight-" + packageName
Copy link
Contributor

@komish komish May 15, 2024

Choose a reason for hiding this comment

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

Why are we prefixing this here instead of just failing this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need the operator to still be able to be installed to avoid this error being thrown by k8s further along in the process.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd go for a shorter prefix... pflt- or even p-. You don't want to possibly hit a long one and end up failing because it goes beyond 63.

Copy link
Contributor

Choose a reason for hiding this comment

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

Either:
a) Make this prefix shorter and validate that it fixes the problem before use (by re-running the isDNS!035Label func again on the new value), or
b) Generate the name used to create the catalog source in a way that's reliably formed.

@acornett21 acornett21 force-pushed the validate_packagename branch 2 times, most recently from c76c6e4 to 5b50039 Compare May 15, 2024 18:17
@dcibot
Copy link

dcibot commented May 15, 2024

… with DNS-1035 labeling, ensuring that CatalogSources can be created

Signed-off-by: Adam D. Cornett <adc@redhat.com>
@acornett21 acornett21 marked this pull request as ready for review May 15, 2024 20:26
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 15, 2024
@openshift-ci openshift-ci bot requested review from komish and skattoju May 15, 2024 20:27
@dcibot
Copy link

dcibot commented May 15, 2024

appName := packageName
if msgs := validation.IsDNS1035Label(packageName); len(msgs) != 0 {
logger.V(log.DBG).Info(fmt.Sprintf("package name %s does not comply with DNS-1035, prefixing to avoid errors", packageName))
appName = "p-" + packageName
Copy link
Contributor

Choose a reason for hiding this comment

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

This still needs to be re-run through the DNS label validation. Prefixing the value just fixes one possible invalid scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@komish Are you sure? In my testing, and our tests, this fixes both issues that are thrown. Also, if we re-validate, and it fails, then what do we do?

Copy link
Contributor

Choose a reason for hiding this comment

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

What if the package is called 1app_package

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose this is non-blocking. You're addressing a specific failure that exists, and what I'm asking is a potential (but non-existent) future state. We already have an example in the wild that needs this workaround, but we haven't had an example of what I'm asking you to do yet, and it's unlikely we would given certification would fail if the CatalogSource doesn't come up.

LGTM given

Copy link
Contributor Author

@acornett21 acornett21 May 16, 2024

Choose a reason for hiding this comment

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

I think if the above is the case, we'd want this to fail, since that name probably can't be used in other processes. Right now, we really are just trying to solve for the one case for 3scale.

Copy link
Contributor

@komish komish 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 openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 16, 2024
Copy link
Contributor

@bcrochet bcrochet left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link

openshift-ci bot commented May 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: acornett21, bcrochet, komish, skattoju

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:
  • OWNERS [acornett21,bcrochet,komish,skattoju]

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

@bcrochet bcrochet merged commit 354d10d into redhat-openshift-ecosystem:main May 20, 2024
5 checks passed
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants