-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to reconcile bootstrap data between datastore and disk #3398
Conversation
Can we add additional tests? Custom certs:
Changing datastore:
Certificate renewal:
|
Codecov Report
@@ Coverage Diff @@
## master #3398 +/- ##
==========================================
- Coverage 11.61% 11.45% -0.16%
==========================================
Files 136 136
Lines 8828 8983 +155
==========================================
+ Hits 1025 1029 +4
- Misses 7579 7730 +151
Partials 224 224
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Dockerfile.dapper826934624 should be remove, this is generate file by dapper |
Correct. Last commit was a push to get the data up due to hardware failure. PR is t ready for review and will be marked WIP shortly. |
f455111
to
4d751aa
Compare
This doesn't seem to do the right thing when using an external SQL datastore; it overwrites the files on disk from the bootstrap data without printing any message about why it is doing so. # start K3s and let it run until the system stabilizes
k3s server --debug --datastore-endpoint 'mysql://root:password@tcp(db.dev-backend.k3s.khaus:3306)/k3s' --token token
# generate a CSR to renew the server-ca cert
openssl x509 -x509toreq -in /var/lib/rancher/k3s/server/tls/server-ca.crt -out server-ca.csr -signkey /var/lib/rancher/k3s/server/tls/server-ca.key
# renew server-ca cert with 10000 days of validity
openssl x509 -req -days 10000 -in server-ca.csr -out /var/lib/rancher/k3s/server/tls/server-ca.crt -signkey /var/lib/rancher/k3s/server/tls/server-ca.key
# verify file timestamps and expiration - timestamp on the .crt file should be newer
ls -la /var/lib/rancher/k3s/server/tls/server-ca*
openssl x509 -noout -text -in /var/lib/rancher/k3s/server/tls/server-ca.crt | grep After
# start K3s again; let it run until the system stabilizes
k3s server --debug --datastore-endpoint 'mysql://root:password@tcp(db.dev-backend.k3s.khaus:3306)/k3s' --token token
# note that the file timestamps are now the same, and the expiration has reverted to the original value (10 years from initial creation)
ls -la /var/lib/rancher/k3s/server/tls/server-ca*
openssl x509 -noout -text -in /var/lib/rancher/k3s/server/tls/server-ca.crt | grep After |
The same behavior can be seen when using a sqlite datastore (no --datastore-endpoint or --cluster-init) |
Changes made and pushed. |
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, but I would like @rancher-max to make sure we're covering all the weird edge cases before we merge.
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
…3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
… disk (k3s-io#3398)" This reverts commits 9a4ca59 c9f6fa0 07f844c 48355dc Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
Add ability to reconcile bootstrap data between datastore and disk (#3398)
Add ability to reconcile bootstrap data between datastore and disk (#3398)
Add ability to reconcile bootstrap data between datastore and disk (#3398)
Proposed Changes
Adds the ability for k3s to detect when there are differences in bootstrap data in either the datastore or on disk and to update the whichever one is older.
This also adds the ability to migrate bootstrap data from the "older" format to the "newer" format. This situation will happen when clusters are upgraded and the new version started. The new bootstrap data contains a timestamp field which the old format didn't have. That older data is read, determined to be old, migrated to be in the new format and saved back to the datastore.
Types of Changes
Verification
/var/lib/rancher/k3s/server/tls
kubectl
can successfully runor
/var/lib/rancher/k3s/server/tls
directorySee comment below for additional verification scenarios.
Linked Issues
#3015
Further Comments