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

support static prefix for k8s resource name #3447

Merged

Conversation

christianvogt
Copy link
Contributor

@christianvogt christianvogt commented Nov 6, 2024

https://issues.redhat.com/browse/RHOAIENG-15509

Description

Adds a staticPrefix option to the K8sNameDescriptionField component.
When this is used in conjunction with safePrefix, the prefix will always be applied.

Updated connection types form to use staticPrefix along with a safePrefix of ct-.

When the user types the expected prefix, the prefix isn't duplicated:
image
image

Similarly, if the prefix is omitted by the user, the prefix is applied:
image
image

The user can change still customize the resource name.
image

When the name is left blank:
image

How Has This Been Tested?

  • enable the connection types feature flag
  • as an admin create a new connection type
  • use various permutations of names and custom resources
  • ensure the resource is always created with a prefix of ct-

Test Impact

Updated tests

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

cc @andrewballantyne @simrandhaliw

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.66%. Comparing base (7023236) to head (f79edd6).
Report is 19 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3447      +/-   ##
==========================================
+ Coverage   85.63%   85.66%   +0.03%     
==========================================
  Files        1346     1347       +1     
  Lines       30586    30657      +71     
  Branches     8496     8529      +33     
==========================================
+ Hits        26191    26261      +70     
- Misses       4395     4396       +1     
Files with missing lines Coverage Δ
.../k8s/K8sNameDescriptionField/ResourceNameField.tsx 100.00% <100.00%> (ø)
.../src/concepts/k8s/K8sNameDescriptionField/utils.ts 100.00% <100.00%> (ø)
frontend/src/concepts/k8s/utils.ts 96.29% <100.00%> (+0.46%) ⬆️
...onnectionTypes/manage/ManageConnectionTypePage.tsx 93.93% <100.00%> (ø)

... and 14 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7023236...f79edd6. Read the comment docs.

@simrandhaliw
Copy link

LGTM!

Copy link
Member

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

Minor comment -- for consistency...

Testing this on cluster.

): [string, AdditionalCriteriaApplied] => {
const appliedCriteria: AdditionalCriteriaApplied = {
autoGenerated: false,
safeK8sPrefix: false,
maxLength: false,
isStaticPrefix: false,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
isStaticPrefix: false,
staticPrefix: false,

Maybe the wording here is weird -- they are all booleans, because they are status of what happened... appliedCriteria.staticPrefix imo is better than appliedCriteria.isStaticPrefix -- it's all the applied criteria so everything is prefixed with is or none of them are.

Copy link
Member

Choose a reason for hiding this comment

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

@christianvogt this is not a blocker to me... but are you in the middle of doing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll fix this. I agree with you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a new commit with just the rename of this.

Copy link
Member

Choose a reason for hiding this comment

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

hah, a wee larger of a fix than I was asking... but okies

@andrewballantyne
Copy link
Member

/approve

Works as expected on cluster 👍

Copy link
Contributor

openshift-ci bot commented Nov 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewballantyne

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:

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

@openshift-ci openshift-ci bot added the approved label Nov 7, 2024
@emilys314
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Nov 7, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 0e4420f into opendatahub-io:main Nov 7, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants