Bug 1727917 - `oc get --ignore-not-found -f -` does not behave like `oc get --ignore-not-found kind/name.. `
Summary: `oc get --ignore-not-found -f -` does not behave like `oc get --ignore-not-fo...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.1.z
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 4.1.z
Assignee: Mike Dame
QA Contact: zhou ying
URL:
Whiteboard:
Depends On: 1745532
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-08 14:07 UTC by Justin Pierce
Modified: 2019-09-12 18:56 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1745532 (view as bug list)
Environment:
Last Closed: 2019-09-12 18:56:13 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github openshift origin pull 23671 None None None 2019-09-03 12:29:52 UTC
Red Hat Product Errata RHBA-2019:2681 None None None 2019-09-12 18:56:19 UTC

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@stg-1.bastion 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@stg-1.bastion 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


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