-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add ability to custom handle redirects #5678
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -423,7 +423,12 @@ func (kt *KustTarget) accumulateResources( | |||||
if errors.Is(errF, load.ErrHTTP) { | ||||||
return nil, errF | ||||||
} | ||||||
var redErr *load.RedirectionError | ||||||
if errors.As(errF, &redErr) { | ||||||
path = redErr.NewPath | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this code is using redirect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I investigated in these scenarious
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, Maybe I explained it wrong. The scenario I was concerned about that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have understood! Sorry ((( I does not implement this case to avoid recursion. If you think that this case should be implemented I'll do it. |
||||||
} | ||||||
ldr, err := kt.ldr.New(path) | ||||||
|
||||||
if err != nil { | ||||||
// If accumulateFile found malformed YAML and there was a failure | ||||||
// loading the resource as a base, then the resource is likely a | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe That is better to solve redirects here than return
RedirectionError
and a new path.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! It does not work in all cases. For example if I return redirect to git. In that case httpClient has no credentials for download content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I couldn't understand about this sentence.
In my understanding, that repo uses the
HTTPS
protocol to download when HTTP redirects to git.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My explanation was not clear. Sorry for that. I'll try again.
Example
We get next url in resource section
https://example.com/apps/app1?version=1.1.0
When kustomize (in build proccess) go to that url, it get
Redirect 300
withnewPath
https://customgit.org/somegrop/project-app1.git?refs=1.1.0
. The repository is PRIVATE.In this case if we go to that git repo using
httpClient
we get page with ask for credential (((But if we create a new loader kustomize will use console
git
which already have credentials and can clone repository