Skip to content
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 ownership for unshared secrets and configmaps #220

Merged
merged 2 commits into from Nov 3, 2023

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Sep 15, 2023

The openshift/api field will merge and be revendored here.

serving secrets and injected configmaps are not shared, we stomp all the keys. Add the service-ca as the owner of these configmaps since we control the content.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2023
@openshift-ci openshift-ci bot requested a review from stlaz September 15, 2023 19:35
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 15, 2023
@deads2k deads2k changed the title [wip] add ownership for unshared secrets and configmaps add ownership for unshared secrets and configmaps Sep 19, 2023
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 19, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 19, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 19, 2023
@deads2k
Copy link
Contributor Author

deads2k commented Sep 19, 2023

now updated with vendored constant

api.ServiceNameAnnotation: service.Name,
api.ServiceUIDAnnotation: string(service.UID),
api.ServiceNameAnnotation: service.Name,
apiannotations.OpenShiftComponent: "service-ca",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use api.OwningJiraComponent here as well?

api.AlphaServiceNameAnnotation: service.Name,
api.AlphaServiceUIDAnnotation: string(service.UID),
api.AlphaServiceNameAnnotation: service.Name,
apiannotations.OpenShiftComponent: "service-ca",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use api.OwningJiraComponent here as well?

@@ -207,7 +208,17 @@ func (sc *serviceServingCertUpdateController) ensureSecretData(service *v1.Servi
}
return true, nil
}
return update, nil

if update {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor refactoring suggestion; drop if update{} and:

if !update && len(secretCopy.Annotations[apiannotations.OpenShiftComponent]) == 0 {
  secretCopy...
  update = true
}

return update, nil

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally dislike it because you have to remember more state, but I will yield to the reviewer.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 26, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 26, 2023
@@ -109,6 +109,11 @@ func (bi *configMapCABundleInjector) Sync(ctx context.Context, syncCtx factory.S
// make a copy to avoid mutating cache state
configMapCopy := configMap.DeepCopy()
configMapCopy.Data = map[string]string{api.InjectionDataKey: bi.caBundle}
// set the owning-component unless someone else has claimed it.
if len(configMapCopy.Annotations[api.OwningJiraComponent]) == 0 {
configMapCopy.Annotations[api.OwningJiraComponent] = api.OwningJiraComponent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be configMapCopy.Annotations[apiannotations.OpenShiftComponent] instead?

@@ -329,6 +329,7 @@ func toBaseSecret(service *corev1.Service) *corev1.Secret {
Annotations: map[string]string{
api.ServiceUIDAnnotation: string(service.UID),
api.ServiceNameAnnotation: service.Name,
api.OwningJiraComponent: "service-ca",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually meant to replace "service-ca" with api.OwningJiraComponent:

apiannotations.OpenShiftComponent: api.OwningJiraComponent,

@@ -342,6 +343,7 @@ func toBaseSecret(service *corev1.Service) *corev1.Secret {
Annotations: map[string]string{
api.AlphaServiceUIDAnnotation: string(service.UID),
api.AlphaServiceNameAnnotation: service.Name,
api.OwningJiraComponent: "service-ca",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apiannotations.OpenShiftComponent: api.OwningJiraComponent,

@@ -407,6 +409,7 @@ func toRequiredSecret(dnsSuffix string, ca *crypto.CA, intermediateCACert *x509.

secretCopy.Annotations[api.AlphaServingCertExpiryAnnotation] = servingCert.Certs[0].NotAfter.Format(time.RFC3339)
secretCopy.Annotations[api.ServingCertExpiryAnnotation] = servingCert.Certs[0].NotAfter.Format(time.RFC3339)
secretCopy.Annotations[api.OwningJiraComponent] = api.OwningJiraComponent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be secretCopy.Annotations[apiannotations.OpenShiftComponent] instead?

@@ -147,6 +147,7 @@ func TestServiceServingCertControllerSync(t *testing.T) {
expectedSecretAnnotations: map[string]string{
api.AlphaServiceUIDAnnotation: testServiceUID,
api.AlphaServiceNameAnnotation: testServiceName,
api.OwningJiraComponent: api.OwningJiraComponent,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong annotation name here as well; apiannotations.OpenShiftComponent. Several occurences in this file.


// set the owning-component unless someone else has claimed it.
if !update && len(secretCopy.Annotations[api.OwningJiraComponent]) == 0 {
secretCopy.Annotations[api.OwningJiraComponent] = api.OwningJiraComponent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be secretCopy.Annotations[apiannotations.OpenShiftComponent] instead?

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 27, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 27, 2023
@deads2k
Copy link
Contributor Author

deads2k commented Oct 27, 2023

I hate constants that cannot change for constants. tried again.

@deads2k
Copy link
Contributor Author

deads2k commented Oct 27, 2023

huh, wonder if that's a flake or I broke it

/retest

@deads2k
Copy link
Contributor Author

deads2k commented Oct 30, 2023

installer failure
/retest

@deads2k
Copy link
Contributor Author

deads2k commented Nov 1, 2023

install failures

/retest

Copy link
Contributor

openshift-ci bot commented Nov 2, 2023

@deads2k: all tests passed!

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/test-infra repository. I understand the commands that are listed here.

@liouk
Copy link
Member

liouk commented Nov 3, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 3, 2023
Copy link
Contributor

openshift-ci bot commented Nov 3, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, liouk

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deads2k deads2k added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 3, 2023
@openshift-ci openshift-ci bot merged commit fe88761 into openshift:master Nov 3, 2023
8 checks passed
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-service-ca-operator-container-v4.15.0-202311202349.p0.gfe88761.assembly.stream for distgit ose-service-ca-operator.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants