Get gophercloud system wide client#284
Conversation
This patch exposes a boolean that can be used to enforce per-tenant quotas in the GlanceAPI. If true, the related glance-api section is enabled and templateParameters are populated. This patch assumes the quota resources are already registered in keystone. Depends-On: openstack-k8s-operators/lib-common/pull/262 Depends-On: gophercloud/gophercloud/pull/2616 Depends-On: openstack-k8s-operators/lib-common/pull/284 Signed-off-by: Francesco Pantano <fpantano@redhat.com>
This patch exposes the data structure and implement the related logic that can be used to enforce per-tenant quotas in the GlanceAPI. When limits are defined, the related glance-api config section is enabled and templateParameters are populated. Depends-On: openstack-k8s-operators/lib-common/pull/262 Depends-On: gophercloud/gophercloud/pull/2616 Depends-On: openstack-k8s-operators/lib-common/pull/284 Signed-off-by: Francesco Pantano <fpantano@redhat.com>
modules/openstack/openstack.go
Outdated
| TenantName: cfg.TenantName, | ||
| DomainName: cfg.DomainName, | ||
| Scope: &gophercloud.AuthScope{ | ||
| System: true, |
There was a problem hiding this comment.
Shouldn't this be based on some condition or do we always want this client with system scope?
There was a problem hiding this comment.
Something like this;
if os.Getenv("OS_SYSTEM_SCOPE") != "all"
System: false
There was a problem hiding this comment.
not sure, maybe it's a good idea putting the Scope under a condition: I added it like this for two reasons:
- if we add a condition we then need to patch
keystone-operatorto get theOpenStackcli passing the scope; - we only use gophercloud to create resources from the operators (endpoints, services, etc) against the
ControlPlanebeing deployed: any other client can rely on the resultingclouds.yamlproduced by keystone in aConfigMapand get the appropriate client.
So you have strong opinions on it, or, do we have examples where having System: true can cause troubles?
I'm not against having it as a variable, it makes sense in lib-common, but I suspect we need to patch keystone-operator accordingly.
@stuggi any thoughts on this?
There was a problem hiding this comment.
As you said, I am not sure if we need it, but you could add a Scope pointer to the above AuthOpts and if it is not nil you can set it in NewOpenStack. with this there would be no need to the keystone-operator
There was a problem hiding this comment.
Makes sense, thanks @stuggi, I'll follow up on this!
This patch exposes the data structure and implement the related logic that can be used to enforce per-tenant quotas in the GlanceAPI. When limits are defined, the related glance-api config section is enabled and templateParameters are populated. Depends-On: openstack-k8s-operators/lib-common/pull/262 Depends-On: gophercloud/gophercloud/pull/2616 Depends-On: openstack-k8s-operators/lib-common/pull/284 Signed-off-by: Francesco Pantano <fpantano@redhat.com>
This patch exposes the data structure and implement the related logic that can be used to enforce per-tenant quotas in the GlanceAPI. When limits are defined, the related glance-api config section is enabled and templateParameters are populated. Depends-On: openstack-k8s-operators/lib-common/pull/262 Depends-On: gophercloud/gophercloud/pull/2616 Depends-On: openstack-k8s-operators/lib-common/pull/284 Signed-off-by: Francesco Pantano <fpantano@redhat.com>
This patch exposes the data structure and implement the related logic that can be used to enforce per-tenant quotas in the GlanceAPI. When limits are defined, the related glance-api config section is enabled and templateParameters are populated. Depends-On: openstack-k8s-operators/lib-common/pull/262 Depends-On: gophercloud/gophercloud/pull/2616 Depends-On: openstack-k8s-operators/lib-common/pull/284 Signed-off-by: Francesco Pantano <fpantano@redhat.com>
This patch exposes the data structure and implement the related logic that can be used to enforce per-tenant quotas in the GlanceAPI. When limits are defined, the related glance-api config section is enabled and templateParameters are populated. Depends-On: openstack-k8s-operators/lib-common/pull/262 Depends-On: gophercloud/gophercloud/pull/2616 Depends-On: openstack-k8s-operators/lib-common/pull/284 Signed-off-by: Francesco Pantano <fpantano@redhat.com>
The 'NewOpenStack' function is used to get a an admin, token that can be used by operators through keystone service to register the associated resources. However, without "scope:system" Glance is not able to register the keystone global limits defined in its main CR and it will fail. This patch ensures we have a system wide admin client that is able to act globally against the existing ctlplane. Signed-off-by: Francesco Pantano <fpantano@redhat.com>
konan-abhi
left a comment
There was a problem hiding this comment.
Looks good, Thank you!
When the "quotas" struct is passed to the main Glance CR, the operator needs a system scoped token to make sure the request is run successfully. This change allows the glance-operator to not rely on the keystone operator and build the required OSClient based on the new AuthOps "System" parameter. Depends-On: openstack-k8s-operators/lib-common#284 Signed-off-by: Francesco Pantano <fpantano@redhat.com>
The
NewOpenStackfunction is only used bykeystoneto get a an admin, system wide token that can be used by other operators through keystone service to register the associated resources. However, withoutscope:systemGlanceis not able to register the global limits defined in its main CR and it will fail configuring limits [1].This patch ensures we have a system wide admin client that is able to act globally against the existing ctlplane.
[1] https://docs.openstack.org/glance/latest/admin/quotas.html#configuring-glance-for-per-tenant-quotas