Skip to content

OCPBUGS-45295: Make plugins name array items unique #2117

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jhadvig
Copy link
Member

@jhadvig jhadvig commented Dec 5, 2024

/assign @JoelSpeed

@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-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 5, 2024
@openshift-ci-robot
Copy link

@jhadvig: This pull request references Jira Issue OCPBUGS-45295, which is invalid:

  • expected the bug to target the "4.19.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

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

In response to this:

/assign @JoelSpeed

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

openshift-ci bot commented Dec 5, 2024

Hello @jhadvig! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 5, 2024
Copy link
Contributor

openshift-ci bot commented Dec 6, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jhadvig
Once this PR has been reviewed and has the lgtm label, please ask for approval from joelspeed. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@jhadvig
Copy link
Member Author

jhadvig commented Dec 6, 2024

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 6, 2024
@openshift-ci-robot
Copy link

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

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.19.0) matches configured target version for branch (4.19.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @yapei

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested a review from yapei December 6, 2024 11:12
// +optional
Plugins []string `json:"plugins,omitempty"`
Plugins []PluginName `json:"plugins,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

When did this API ship?

Is there a finite, enumerable list of plugins, that we as RH control?

What happens if the list is not already completely unique? Have you tested this?

Copy link
Member Author

Choose a reason for hiding this comment

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

no its not an enum cause it would be hard to keep track of plugins since they could be provided by 3rd party.

What happens if the list is not already completely unique? Have you tested this?

so console-operator is already taking care of it programatically and makes the set of enabled plugins unique. The issue is mainly in this array, which can cause confusion, when adding plugins with the same name.

@@ -55,15 +55,22 @@ type ConsoleSpec struct {
// +optional
Route ConsoleConfigRoute `json:"route"`
// plugins defines a list of enabled console plugin names.
// +listType=atomic
// +kubebuilder:validation:MaxItems=64
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was the number 64 chosen?

Is it possible for there to be existing instances of this resource with more than 64 items?

@@ -55,15 +55,22 @@ type ConsoleSpec struct {
// +optional
Route ConsoleConfigRoute `json:"route"`
// plugins defines a list of enabled console plugin names.
Copy link
Contributor

Choose a reason for hiding this comment

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

While updating the constraints for this field, it would be good to update the godoc as well to explain in prose what validations exist for this field. Users can't see the markers when using something like oc/kubectl explain so it is helpful to spell it out for them in the godoc.

https://github.com/openshift/enhancements/blob/master/dev-guide/api-conventions.md#write-user-readable-documentation-in-godoc is a good place to start when thinking about what to include in the godoc

// ingress allows to configure the alternative ingress for the console.
// This field is intended for clusters without ingress capability,
// where access to routes is not possible.
// +optional
Ingress Ingress `json:"ingress"`
}

// +kubebuilder:validation:MaxLength=128
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was a max length of 128 chosen?

Are there any plugins we are aware of that might be cutting it close to that 128 character limit?

Where are plugin names derived from?

// ingress allows to configure the alternative ingress for the console.
// This field is intended for clusters without ingress capability,
// where access to routes is not possible.
// +optional
Ingress Ingress `json:"ingress"`
}

// +kubebuilder:validation:MaxLength=128
// +kubebuilder:validation:Pattern=^[a-zA-Z0-9-]+$
Copy link
Contributor

Choose a reason for hiding this comment

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

A couple things:

  • There didn't appear to be any pattern validation on the value previously. Why was this pattern chosen? Would introducing this pattern result in plugins that are no longer able to be used?
  • Conventions are shifting away from using the kubebuilder:validation:Pattern marker in favor of writing a CEL validation, using the kubebuilder:validation:XValidation marker, to provide users a more clear message when their input is invalid. If this pattern stays, update this to use a CEL validation instead?

// ingress allows to configure the alternative ingress for the console.
// This field is intended for clusters without ingress capability,
// where access to routes is not possible.
// +optional
Ingress Ingress `json:"ingress"`
}

// +kubebuilder:validation:MaxLength=128
// +kubebuilder:validation:Pattern=^[a-zA-Z0-9-]+$
type PluginName string
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs godoc with some more information about the type and the validations on it. Good guideline for writing human readable go doc can be found here: https://github.com/openshift/enhancements/blob/master/dev-guide/api-conventions.md#write-user-readable-documentation-in-godoc

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make sure that the detailed documentation ends up on the field itself, rather than the type alias.

The CRD schema will pick up godoc from the field, but sadly not the type alias.

@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

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-sigs/prow repository.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 11, 2025
Copy link
Contributor

openshift-ci bot commented Apr 11, 2025

@jhadvig: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/minor-images 70c33c8 link true /test minor-images
ci/prow/verify-feature-promotion 70c33c8 link true /test verify-feature-promotion
ci/prow/build 70c33c8 link true /test build
ci/prow/lint 70c33c8 link true /test lint
ci/prow/build 70c33c8 link true /test build
ci/prow/verify 70c33c8 link true /test verify
ci/prow/verify 70c33c8 link true /test verify
ci/prow/lint 70c33c8 link true /test lint
ci/prow/verify-client-go 70c33c8 link true /test verify-client-go
ci/prow/integration 70c33c8 link true /test integration
ci/prow/verify-deps 70c33c8 link true /test verify-deps
ci/prow/okd-scos-images 70c33c8 link true /test okd-scos-images
ci/prow/images 70c33c8 link true /test images
ci/prow/verify-client-go 70c33c8 link true /test verify-client-go
ci/prow/verify-crd-schema 70c33c8 link true /test verify-crd-schema
ci/prow/unit 70c33c8 link true /test unit
ci/prow/verify-crd-schema 70c33c8 link true /test verify-crd-schema
ci/prow/verify-feature-promotion 70c33c8 link true /test verify-feature-promotion
ci/prow/verify-deps 70c33c8 link true /test verify-deps
ci/prow/minor-images 70c33c8 link true /test minor-images
ci/prow/unit 70c33c8 link true /test unit
ci/prow/images 70c33c8 link true /test images
ci/prow/integration 70c33c8 link true /test integration

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants