Skip to content

Conversation

@Deydra71
Copy link
Contributor

@Deydra71 Deydra71 commented May 12, 2025

Jira: OSPRH-16622

This PR adds end-to-end support for consuming Keystone ApplicationCredentials (AC) in the Barbican operator, enabling Barbican API pods to use AC-based authentication when available.

Reconcile:

On each reconcile, the Barbican API controller checks for an AC Secret (ac-{service}-secret) using the GetApplicationCredentialFromSecret() helper from keystone-operator API:

  • If the secret is missing or incomplete, continues using password authentication
  • Once the AC Secret is ready with valid AC_ID and AC_SECRET fields, templates AC credentials into Barbican configuration
  • Computes hash of Secret contents and stores in configVars to trigger rolling updates when credentials rotate

Depends-On: openstack-k8s-operators/keystone-operator#567

@openshift-ci
Copy link

openshift-ci bot commented May 12, 2025

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

@openshift-ci
Copy link

openshift-ci bot commented May 12, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Deydra71
Once this PR has been reviewed and has the lgtm label, please assign olliewalsh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@softwarefactory-project-zuul
Copy link

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging github.com/openstack-k8s-operators/barbican-operator for 248,b0e9d4fae44e44f06d0163b269a79d9932b5896a

templateParameters["ACID"] = string(secret.Data["AC_ID"])
templateParameters["ACSecret"] = string(secret.Data["AC_SECRET"])
Log.Info("Using ApplicationCredentials auth")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we handle the case where we are unable to retrieve the ACSecret? Looks like we simply continue and use password auth instead. But maybe we should requeue? Or at the very least log the error?

if res.RequeueAfter > 0 {
return res, nil
}
configVars["secret-"+secretName] = env.SetValue(hashAC)
Copy link
Contributor

@vakwetu vakwetu May 12, 2025

Choose a reason for hiding this comment

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

Why do we need this logic? It appears to be different from all the other secret checks above. I'm referring to lines 639-642.


Log.Info(fmt.Sprintf("[API] Got secrets '%s'", instance.Name))

// check for ApplicationCredential
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be checking for both the admin secret and also the application credential (if it exists)?
Seems to me that if you are using appCreds - then you no longer need to watch the admin secret - and no longer need to reconcile if it changes.

Maybe the logic here should be more like:
check if app cred exists
if app_cred_exists {
get app_cred_secret()
if ! exists requeue
verify app_cred_secret
} else {
verify_admin_secre
}

Feels like this is long enough to warrant a new method verify_service_credentials()

Copy link
Contributor

@vakwetu vakwetu May 12, 2025

Choose a reason for hiding this comment

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

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 added the verifyApplicationCredentials() func that implements this, see the comment below

}
configVars["secret-"+secretName] = env.SetValue(hashAC)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments as above, but actually, we should think about whether we need this logic at all. I don't think that the barbican-keystone-listener actually talks to keystone or uses the keystone creds. In which case, maybe we don't need to verify these parameters at all.

return res, nil
}
configVars["secret-"+secretName] = env.SetValue(hashAC)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments as above, but actually, we should think about whether we need this logic at all. I don't think that the barbican-worker actually talks to keystone or uses the keystone creds. In which case, maybe we don't need to verify these parameters at all.

@softwarefactory-project-zuul
Copy link

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging github.com/openstack-k8s-operators/barbican-operator for 248,3dbd65fc819acdd835d20669373e653155820ad1

@softwarefactory-project-zuul
Copy link

This change depends on a change that failed to merge.

Change openstack-k8s-operators/keystone-operator#567 is needed.

@Deydra71 Deydra71 force-pushed the appcred-support branch 2 times, most recently from 293d380 to d041d8c Compare July 23, 2025 07:44
@Deydra71 Deydra71 force-pushed the appcred-support branch 2 times, most recently from c80184e to cf5f6cb Compare August 6, 2025 12:30
@softwarefactory-project-zuul
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/6fce923fcd80456aa51169a94b122b46

openstack-k8s-operators-content-provider FAILURE in 5m 40s
⚠️ barbican-operator-kuttl SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider (non-voting)
⚠️ barbican-operator-tempest SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider (non-voting)

@Deydra71
Copy link
Contributor Author

Deydra71 commented Aug 6, 2025

Update:
Created verifyApplicationCredentials() that checks for AC readiness and that it contains all necessary fields (no more redundant admin secret check, that's already being done sooner in the reconciliation).

Added missing condition.RequestedReason, following the TransportURL pattern, so now it is clear why reconciliation is waiting.

Note:
Even tho keystone-listener and worker services are not using external keystone auth (so they don't need to use AC), all three barbican child services share the same 00-default.conf file where authentication is configured. That means that even if only the barbicanapi_controller has AC reconciliaiton logic and watcher, then the parent barbican_controller updates shared config leading to all child controllers detecting shared config changes and all pods restart.

Edit: worker and KL pods don't restart, because their controllers don't add AC to configVars, so the hash never changes, and there's no need to trigger new pod rollout.

@Deydra71 Deydra71 changed the title [WIP] AppCred service operator support AppCred service operator support Aug 12, 2025
@Deydra71 Deydra71 marked this pull request as ready for review August 12, 2025 09:23
@openshift-ci openshift-ci bot requested review from abays and afaranha August 12, 2025 09:23
@Deydra71 Deydra71 force-pushed the appcred-support branch 2 times, most recently from d9a3d2e to 0532383 Compare August 13, 2025 14:08
@softwarefactory-project-zuul
Copy link

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging github.com/openstack-k8s-operators/barbican-operator for 248,506faa12b035a1ae873faec6414a82fbba7a9b32

@Deydra71 Deydra71 force-pushed the appcred-support branch 2 times, most recently from 03426c5 to 4d423e7 Compare October 2, 2025 14:01
@softwarefactory-project-zuul
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/6b11f1080b6f447b85a4c0e86b3b923d

openstack-k8s-operators-content-provider FAILURE in 9m 07s
⚠️ barbican-operator-kuttl SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider (non-voting)
⚠️ barbican-operator-tempest SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider (non-voting)

@Deydra71 Deydra71 force-pushed the appcred-support branch 2 times, most recently from d266335 to cdeadd9 Compare October 14, 2025 11:47
@softwarefactory-project-zuul
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/e385cc4d105f4ba1a97d159f49487abe

openstack-k8s-operators-content-provider FAILURE in 9m 33s
⚠️ barbican-operator-kuttl SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider (non-voting)
⚠️ barbican-operator-tempest SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider (non-voting)

@softwarefactory-project-zuul
Copy link

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging github.com/openstack-k8s-operators/barbican-operator for 248,9c65a73c256cd4fa056a745cc55a0714b5c6d80c

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.

3 participants