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 OIDC Federation Settings #479

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

d34dh0r53
Copy link

This templates the OIDC federation settings needed to configure Keystone to perform federation authentication.

Copy link
Contributor

openshift-ci bot commented Oct 9, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: d34dh0r53
Once this PR has been reviewed and has the lgtm label, please assign olliewalsh for approval. For more information see the Kubernetes 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

api/bases/keystone.openstack.org_keystoneapis.yaml Outdated Show resolved Hide resolved
api/v1beta1/keystoneapi_types.go Outdated Show resolved Hide resolved
Copy link
Contributor

@vakwetu vakwetu left a comment

Choose a reason for hiding this comment

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

See comments.

@vakwetu
Copy link
Contributor

vakwetu commented Nov 14, 2024

Maybe I missed it, but I didn't see any kuttl or functional tests . Just the removal of a bunch of empty lines in keystoneapi_controller_test.go. Is that coming in a separate PR?

@d34dh0r53
Copy link
Author

Yeah, KUTTL and functional testing is coming in a follow-on patch that I'm working on now.

This templates the OIDC federation settings needed to configure Keystone
to perform federation authentication.
Comment on lines +184 to +187
// +kubebuilder:validation:Required
// +kubebuilder:default=false
// Enablement of Federation configuration
EnableFederation bool `json:"enableFederation"`
Copy link
Contributor

Choose a reason for hiding this comment

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

this can not be a required field, or we need a new API version so that a conversion webhook could introduce it. for now it should be optional with default to false. see recent discussions on slack.

Copy link
Contributor

Choose a reason for hiding this comment

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

best to test this pr using a previous version and update to have this change

Copy link
Author

Choose a reason for hiding this comment

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

It doesn't have to be required, I'll change it to optional

Copy link
Contributor

Choose a reason for hiding this comment

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

do we even need this field? If you change the federationConfig object to a pointer, you can check for null-ness


if instance.Spec.EnableFederation {
federationParameters := map[string]interface{}{
"federationTrustedDashboard": fmt.Sprintf("https://%s-%s.%s.svc/dashboard/auth/websso/",
Copy link
Contributor

Choose a reason for hiding this comment

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

can we expect this to be only enabled for tlse and always have https?

Copy link
Contributor

Choose a reason for hiding this comment

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

as the public endpoint, should this be the route endpoint, or the k8s service? wondering if this could be instance.GetEndpoint(endpoint.EndpointPublic), which is either the k8s service, if no route, or the routes endpoint name.


// +kubebuilder:validation:Optional
// +OIDCFederation - parameters to configure keystone for OIDC federation
OIDCFederation KeystoneFederationSpec `json:"oidcFederation,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

might want to do this a ptr so that it won't show up with all the empty values?

apiVersion: keystone.openstack.org/v1beta1
kind: KeystoneAPI
metadata:
  creationTimestamp: "2024-11-18T19:38:57Z"
  finalizers:
  - openstack.org/keystoneapi
  - openstack.org/keystoneservice-nova
  - openstack.org/keystoneservice-glance
  - openstack.org/keystoneservice-ceilometer
  - openstack.org/keystoneservice-swift
  - openstack.org/keystoneendpoint-glance-default-external
  - openstack.org/keystoneendpoint-glance-default-internal
  - openstack.org/keystoneendpoint-swift
  - openstack.org/keystoneservice-barbican
  - openstack.org/keystoneservice-cinderv3
  - openstack.org/keystoneendpoint-barbican-api
  - openstack.org/keystoneendpoint-cinderv3
  - openstack.org/keystoneservice-neutron
  - openstack.org/keystoneservice-placement
  - openstack.org/keystoneendpoint-neutron
  - openstack.org/keystoneendpoint-placement
  - openstack.org/keystoneendpoint-nova
  generation: 2
  name: keystone
  namespace: openstack
  ownerReferences:
  - apiVersion: core.openstack.org/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: OpenStackControlPlane
    name: openstack-galera
    uid: 54409ae3-a561-43b7-9251-603437046eb3
  resourceVersion: "70386"
  uid: fbc4eab5-72b6-485e-b9b9-6536919d4c4b
spec:
  adminProject: admin
  adminUser: admin
  containerImage: quay.io/podified-antelope-centos9/openstack-keystone@sha256:198eb79012e1b824b4092e4907f0565051f8514a7ca0d4606e9ce7a3d8439895
  databaseAccount: keystone
  databaseInstance: openstack
  enableFederation: false
  enableSecureRBAC: true
  fernetMaxActiveKeys: 5
  fernetRotationDays: 1
  memcachedInstance: memcached
  oidcFederation:
    keystoneFederationIdentityProviderName: ""
    oidcCacheType: ""
    oidcClaimDelimiter: ""
    oidcClaimPrefix: ""
    oidcClientID: ""
    oidcIntrospectionEndpoint: ""
    oidcMemCacheServers: ""
    oidcPassClaimsAs: ""
    oidcPassUserInfoAs: ""
    oidcProviderMetadataURL: ""
    oidcResponseType: ""
    oidcScope: ""
    remoteIDAttribute: ""

[1] https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openstack-k8s-operators_keystone-operator/479/pull-ci-openstack-k8s-operators-keystone-operator-main-keystone-operator-build-deploy-kuttl/1858575042430898176/artifacts/keystone-operator-build-deploy-kuttl/openstack-k8s-operators-gather/artifacts/must-gather/quay-io-openstack-k8s-operators-openstack-must-gather-sha256-3d1f620ae3617fbd6371f55aa948b34e9daf31a461d3c557cf1a7c2db38d0385/namespaces/openstack/crs/keystoneapis.keystone.openstack.org/keystone.yaml

Copy link
Author

Choose a reason for hiding this comment

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

That sounds like it's the solution to my problem, I couldn't figure out why the values were empty when I was specifying defaults. Do you know of any examples of how to do this with a pointer?

Copy link
Contributor

Choose a reason for hiding this comment

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

just change it to

OIDCFederation *KeystoneFederationSpec `json:"oidcFederation,omitempty"`

probably needs some check for it bein nil where you right now just use it.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can see how I'm doing it with the PKCS11 settings in barbican in openstack-k8s-operators/barbican-operator#168

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants