-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
ConfigMap Build Sources #19655
ConfigMap Build Sources #19655
Conversation
4b7d9b6
to
867cc26
Compare
/retest |
1 similar comment
/retest |
/assign @bparees |
pkg/build/builder/docker.go
Outdated
} | ||
return nil | ||
} | ||
func (d *DockerBuilder) copyLocalObject(s localObjectBuildSource, buildDir, mountPath string) error { |
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.
s/buildDir/targetDir/
s/mountPath/sourceDir/
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.
(and i'd probably reorder those args to be (src,dst) instead of (dst,src))
@@ -273,6 +321,14 @@ func setupAdditionalSecrets(pod *v1.Pod, container *v1.Container, secrets []buil | |||
} | |||
} | |||
|
|||
// setupAdditionalConfigMaps creates volume mounts in the given pod for the given list of configMaps | |||
func setupAdditionalConfigMaps(pod *v1.Pod, container *v1.Container, configMaps []buildapi.ConfigMapSpec) { |
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.
what uses this?
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.
this is a mirror of the secrets in the Custom Build Strategy. TBH I don't fully understand the use case of this feature, since secrets are supported in the Source
part of the BuildConfig
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.
I don't see anything calling it, so let's remove both of them. (the configmap one and the secret one)
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.
oh sorry, i see where it's called. looking.
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.
I think the custom build strategy secrets field predated our generic "input secrets" support.
I think we should not introduce a configmap equivalent for custom builds, just let people use the "input configmaps" feature to inject configmap content into their custom builds.
mkdir -p "${HOME}/testconfig" | ||
if [[ -f /tmp/configmap/foo ]]; then | ||
# Copy three secrets defined in configmap1 fixture to directory |
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.
s/secrets/configmap keys/ ?
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.
/s/keys/entries/ may be better (map key is the file name, map value is the file 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.
sure. mostly just trying to not call them secrets since they aren't.
@@ -8,8 +8,15 @@ for s in /tmp/secret? secret?; do | |||
fi | |||
done | |||
|
|||
for c in /tmp/configmap/* configmap2/*; do | |||
if [[ ! -s "${c}" ]]; then |
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.
this makes me realize the check above for secrets is insufficient. it needs to check that the file exists and has a size zero. Currently the check above will pass if the file does not exist at all.
@@ -8,8 +8,15 @@ for s in /tmp/secret? secret?; do | |||
fi | |||
done | |||
|
|||
for c in /tmp/configmap/* configmap2/*; do | |||
if [[ ! -s "${c}" ]]; then | |||
echo "Found configmap file which should not have been truncated: ${s}" |
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.
"configmap file is missing or has size zero: "
(and even better, indicate which it is)
@@ -125,5 +125,6 @@ func (bs *CustomBuildStrategy) CreateBuildPod(build *buildapi.Build) (*v1.Pod, e | |||
setupSourceSecrets(pod, &pod.Spec.Containers[0], build.Spec.Source.SourceSecret) | |||
setupInputSecrets(pod, &pod.Spec.Containers[0], build.Spec.Source.Secrets) | |||
setupAdditionalSecrets(pod, &pod.Spec.Containers[0], build.Spec.Strategy.CustomStrategy.Secrets) | |||
setupAdditionalConfigMaps(pod, &pod.Spec.Containers[0], build.Spec.Strategy.CustomStrategy.ConfigMaps) |
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.
so doesn't this need to be doing a "setupInputConfigMaps" also?
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.
yes (had it in my prior branch, missed carrying it over)
@bparees QE brought up a test case injecting configMaps into a Jenkins pipeline build. It's a stretch, but you could define a Worth adding this? |
no, not worth taking that on here. that would likely entail changes to the sync plugin anyway. |
867cc26
to
338949e
Compare
@bparees ptal (api changes held while we continue iterating here) |
lgtm |
pkg/build/apis/build/types.go
Outdated
// build. | ||
ConfigMap kapi.LocalObjectReference | ||
|
||
// DestinationDir is the directory where the files from the secret should be |
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.
"from the secret" -> "from the configMap"
86324f6
to
ee55868
Compare
ee55868
to
4f30ce5
Compare
@adambkaplan did you filter the glide updates or was it really this clean? |
|
||
// ConfigMaps represents a list of configMaps and their destinations that will | ||
// be used only for the build. | ||
ConfigMaps []ConfigMapBuildSource |
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.
not sure if @deads2k wanted the internal api changes with the update commit, or separate. I think he wanted it separate (ie only generated code in one of the commits, only manual changes in the other commit).
/retest |
4f30ce5
to
e0530fc
Compare
RFE/bug 1540978
* update deepcopy and converters * update swagger and protobuf spec RFE/bug 1540978
RFE/bug 1540978
e0530fc
to
d8d488c
Compare
@deads2k updated commit history to isolate the new type. |
/lgtm |
/retest Please review the full test history for this PR and help us cut down flakes. |
API update seems fine. Please remove the commit for |
/hold |
d8d488c
to
9be6877
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adambkaplan, bparees 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:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
@adambkaplan: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest |
Allow ConfigMaps to be a build source.
Trello Card
RFE 1540978