-
Notifications
You must be signed in to change notification settings - Fork 182
OCPBUGS-44842: Set not-before/not-after annotations #1873
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
OCPBUGS-44842: Set not-before/not-after annotations #1873
Conversation
|
Skipping CI for Draft Pull Request. |
|
@vrutkovs: This pull request references Jira Issue OCPBUGS-57049, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: The bug has been updated to refer to the pull request using the external bug tracker. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/test e2e-aws-ovn |
7a50d40 to
a372921
Compare
|
/test e2e-aws-ovn |
a372921 to
ea69044
Compare
|
/test e2e-aws-ovn |
ea69044 to
fed52f9
Compare
|
/test e2e-aws-ovn |
fed52f9 to
c4d8d5c
Compare
|
/cc @p0lyn0mial |
|
@vrutkovs: This pull request references Jira Issue OCPBUGS-44842, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
Found minor typo in original code, |
|
good catch, fixed it |
cf3ea12 to
e7cd82e
Compare
p0lyn0mial
left a comment
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.
LGTM, added some minor comments. thanks.
pkg/operator/nodekubeconfigcontroller/nodekubeconfigcontroller_test.go
Outdated
Show resolved
Hide resolved
infrastuctureLister -> infrastructureLister
b184b35 to
096e30f
Compare
|
/retest-required |
p0lyn0mial
left a comment
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.
lgtm, just one more question.
|
@wangke19 is there anything else we should consider before merging this pr ? |
e2db6a1 to
bb4d6a9
Compare
lgtm |
| } | ||
| requiredSecret.Annotations[annotations.OpenShiftComponent] = "kube-apiserver" | ||
| // Copy not-before/not-after annotations from systemAdminClientCert | ||
| if systemAdminCredsSecret.Annotations != nil { |
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.
in go reading from nil map works, no ?
xref: https://go.dev/play/p/hrmvBX3L2Q1
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.
yes, you are right.
Reading from a nil map does NOT panic — it returns the zero value for the type.
Here’s an idiomatic and explicit version.
if val, ok := systemAdminCredsSecret.Annotations[certrotation.CertificateNotBeforeAnnotation]; ok && len(val) > 0 {
requiredSecret.Annotations[certrotation.CertificateNotBeforeAnnotation] = val
}
if val, ok := systemAdminCredsSecret.Annotations[certrotation.CertificateNotAfterAnnotation]; ok && len(val) > 0 {
requiredSecret.Annotations[certrotation.CertificateNotAfterAnnotation] = val
}
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.
if len(systemAdminCredsSecret.Annotations[certrotation.CertificateNotBeforeAnnotation]) > 0 also works, right ?
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.
yes, the original code snippet is safe as-is regarding nil map reads. Suggestion improves readability and maintainability for other devs
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.
I would prefer len(systemAdminCredsSecret.Annotations[certrotation.CertificateNotBeforeAnnotation]) > 0 as it is idiomatic and more concise. maybe it is just me. do you mind brining the original version?
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.
Done
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.
thanks
bb4d6a9 to
87ea901
Compare
Copy not-before and not-after annotations from the system:admin secret
87ea901 to
80afb73
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: p0lyn0mial, vrutkovs The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@vrutkovs: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
a08323d
into
openshift:main
|
@vrutkovs: Jira Issue OCPBUGS-44842: Some pull requests linked via external trackers have merged: The following pull requests linked via external trackers have not merged: These pull request must merge or be unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-44842 has not been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[ART PR BUILD NOTIFIER] Distgit: ose-cluster-kube-apiserver-operator |
Pull in openshift/library-go#1971 to make sure most secrets created by controller would have refresh-period annotation set.