Bug 1771665 - file observer has not restarted process on serving cert change
Summary: file observer has not restarted process on serving cert change
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: kube-apiserver
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: 4.2.z
Assignee: Michal Fojtik
QA Contact: Ke Wang
URL:
Whiteboard:
Depends On: 1774917
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-12 18:44 UTC by Michal Fojtik
Modified: 2020-02-12 12:16 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1774917 (view as bug list)
Environment:
Last Closed: 2020-02-12 12:16:16 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github openshift cluster-kube-apiserver-operator pull 680 'None' closed Bug 1771665: file observer has not restarted process on serving cert change 2020-03-09 07:39:35 UTC
Github openshift library-go pull 589 'None' closed Bug 1771665: File observer fixes 2020-03-09 07:39:35 UTC
Github openshift library-go pull 597 'None' closed Bug 1771665: Backport file observer fixes 2020-03-09 07:39:35 UTC
Red Hat Product Errata RHBA-2020:0395 None None None 2020-02-12 12:16:42 UTC

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


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