Bug 1874736 - [downstream] no version info for the helm-operator
Summary: [downstream] no version info for the helm-operator
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Operator SDK
Version: 4.6
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.7.0
Assignee: Jesus M. Rodriguez
QA Contact: Cuiping HUO
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-02 06:36 UTC by Jian Zhang
Modified: 2021-02-24 15:17 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-24 15:17:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift ocp-release-operator-sdk pull 75 0 None closed V0.19.4 merge 2021-02-19 01:06:21 UTC
Red Hat Product Errata RHSA-2020:5633 0 None None None 2021-02-24 15:17:26 UTC

Description Jian Zhang 2020-09-02 06:36:15 UTC
Description of problem:
There is no exact commit inof in the output of the `version` command.
And, it should NOT run the operator when running the `version` command.

[root@preserve-olm-env ocp-release-operator-sdk]# docker run --rm -ti registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-helm-operator:v4.6 version
{"level":"info","ts":1599027778.2426603,"logger":"cmd","msg":"Go Version: go1.14.4"}
{"level":"info","ts":1599027778.242729,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1599027778.2427394,"logger":"cmd","msg":"Version of operator-sdk: v0.19.0"}
{"level":"error","ts":1599027778.2429307,"logger":"cmd","msg":"Failed to get config.","error":"invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable","errorCauses":[{"error":"no configuration has been provided, try setting KUBERNETES_MASTER environment variable"}],"stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\tsrc/github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/zapr/zapr.go:128\ngithub.com/operator-framework/operator-sdk/pkg/helm.Run\n\tsrc/github.com/operator-framework/operator-sdk/pkg/helm/run.go:68\nmain.main\n\tsrc/github.com/operator-framework/operator-sdk/cmd/helm-operator/main.go:32\nruntime.main\n\t/opt/rh/go-toolset-1.14/root/usr/lib/go-toolset-1.14-golang/src/runtime/proc.go:203"}
FATA[0000] invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable 


Version-Release number of selected component (if applicable):
4.6

The master branch of https://github.com/openshift/ocp-release-operator-sdk

How reproducible:
always

Steps to Reproduce:
1. Download the helm-operator image.
[root@preserve-olm-env ocp-release-operator-sdk]# docker pull registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-helm-operator:v4.6
v4.6: Pulling from rh-osbs/openshift-ose-helm-operator
...

2. You can also check it by using the downstream `helm-operator` binary.

$ git clone git:openshift/ocp-release-operator-sdk.git

compile it.
[root@preserve-olm-env ocp-release-operator-sdk]# make tidy
[root@preserve-olm-env ocp-release-operator-sdk]# make install
[root@preserve-olm-env ocp-release-operator-sdk]# ./build/helm-operator version



Actual results:
No exact commit info, and it should NOT run the operator when running the `version` command.

[root@preserve-olm-env ocp-release-operator-sdk]# ./build/helm-operator version
{"level":"info","ts":1599028011.2423673,"logger":"cmd","msg":"Go Version: go1.14"}
{"level":"info","ts":1599028011.2424443,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1599028011.242455,"logger":"cmd","msg":"Version of operator-sdk: v0.19.0"}
{"level":"info","ts":1599028011.245355,"logger":"cmd","msg":"WATCH_NAMESPACE environment variable not set. Watching all namespaces.","Namespace":""}
I0902 02:26:52.370067   18026 request.go:621] Throttling request took 1.029155038s, request: GET:https://api.jiazha0901.qe.devcluster.openshift.com:6443/apis/authorization.openshift.io/v1?timeout=32s
{"level":"info","ts":1599028013.6920133,"logger":"controller-runtime.metrics","msg":"metrics server is starting to listen","addr":"0.0.0.0:8383"}
{"level":"error","ts":1599028013.6929672,"logger":"cmd","msg":"Failed to create new manager factories.","Namespace":"","error":"could not open watches file: open ./watches.yaml: no such file or directory","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\tpkg/mod/github.com/go-logr/zapr.1/zapr.go:128\ngithub.com/operator-framework/operator-sdk/pkg/helm.Run\n\tsrc/github.com/openshift/ocp-release-operator-sdk/pkg/helm/run.go:117\nmain.main\n\tsrc/github.com/openshift/ocp-release-operator-sdk/cmd/helm-operator/main.go:32\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:203"}
FATA[0002] could not open watches file: open ./watches.yaml: no such file or directory 

Expected results:
It should display the version info as the upstream `helm-operator` does, and no run operator action. As follows:

[root@preserve-olm-env operator-sdk]# helm-operator version
helm-operator version: "v1.0.0-alpha.2-75-gb9cd070", commit: "b9cd0707e7ce108f0745da5d688e116a91988e62", kubernetes version: "v1.18.2", go version: "go1.14 linux/amd64", GOOS: "linux", GOARCH: "amd64"


Additional info:

Comment 1 Jian Zhang 2020-09-02 07:52:01 UTC
The same issue for the downstream ansible-operator:
Downstream:
[root@preserve-olm-env ocp-release-operator-sdk]# ./build/ansible-operator version
{"level":"info","ts":1599032597.0588923,"logger":"cmd","msg":"Go Version: go1.14"}
{"level":"info","ts":1599032597.0589604,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1599032597.05897,"logger":"cmd","msg":"Version of operator-sdk: v0.19.0"}
{"level":"info","ts":1599032597.063338,"logger":"cmd","msg":"WATCH_NAMESPACE environment variable not set. Watching all namespaces.","Namespace":""}
I0902 03:43:18.186951   24104 request.go:621] Throttling request took 1.028398772s, request: GET:https://api.jiazha0901.qe.devcluster.openshift.com:6443/apis/coordination.k8s.io/v1?timeout=32s
{"level":"info","ts":1599032599.5105507,"logger":"controller-runtime.metrics","msg":"metrics server is starting to listen","addr":"0.0.0.0:8383"}
{"level":"error","ts":1599032599.5111096,"logger":"watches","msg":"Failed to get config file","error":"open ./watches.yaml: no such file or directory","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\tpkg/mod/github.com/go-logr/zapr.1/zapr.go:128\ngithub.com/operator-framework/operator-sdk/pkg/ansible/watches.Load\n\tsrc/github.com/openshift/ocp-release-operator-sdk/pkg/ansible/watches/watches.go:320\ngithub.com/operator-framework/operator-sdk/pkg/ansible.Run\n\tsrc/github.com/openshift/ocp-release-operator-sdk/pkg/ansible/run.go:125\nmain.main\n\tsrc/github.com/openshift/ocp-release-operator-sdk/cmd/ansible-operator/main.go:32\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:203"}
{"level":"error","ts":1599032599.5112624,"logger":"cmd","msg":"Failed to load watches.","Namespace":"","error":"open ./watches.yaml: no such file or directory","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\tpkg/mod/github.com/go-logr/zapr.1/zapr.go:128\ngithub.com/operator-framework/operator-sdk/pkg/ansible.Run\n\tsrc/github.com/openshift/ocp-release-operator-sdk/pkg/ansible/run.go:127\nmain.main\n\tsrc/github.com/openshift/ocp-release-operator-sdk/cmd/ansible-operator/main.go:32\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:203"}
FATA[0002] open ./watches.yaml: no such file or directory

Upstream:
[root@preserve-olm-env ocp-release-operator-sdk]# ansible-operator version
ansible-operator version: "v1.0.0", commit: "d7d5e0cd6cf5468bb66e0849f08fda5bf557f4fa", kubernetes version: "v1.18.2", go version: "go1.13.11 linux/amd64", GOOS: "linux", GOARCH: "amd64"

Comment 2 Joe Lanford 2020-09-03 14:36:45 UTC
We can't add subcommands to v0.19.x binaries since that would be a breaking change. That would be a new feature (which is actually already implemented in 1.0)

However, we can investigate improving the logging at operator startup to print the commit hash.

Comment 3 Joe Lanford 2020-09-03 16:12:57 UTC
Upstream PR for 0.19.x branch: https://github.com/operator-framework/operator-sdk/pull/3850

We'll need to cut another v0.19.x release and downstream it.

Comment 4 Jesus M. Rodriguez 2020-09-30 15:19:39 UTC
Fixed by the downstreaming of v0.19.4 https://github.com/openshift/ocp-release-operator-sdk/pull/75

Comment 5 Jian Zhang 2020-10-09 07:37:16 UTC
[root@preserve-olm-env ocp-release-operator-sdk]# make tidy
[root@preserve-olm-env ocp-release-operator-sdk]# make install
[root@preserve-olm-env ocp-release-operator-sdk]# ansible-operator version
{"level":"info","ts":1602227781.028008,"logger":"cmd","msg":"Go Version: go1.14"}
{"level":"info","ts":1602227781.0286546,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1602227781.0286741,"logger":"cmd","msg":"Version of ansible-operator: v0.19.4"}
{"level":"info","ts":1602227781.0286918,"logger":"cmd","msg":"Git commit of ansible-operator: 6c8ecfc6a506ed2d912c9355b50534b827bcdb84"}
{"level":"info","ts":1602227781.0311112,"logger":"cmd","msg":"WATCH_NAMESPACE environment variable not set. Watching all namespaces.","Namespace":""}

[root@preserve-olm-env ocp-release-operator-sdk]# helm-operator version
{"level":"info","ts":1602227670.7306209,"logger":"cmd","msg":"Go Version: go1.14"}
{"level":"info","ts":1602227670.730725,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1602227670.7307355,"logger":"cmd","msg":"Version of helm-operator: v0.19.4"}
{"level":"info","ts":1602227670.730746,"logger":"cmd","msg":"Git commit of helm-operator: 6c8ecfc6a506ed2d912c9355b50534b827bcdb84"}
{"level":"info","ts":1602227670.7332468,"logger":"cmd","msg":"WATCH_NAMESPACE environment variable not set. Watching all namespaces.","Namespace":""}
I1009 03:14:31.860698   10662 request.go:621] Throttling request took 1.026377503s, request: GET:https://api.jiazha09.qe.devcluster.openshift.com:6443/apis/storage.k8s.io/v1?timeout=32s
...

As we can see, we can get the version and commit infor for the two binaries: ansible-operator, helm-operator
But, the commit info of helm-operator is incorrect in the shipped image, see:
[root@preserve-olm-env data]# docker run --rm -ti registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-helm-operator:v4.7 helm-operator version
{"level":"info","ts":1602226861.4803712,"logger":"cmd","msg":"Go Version: go1.15.0"}
{"level":"info","ts":1602226861.480504,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1602226861.4805305,"logger":"cmd","msg":"Version of helm-operator: v0.19.4"}
{"level":"info","ts":1602226861.4805582,"logger":"cmd","msg":"Git commit of helm-operator: fd9ec99b7118f72c7dee4e75b8a57590ada97d6e"}
{"level":"error","ts":1602226861.480984,"logger":"cmd","msg":"Failed to get config.","error":"invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable","errorCauses":[{"error":"no configuration has been provided, try setting KUBERNETES_MASTER environment variable"}],"stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\tsrc/github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/zapr/zapr.go:128\ngithub.com/operator-framework/operator-sdk/pkg/helm.Run\n\tsrc/github.com/operator-framework/operator-sdk/pkg/helm/run.go:69\nmain.main\n\tsrc/github.com/operator-framework/operator-sdk/cmd/helm-operator/main.go:32\nruntime.main\n\t/usr/lib/golang/src/runtime/proc.go:204"}
FATA[0000] invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable 

I couldn't find the commit info(fd9ec99b7118f72c7dee4e75b8a57590ada97d6e) in the https://github.com/openshift/ocp-release-operator-sdk/commits/master
[root@preserve-olm-env ocp-release-operator-sdk]# git show fd9ec99b7118f72c7dee4e75b8a57590ada97d6e
fatal: bad object fd9ec99b7118f72c7dee4e75b8a57590ada97d6e

And, coundn't find the 4.7 ansible-operator.
[root@preserve-olm-env data]# docker pull registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-ansible-operator:v4.7
Error response from daemon: manifest for registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-ansible-operator:v4.7 not found: manifest unknown: manifest unknown

Maybe this is an image buidling issue now, change the status to the `ASSIGNED` first.

Comment 7 Jesus M. Rodriguez 2021-01-04 17:24:49 UTC
Fixed both upstream and downstream.

Comment 8 Cuiping HUO 2021-01-05 08:51:30 UTC
Verified.

Downstream
$ ./helm-operator version
helm-operator version: "7cc6f20c", commit: "7cc6f20cccd9a16b1af0c270197dc7b374e2048c", kubernetes version: "v1.18.8", go version: "go1.14.2", GOOS: "linux", GOARCH: "amd64"

Upstream
$ ./helm-operator version
helm-operator version: "v1.2.0-56-g8c31ab8f", commit: "8c31ab8fdbbe572a94a10c8f0dff33bbb53beb38", kubernetes version: "v1.19.4", go version: "go1.14.2", GOOS: "linux", GOARCH: "amd64"

Comment 11 errata-xmlrpc 2021-02-24 15:17:02 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 (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), 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/RHSA-2020:5633


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