Bug 2070566 - oc kustomize: patchesStrategicMerge does not append
Summary: oc kustomize: patchesStrategicMerge does not append
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.9
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
: 4.10.z
Assignee: Maciej Szulik
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-31 12:52 UTC by mephinet
Modified: 2022-04-04 13:09 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-04-04 13:09:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github mephinet/oc-kustomize-bug-reproducer 0 None None None 2022-03-31 12:52:21 UTC

Description mephinet 2022-03-31 12:52:22 UTC
Description of problem:

I started to use kustomize with oc in order to apply the prod-specific configuration on top of my base config. In this context, I think I found a regression in the behaviour of `oc`, which is not present in `kubectl` and `kustomize`:

When using patchesStrategicMerge to extend the env of a container in a cronjob, while `kubectl` and `kustomize` correctly extend the array, `oc` incorrectly replaces it instead.

bad: oc 4.9.18 (shipped with crc 2.0.1)
good: kubectl 1.23.5
good: kustomize 4.4.1

How reproducible:

check out my reproducer: https://github.com/mephinet/oc-kustomize-bug-reproducer


Steps to Reproduce:
$ kustomize build overlay/ > output/kustomize-build.yaml
$ kubectl kustomize overlay/ > output/kubectl-kustomize.yaml
$ oc kustomize overlay/ > output/oc-kustomize.yaml

Actual results:

While the output of `kustomize build` and `kubectl kustomize` have both environment variables FOO and BAR in the output, the output of `oc kustomize` does not show FOO.

Expected results:

All 3 files are identical, have both variables FOO and BAR set.

Comment 1 Maciej Szulik 2022-04-01 13:35:05 UTC
kubectl 1.23 is part of OpenShift and oc 4.10, 4.9 actually builds on top of 1.22.
Can you verify this problems still exists with 4.10?

Comment 2 mephinet 2022-04-01 13:47:31 UTC
(In reply to Maciej Szulik from comment #1)
> Can you verify this problems still exists with 4.10?

Good catch! I installed oc version 4.10.5 from https://console.redhat.com/openshift/downloads, and when using this version, the output is as expected: both FOO and BAR is generated in the output file. So this issue is already fixed in the latest version of oc, and just needs to land in crc...

Thanks!


Note You need to log in before you can comment on or make changes to this bug.