Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2070566

Summary: oc kustomize: patchesStrategicMerge does not append
Product: OpenShift Container Platform Reporter: mephinet <mephinet>
Component: ocAssignee: Maciej Szulik <maszulik>
oc sub component: oc QA Contact: zhou ying <yinzhou>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: medium    
Priority: unspecified CC: aos-bugs, mfojtik
Version: 4.9   
Target Milestone: ---   
Target Release: 4.10.z   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-04 13:09:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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!