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

Resourcenamelimit 63chars #1519

Merged

Conversation

tesshuflower
Copy link
Contributor

@tesshuflower tesshuflower commented Jan 13, 2025

Describe what this PR does

  • fixes name length limit for services/labels/jobs (63 chars)
  • Tries to preserve existing names when limit isn't hit to avoid migration issues
  • When names are too long, uses a crc32 hash of the cr name instead of cr name itself in the name

Is there anything that requires special attention?

Related issues:
Fixes: #1470

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.4%. Comparing base (eda52c6) to head (f2b0978).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1519     +/-   ##
=======================================
+ Coverage   66.3%   66.4%   +0.1%     
=======================================
  Files         57      57             
  Lines       7474    7501     +27     
=======================================
+ Hits        4959    4986     +27     
  Misses      2230    2230             
  Partials     285     285             
Files with missing lines Coverage Δ
controllers/mover/rclone/mover.go 73.7% <100.0%> (ø)
controllers/mover/restic/mover.go 82.2% <100.0%> (ø)
controllers/mover/rsync/mover.go 75.2% <100.0%> (ø)
controllers/mover/rsynctls/mover.go 72.6% <100.0%> (ø)
controllers/mover/syncthing/mover.go 82.5% <100.0%> (+0.3%) ⬆️
controllers/utils/utils.go 77.3% <100.0%> (+2.3%) ⬆️

Copy link

@tesshuflower
Copy link
Contributor Author

/cc @JohnStrunk

@openshift-ci openshift-ci bot requested a review from JohnStrunk January 14, 2025 18:33
Comment on lines 215 to 218
// serviceName is the name of the service to connect to for incoming SSH
// replication connections.
//+optional
ServiceName *string `json:"serviceName,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to hear more about why this is needed and whether it is applicable to any use-cases other than ODF.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JohnStrunk I think the main use-case is for ODF to be honest. The reason is they've been relying on knowing what the service name will be, based on the CR name. Their use case involves needing to create a servicexport CR for submariner, so that the service will be accessible from the remote cluster (as if it was a local service). I'm not sure if others will have something similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have a concern over exposing the service John? I guess I thought if ODF has this then others would as well eventually. Things like submariner that expose a service across clusters, or even for users that want to access a service by name like <svcname>.<namespace>.svc.cluster.local....but maybe this isn't as common unless they're working in the same cluster.

Copy link
Member

Choose a reason for hiding this comment

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

There's 2 things really.
The 1st is that I'm not interested in special cases/behaviors for specific apps, even if it's one of ours because that means that one of the two apps is probably not doing something "correctly".
But the 2nd (related) item is that this raises the question of whether we're not doing something "correctly"... i.e., not in a general/best-practices way to work with other pieces of infrastructure. In reviewing this PR, it occurred to be that we probably should have just used labels/selectors to track the jobs, etc. and let kube pick the names via generateName --- not suggesting we change it, just an observation. But let's say someone is using Istio, Submariner, or something else... How should we be be exposing things? Should be be adding labels instead of providing the Service name in a custom field?

- use crc32 hash of CR name for names that are too long
- new e2e tests for long names
- e2e tests in customscorecard-tests - rearrange for concurrency

Signed-off-by: Tesshu Flower <[email protected]>
@tesshuflower tesshuflower force-pushed the resourcenamelimit_63chars branch from 2b9fd41 to f2b0978 Compare January 29, 2025 15:12
@tesshuflower
Copy link
Contributor Author

/retest

@tesshuflower
Copy link
Contributor Author

/cc @JohnStrunk

I've made updates as we discussed - can you take a look when you get a chance?

@openshift-ci openshift-ci bot requested a review from JohnStrunk January 29, 2025 18:08
Copy link
Member

@JohnStrunk JohnStrunk 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
Contributor

openshift-ci bot commented Jan 30, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnStrunk, tesshuflower

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 [JohnStrunk,tesshuflower]

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

@openshift-merge-bot openshift-merge-bot bot merged commit 9dc08b2 into backube:main Jan 30, 2025
30 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.

Fix ReplicationSource/ReplicationDestination name length limit
2 participants