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
Comments
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. |
Created PR to improve that behavior, let me know if it looks ok: #19321 |
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. |
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. |
Commenting to remove stale label |
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. |
Commenting to remove stale label |
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. |
Commenting to remove stale label |
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:
The text was updated successfully, but these errors were encountered: