Bug 1771665

Summary: file observer has not restarted process on serving cert change
Product: OpenShift Container Platform Reporter: Michal Fojtik <mfojtik>
Component: kube-apiserverAssignee: Michal Fojtik <mfojtik>
Status: CLOSED ERRATA QA Contact: Ke Wang <kewang>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.2.0CC: aos-bugs, mfojtik, xxia
Target Milestone: ---   
Target Release: 4.2.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1774917 (view as bug list) Environment:
Last Closed: 2020-02-12 12:16:16 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: 1774917    
Bug Blocks:    

Description Michal Fojtik 2019-11-12 18:44:52 UTC
Description of problem:

In some cases when serving certs were changed, the file observer controller that was part of operator process have not triggered restart of operator. This was because when the serving cert was empty when the operator started, a bug in code caused the to be not observed by file observer at all.


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Michal Fojtik 2020-01-31 09:53:48 UTC
This was already fixed and verified in master. We don't see this happening anymore.

Comment 4 Ke Wang 2020-02-06 07:31:08 UTC
Since we have comprehensive unit tests that exercise all these scenarios. Will verify this directly.
$ oc version
Client Version: v4.2.18
Server Version: 4.2.0-0.nightly-2020-02-05-211938
Kubernetes Version: v1.14.6+f0fa3b6

Related test code can cover the fix:
$ git clone https://github.com/openshift/library-go.git # or git pull if already cloned
$ git branch -a
$ cd  ~
$ git checkout remotes/origin/release-4.2
$ cd ~/library-go/pkg/controller/fileobserver
$ ls
observer.go  observer_polling.go  observer_polling_test.go  OWNERS

$ go test -v -run TestObserverPolling
=== RUN   TestObserverPolling
=== RUN   TestObserverPolling/start_with_existing_non-empty_file_with_no_change_and_initial_content_set
=== RUN   TestObserverPolling/start_with_existing_non-empty_file_with_no_change_and_no_initial_content_set
=== RUN   TestObserverPolling/start_with_existing_non-empty_file_that_change
=== RUN   TestObserverPolling/start_with_existing_non-empty_file_and_no_initial_content_that_change
=== RUN   TestObserverPolling/start_with_existing_empty_file_with_no_change
=== RUN   TestObserverPolling/start_with_existing_empty_file_and_no_initial_content_with_no_change
=== RUN   TestObserverPolling/start_with_existing_empty_file_that_change_content
=== RUN   TestObserverPolling/start_with_existing_empty_file_and_empty_initial_content_that_change_content
=== RUN   TestObserverPolling/start_with_non-existing_file_with_no_change
=== RUN   TestObserverPolling/start_with_non-existing_file_that_is_created_as_empty_file
=== RUN   TestObserverPolling/start_with_non-existing_file_that_is_created_as_non-empty_file
=== RUN   TestObserverPolling/start_with_existing_file_with_content_that_is_deleted
=== RUN   TestObserverPolling/start_with_existing_file_with_content_and_not_initial_content_set_that_is_deleted
--- PASS: TestObserverPolling (5.35s)
    --- PASS: TestObserverPolling/start_with_existing_non-empty_file_with_no_change_and_initial_content_set (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_non-empty_file_with_no_change_and_initial_content_set/testfile" with content: "non-empty"
        observer_polling_test.go:242: starting observing changes ...
    --- PASS: TestObserverPolling/start_with_existing_non-empty_file_with_no_change_and_no_initial_content_set (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_non-empty_file_with_no_change_and_no_initial_content_set/testfile" with content: "non-empty"
        observer_polling_test.go:242: starting observing changes ...
    --- PASS: TestObserverPolling/start_with_existing_non-empty_file_that_change (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_non-empty_file_that_change/testfile" with content: "non-empty"
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:245: writing "change" ...
        observer_polling_test.go:206: observed "file testfile was modified"
    --- PASS: TestObserverPolling/start_with_existing_non-empty_file_and_no_initial_content_that_change (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_non-empty_file_and_no_initial_content_that_change/testfile" with content: "non-empty"
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:245: writing "change" ...
        observer_polling_test.go:206: observed "file testfile was modified"
    --- PASS: TestObserverPolling/start_with_existing_empty_file_with_no_change (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_empty_file_with_no_change/testfile" with content: ""
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:245: writing "" ...
    --- PASS: TestObserverPolling/start_with_existing_empty_file_and_no_initial_content_with_no_change (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_empty_file_and_no_initial_content_with_no_change/testfile" with content: ""
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:245: writing "" ...
    --- PASS: TestObserverPolling/start_with_existing_empty_file_that_change_content (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_empty_file_that_change_content/testfile" with content: ""
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:245: writing "change" ...
        observer_polling_test.go:206: observed "file testfile was modified"
    --- PASS: TestObserverPolling/start_with_existing_empty_file_and_empty_initial_content_that_change_content (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_empty_file_and_empty_initial_content_that_change_content/testfile" with content: ""
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:245: writing "change" ...
        observer_polling_test.go:206: observed "file testfile was modified"
    --- PASS: TestObserverPolling/start_with_non-existing_file_with_no_change (0.41s)
        observer_polling_test.go:242: starting observing changes ...
    --- PASS: TestObserverPolling/start_with_non-existing_file_that_is_created_as_empty_file (0.41s)
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:245: writing "" ...
        observer_polling_test.go:206: observed "file testfile was created"
    --- PASS: TestObserverPolling/start_with_non-existing_file_that_is_created_as_non-empty_file (0.41s)
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:245: writing "non-empty" ...
        observer_polling_test.go:206: observed "file testfile was created"
    --- PASS: TestObserverPolling/start_with_existing_file_with_content_that_is_deleted (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_file_with_content_that_is_deleted/testfile" with content: "non-empty"
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:206: observed "file testfile was deleted"
    --- PASS: TestObserverPolling/start_with_existing_file_with_content_and_not_initial_content_set_that_is_deleted (0.41s)
        observer_polling_test.go:201: created file "/tmp/observer-poll-test681776228/TestObserverPolling/start_with_existing_file_with_content_and_not_initial_content_set_that_is_deleted/testfile" with content: "non-empty"
        observer_polling_test.go:242: starting observing changes ...
        observer_polling_test.go:206: observed "file testfile was deleted"
PASS
ok  	_/home/kewang/work/testing/library-go/pkg/controller/fileobserver	5.348s

We can see all related test cases have been passed.

Comment 6 errata-xmlrpc 2020-02-12 12:16:16 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-2020:0395