-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
enable proxy settings for kubernetes build and update docs #20398
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 slightly rework this, just to be consistent with the rest of this file:
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.
Another option is just to remove
sed -i
and find a place for an outfile, then do a mv. That's the old POSIX way, before-i
existed.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.
@ixdy I saw this suggestion from you before I made the fix.
On both Linux, either echo ${sed_opts[@]} or use ${sed_opts[@]} directly in sed command will lose the "", this causes build fail on OSX. So the current code you see is changed by me, to avoid using array for the empty "".
LM-SHC-16501199:work fmeng$ sed_opts=(-i "")
LM-SHC-16501199:work fmeng$ echo $sed_opts
-i
sed
sed: 1: "/Users/fmeng/code/kuber ...": invalid command code f
2.Define as a string$sed_opt "s/KUBE_BUILD_IMAGE_CROSS/$ {KUBE_BUILD_IMAGE_CROSS}/" ${build_context_dir}/Dockerfile
LM-SHC-16501199:kubernetes fmeng$ sed_opt=""
LM-SHC-16501199:kubernetes fmeng$ echo $sed_opt
""
LM-SHC-16501199:kubernetes fmeng$ sed -i
LM-SHC-16501199:kubernetes fmeng$
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.
You're only getting the first element by referencing $sed_opts.
Try ${sed_opts[@]}
Also try single quotes in the array element instead:
sed_opts=("-i ''")
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.
ah, thanks for pointing this out, I omitted the [@], will make the change.
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.
hm, I'm not sure that
("-i ''")
is correct - that's just treating it as a single array element.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.
@ixdy It works, I tested on both OSes.
I wrote simple scripts on my local laptop and verify it before I made the change, and the build succeeded on both OSes.
Checking my local build output, the
/Users/fmeng/code/kubernetes/src/k8s.io/validate/kubernetes/_output/images/kube-build:build-b4a36a2a04/Dockerfile
I can see the proxy settings are there.
LM-SHC-16501199:kubernetes fmeng$ more _output/images/kube-build:build-b4a36a2a04/Dockerfile
Here is the sample without environment variable set.
FROM kube-build:cross-1.5.3-1
MAINTAINER Joe Beda jbeda@google.com
(set an explicit GOARM of 5 for maximum compatibility)
ENV GOARM 5
ENV GOOS linux
ENV GOARCH amd64
ENV http_proxy ""
ENV https_proxy ""
ENV no_proxy 127.0.0.1