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

Allow setting patchStrategy for maps #12731

Merged
merged 2 commits into from
Feb 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/image/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Image struct {
// DockerImageReference is the string that can be used to pull this image.
DockerImageReference string `json:"dockerImageReference,omitempty" protobuf:"bytes,2,opt,name=dockerImageReference"`
// DockerImageMetadata contains metadata about this image
DockerImageMetadata runtime.RawExtension `json:"dockerImageMetadata,omitempty" protobuf:"bytes,3,opt,name=dockerImageMetadata"`
DockerImageMetadata runtime.RawExtension `json:"dockerImageMetadata,omitempty" patchStrategy:"replace" protobuf:"bytes,3,opt,name=dockerImageMetadata"`
// DockerImageMetadataVersion conveys the version of the object, which if empty defaults to "1.0"
DockerImageMetadataVersion string `json:"dockerImageMetadataVersion,omitempty" protobuf:"bytes,4,opt,name=dockerImageMetadataVersion"`
// DockerImageManifest is the raw JSON of the manifest
Expand Down
12 changes: 12 additions & 0 deletions test/cmd/edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,17 @@ os::cmd::expect_success_and_not_text 'OC_EDITOR=cat oc edit --windows-line-endin

os::cmd::expect_success 'oc create -f test/testdata/services.yaml'
os::cmd::expect_success_and_text 'OC_EDITOR=cat oc edit svc' 'kind: List'

os::cmd::expect_success 'oc create imagestream test'
os::cmd::expect_success 'oc create -f test/testdata/mysql-image-stream-mapping.yaml'
os::cmd::expect_success_and_not_text 'oc get istag/test:new -o jsonpath={.metadata.annotations}' "tags:hidden"
editorfile="$(mktemp -d)/tmp-editor.sh"
echo '#!/bin/bash' > ${editorfile}
echo 'sed -i "s/^tag: null/tag:\n referencePolicy:\n type: Source/g" $1' >> ${editorfile}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deads2k @mfojtik fyi, it would appear that @soltysh discovered the "you can't update imagestreamtags w/o explicitly adding a reference policy" issue back in february of 2017, but apparently no one cared then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I knew too much about image streams back then ;)

echo 'sed -i "s/^metadata:$/metadata:\n annotations:\n tags: hidden/g" $1' >> ${editorfile}
chmod +x ${editorfile}
os::cmd::expect_success "EDITOR=${editorfile} oc edit istag/test:new"
os::cmd::expect_success_and_text 'oc get istag/test:new -o jsonpath={.metadata.annotations}' "tags:hidden"

echo "edit: ok"
os::test::junit::declare_suite_end
13 changes: 12 additions & 1 deletion vendor/k8s.io/kubernetes/pkg/util/strategicpatch/patch.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading