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

Flattening not working with empty namespace (Replication rule for ECR) #19319

Open
NicoForce opened this issue Sep 6, 2023 · 11 comments · May be fixed by #19321
Open

Flattening not working with empty namespace (Replication rule for ECR) #19319

NicoForce opened this issue Sep 6, 2023 · 11 comments · May be fixed by #19321
Assignees

Comments

@NicoForce
Copy link

Expected behavior and actual behavior:
I expect flattening to work regardless of if a namespace is specified or not.

Actual behavior is that no matter which level of flatenning is chosen, the project name is always being appended to the image, except when a namespace is given, then the project name is properly replaced by the namespace.

Steps to reproduce the problem:
Following these steps, when one starts replication, if my ecr repo is named SOFTWARE, and I create a non-proxy project named DEV, even if I specify Flatten all, harbor will try to push the image as DEV/SOFTWARE, and fail as that repo does not exist in ecr.

If I specify a namespace as TEST in replication, and specify a flatenning level, such as Flatten 1 Level, then the image that's being pushed into ecr is TEST/SOFTWARE, which also fails because no such repo exists, as the repo SOFTWARE is the one in ecr.

I would guess flatten and no namespace would give one the ability to push just SOFTWARE to ecr, without either the project or namespace being attached.

Versions:

  • harbor version: 2.9.0
  • Deployed by helm chart 1.13.0
@NicoForce
Copy link
Author

I'm guessing the issue comes from this section of the code https://github.com/goharbor/harbor/blob/main/src/controller/replication/flow/stage.go#L161-L164

Following my example, the function replaceNamespace receives the variable repository as DEV/SOFTWARE, but because namespace is empty, it just returns the variable as is, without flatenning.

@NicoForce
Copy link
Author

Created PR to improve that behavior, let me know if it looks ok: #19321

@TFKIA
Copy link

TFKIA commented Oct 16, 2023

In the meanwhile is there a workaround? This is seriously messing with our promotion scheme...

@NicoForce
Copy link
Author

In the meanwhile is there a workaround? This is seriously messing with our promotion scheme...

There's none, I tried to find one, but my PR should fix it, haven't heard back from them about a review tho.

@TFKIA
Copy link

TFKIA commented Oct 16, 2023

In the meanwhile is there a workaround? This is seriously messing with our promotion scheme...

There's none, I tried to find one, but my PR should fix it, haven't heard back from them about a review tho.

Shoot. Well, I appreciate the response and the PR.

Copy link

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.

@github-actions github-actions bot added the Stale label Dec 16, 2023
@NicoForce
Copy link
Author

Commenting to remove stale label

@github-actions github-actions bot removed the Stale label Dec 18, 2023
Copy link

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.

@github-actions github-actions bot added the Stale label Feb 17, 2024
@NicoForce
Copy link
Author

Commenting to remove stale label

@github-actions github-actions bot removed the Stale label Feb 20, 2024
Copy link

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.

@github-actions github-actions bot added the Stale label Apr 29, 2024
@NicoForce
Copy link
Author

Commenting to remove stale label

@github-actions github-actions bot removed the Stale label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants