Bug 1727917

Summary: `oc get --ignore-not-found -f -` does not behave like `oc get --ignore-not-found kind/name.. `
Product: OpenShift Container Platform Reporter: Justin Pierce <jupierce>
Component: ocAssignee: Mike Dame <mdame>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.1.zCC: aos-bugs, jokerman, mfojtik, talessio, tnozicka
Target Milestone: ---   
Target Release: 4.1.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1745532 (view as bug list) Environment:
Last Closed: 2019-09-12 18:56:13 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:
Bug Depends On: 1745532    
Bug Blocks:    

Description Justin Pierce 2019-07-08 14:07:04 UTC
Description of problem:
When file based input is use with oc get --ignore-not-found, a missing resource will cause the command to return an incomplete list of extant resources. This behavior is different from using named resources on the command line.

# This is the expected/correct output (2 existing / 1 missing resource)
[ec2-user us-east-1 ~]$ oc get -n openshift-monitoring --ignore-not-found secrets/grafana-tls secrets/grafana-proxy-missing secrets/grafana-config
NAME             TYPE                DATA   AGE
grafana-tls      kubernetes.io/tls   2      51d
NAME             TYPE                DATA   AGE
grafana-config   Opaque              1      51d


But when the resources to retrieve are provided in a file based input, only 1 resource is returned -- the missing resource apparently aborts the remainder of the search.

>>search.yaml>>>
apiVersion: v1
items:
- apiVersion: v1
  kind: Secret
  metadata:
    name: grafana-tls
    namespace: openshift-monitoring
  type: kubernetes.io/tls
- apiVersion: v1
  kind: Secret
  metadata:
    name: grafana-proxy-missing
    namespace: openshift-monitoring
  type: kubernetes.io/tls
- apiVersion: v1
  kind: Secret
  metadata:
    name: grafana-config
    namespace: openshift-monitoring
  type: kubernetes.io/tls
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""
<<<<<<<<<<<<<<<<

# The search will return an incomplete list of existing resources.
[ec2-user us-east-1 ~]$ oc get -f search.yaml --ignore-not-found
NAME          TYPE                DATA   AGE
grafana-tls   kubernetes.io/tls   2      51d



Version-Release number of selected component (if applicable):
v4.1.4

How reproducible:
100%

Comment 3 Mike Dame 2019-08-23 13:24:27 UTC
This is being fixed in https://github.com/kubernetes/kubernetes/pull/81452

Comment 7 zhou ying 2019-09-05 05:50:37 UTC
Confirmed with latest oc client , the issue has fixed:
[root@dhcp-140-138 ~]# oc get -n openshift-monitoring --ignore-not-found secrets/grafana-tls secrets/grafana-proxy-missing secrets/grafana-config
NAME             TYPE                DATA   AGE
grafana-tls      kubernetes.io/tls   2      4h10m
NAME             TYPE                DATA   AGE
grafana-config   Opaque              1      4h10m

[root@dhcp-140-138 ~]# oc get -f search.yaml --ignore-not-found
NAME             TYPE                DATA   AGE
grafana-tls      kubernetes.io/tls   2      4h11m
NAME             TYPE                DATA   AGE
grafana-config   Opaque              1      4h11m

[root@dhcp-140-138 linux]# oc version
Client Version: version.Info{Major:"4", Minor:"1+", GitVersion:"v4.1.15-201909041605+63712ea-dirty", GitCommit:"63712ea", GitTreeState:"dirty", BuildDate:"2019-09-04T23:58:30Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"}

Comment 9 errata-xmlrpc 2019-09-12 18:56:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2681