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

Restart on configuration change #200

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Restart on configuration change #200

merged 1 commit into from
Feb 23, 2024

Conversation

bouskaJ
Copy link
Collaborator

@bouskaJ bouskaJ commented Feb 21, 2024

No description provided.

Copy link

openshift-ci bot commented Feb 21, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

openshift-ci bot commented Feb 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bouskaJ

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

@cooktheryan
Copy link
Collaborator

did a quick test with this by modifying the OIDC configuration. It changed the configmap and notified fulcio to redeploy

@cooktheryan
Copy link
Collaborator

Code wise nothing jumped out at me as incorrect. I did testing with two deployments and modified OIDC configuration no panics and logs were clean.

LGTM from a usage test

@cooktheryan
Copy link
Collaborator

/LGTM

@openshift-ci openshift-ci bot added the lgtm label Feb 23, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 53c9439 into main Feb 23, 2024
7 checks passed
return g.Failed(fmt.Errorf("could not set controller reference for Secret: %w", err))
}
if updated, err = g.Ensure(ctx, secret); err != nil {
// ensure that only new key is exposed
if err = g.Client.DeleteAllOf(ctx, &v1.Secret{}, client.InNamespace(instance.Namespace), client.MatchingLabels(constants.LabelsFor(ComponentName, DeploymentName, instance.Name)), client.HasLabels{FulcioCALabel}); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that old keys should be keept in cluster. The reason is that these CA key could be used to sign entry into transaction log, so it still have to be linked to CTlog configuration rootCertificates

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

consider this PR as the baseline for the key rotation. I am sure that we will need something more sophisticated for key rotation support.

if instance.Status.ServerConfigRef == nil {
return true
}
existing, err := kubernetes.GetConfigMap(ctx, i.Client, instance.Namespace, instance.Status.ServerConfigRef.Name)
Copy link
Contributor

@osmman osmman Feb 26, 2024

Choose a reason for hiding this comment

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

Maybe better solution to sove this could be usage of single status field which will contains latest hash of spec content which has been reconciled. For example:

kind: Fulcio
spec:
   config:
     aaa: 
       IssuerURL: aaa
status:
   lastReconciled: b9c66b80ae026e9768222122e8063dd1b66f36ce03fdf2625b198e5e6d2669fa

if hash changed than execute reconciliation loop. Benefit will be more generic detection of changes in spec. Currently changes in monitoring or external access spec will not be reconciled.

Other benefit is to remove kubernetes api requests from CanHandle method

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. The deployment is loading configuration from the status field. It's not possible to use hardcoded name because the CM is immutable and needs to be recated with every config change.

  2. I use similar approach as the CTLog uses. Currently, the config contains keys, the key MUST be password protected so in case of unprotected key, the key is encrypted with generated password. That means that you will never get the same hash for the very same config (the key contains salt so the hash differs even with the same password).

I am not against using the hash but I think, we have bigger rocks...

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I should add information that hash is for Operator's objects and not for config maps/secrets.

@osmman osmman deleted the 177 branch March 5, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants