From 9457dc6bf7f9a1ed159616b45520ffeeb690fee1 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Sat, 26 Aug 2017 17:31:31 -0500 Subject: [PATCH] Cinder: Make policy fully configurable via helm values This PS moves the cinder policy.json to be fully driven by gotpl, allowing full configuration without editing the template. Change-Id: Ib3e9582492231860870c3907ab0983405d88b8c8 --- cinder/templates/configmap-etc.yaml | 2 +- cinder/templates/etc/_policy.json.tpl | 138 -------------------------- cinder/values.yaml | 117 +++++++++++++++++++++- 3 files changed, 116 insertions(+), 141 deletions(-) delete mode 100644 cinder/templates/etc/_policy.json.tpl diff --git a/cinder/templates/configmap-etc.yaml b/cinder/templates/configmap-etc.yaml index 08a1b03d13..24b5ad6a5b 100644 --- a/cinder/templates/configmap-etc.yaml +++ b/cinder/templates/configmap-etc.yaml @@ -93,7 +93,7 @@ data: api-paste.ini: |+ {{- tuple .Values.conf.paste "etc/_api-paste.ini.tpl" . | include "helm-toolkit.utils.configmap_templater" }} policy.json: |+ -{{- tuple .Values.conf.policy "etc/_policy.json.tpl" . | include "helm-toolkit.utils.configmap_templater" }} +{{ toJson .Values.conf.policy | indent 4 }} cinder_sudoers: |+ {{- tuple .Values.conf.neutron_sudoers "etc/_cinder_sudoers.tpl" . | include "helm-toolkit.utils.configmap_templater" }} rootwrap.conf: |+ diff --git a/cinder/templates/etc/_policy.json.tpl b/cinder/templates/etc/_policy.json.tpl deleted file mode 100644 index 8818372051..0000000000 --- a/cinder/templates/etc/_policy.json.tpl +++ /dev/null @@ -1,138 +0,0 @@ -{ - "context_is_admin": "role:admin", - "admin_or_owner": "is_admin:True or project_id:%(project_id)s", - "default": "rule:admin_or_owner", - - "admin_api": "is_admin:True", - - "volume:create": "", - "volume:delete": "rule:admin_or_owner", - "volume:get": "rule:admin_or_owner", - "volume:get_all": "rule:admin_or_owner", - "volume:get_volume_metadata": "rule:admin_or_owner", - "volume:create_volume_metadata": "rule:admin_or_owner", - "volume:delete_volume_metadata": "rule:admin_or_owner", - "volume:update_volume_metadata": "rule:admin_or_owner", - "volume:get_volume_admin_metadata": "rule:admin_api", - "volume:update_volume_admin_metadata": "rule:admin_api", - "volume:get_snapshot": "rule:admin_or_owner", - "volume:get_all_snapshots": "rule:admin_or_owner", - "volume:create_snapshot": "rule:admin_or_owner", - "volume:delete_snapshot": "rule:admin_or_owner", - "volume:update_snapshot": "rule:admin_or_owner", - "volume:get_snapshot_metadata": "rule:admin_or_owner", - "volume:delete_snapshot_metadata": "rule:admin_or_owner", - "volume:update_snapshot_metadata": "rule:admin_or_owner", - "volume:extend": "rule:admin_or_owner", - "volume:update_readonly_flag": "rule:admin_or_owner", - "volume:retype": "rule:admin_or_owner", - "volume:update": "rule:admin_or_owner", - - "volume_extension:types_manage": "rule:admin_api", - "volume_extension:types_extra_specs": "rule:admin_api", - "volume_extension:access_types_qos_specs_id": "rule:admin_api", - "volume_extension:access_types_extra_specs": "rule:admin_api", - "volume_extension:volume_type_access": "rule:admin_or_owner", - "volume_extension:volume_type_access:addProjectAccess": "rule:admin_api", - "volume_extension:volume_type_access:removeProjectAccess": "rule:admin_api", - "volume_extension:volume_type_encryption": "rule:admin_api", - "volume_extension:volume_encryption_metadata": "rule:admin_or_owner", - "volume_extension:extended_snapshot_attributes": "rule:admin_or_owner", - "volume_extension:volume_image_metadata": "rule:admin_or_owner", - - "volume_extension:quotas:show": "", - "volume_extension:quotas:update": "rule:admin_api", - "volume_extension:quotas:delete": "rule:admin_api", - "volume_extension:quota_classes": "rule:admin_api", - "volume_extension:quota_classes:validate_setup_for_nested_quota_use": "rule:admin_api", - - "volume_extension:volume_admin_actions:reset_status": "rule:admin_api", - "volume_extension:snapshot_admin_actions:reset_status": "rule:admin_api", - "volume_extension:backup_admin_actions:reset_status": "rule:admin_api", - "volume_extension:volume_admin_actions:force_delete": "rule:admin_api", - "volume_extension:volume_admin_actions:force_detach": "rule:admin_api", - "volume_extension:snapshot_admin_actions:force_delete": "rule:admin_api", - "volume_extension:backup_admin_actions:force_delete": "rule:admin_api", - "volume_extension:volume_admin_actions:migrate_volume": "rule:admin_api", - "volume_extension:volume_admin_actions:migrate_volume_completion": "rule:admin_api", - - "volume_extension:volume_actions:upload_public": "rule:admin_api", - "volume_extension:volume_actions:upload_image": "rule:admin_or_owner", - - "volume_extension:volume_host_attribute": "rule:admin_api", - "volume_extension:volume_tenant_attribute": "rule:admin_or_owner", - "volume_extension:volume_mig_status_attribute": "rule:admin_api", - "volume_extension:hosts": "rule:admin_api", - "volume_extension:services:index": "rule:admin_api", - "volume_extension:services:update" : "rule:admin_api", - - "volume_extension:volume_manage": "rule:admin_api", - "volume_extension:volume_unmanage": "rule:admin_api", - "volume_extension:list_manageable": "rule:admin_api", - - "volume_extension:capabilities": "rule:admin_api", - - "volume:create_transfer": "rule:admin_or_owner", - "volume:accept_transfer": "", - "volume:delete_transfer": "rule:admin_or_owner", - "volume:get_transfer": "rule:admin_or_owner", - "volume:get_all_transfers": "rule:admin_or_owner", - - "volume_extension:replication:promote": "rule:admin_api", - "volume_extension:replication:reenable": "rule:admin_api", - - "volume:failover_host": "rule:admin_api", - "volume:freeze_host": "rule:admin_api", - "volume:thaw_host": "rule:admin_api", - - "backup:create" : "", - "backup:delete": "rule:admin_or_owner", - "backup:get": "rule:admin_or_owner", - "backup:get_all": "rule:admin_or_owner", - "backup:restore": "rule:admin_or_owner", - "backup:backup-import": "rule:admin_api", - "backup:backup-export": "rule:admin_api", - "backup:update": "rule:admin_or_owner", - - "snapshot_extension:snapshot_actions:update_snapshot_status": "", - "snapshot_extension:snapshot_manage": "rule:admin_api", - "snapshot_extension:snapshot_unmanage": "rule:admin_api", - "snapshot_extension:list_manageable": "rule:admin_api", - - "consistencygroup:create" : "group:nobody", - "consistencygroup:delete": "group:nobody", - "consistencygroup:update": "group:nobody", - "consistencygroup:get": "group:nobody", - "consistencygroup:get_all": "group:nobody", - - "consistencygroup:create_cgsnapshot" : "group:nobody", - "consistencygroup:delete_cgsnapshot": "group:nobody", - "consistencygroup:get_cgsnapshot": "group:nobody", - "consistencygroup:get_all_cgsnapshots": "group:nobody", - - "group:group_types_manage": "rule:admin_api", - "group:group_types_specs": "rule:admin_api", - "group:access_group_types_specs": "rule:admin_api", - "group:group_type_access": "rule:admin_or_owner", - - "group:create" : "", - "group:delete": "rule:admin_or_owner", - "group:update": "rule:admin_or_owner", - "group:get": "rule:admin_or_owner", - "group:get_all": "rule:admin_or_owner", - - "group:create_group_snapshot": "", - "group:delete_group_snapshot": "rule:admin_or_owner", - "group:update_group_snapshot": "rule:admin_or_owner", - "group:get_group_snapshot": "rule:admin_or_owner", - "group:get_all_group_snapshots": "rule:admin_or_owner", - - "scheduler_extension:scheduler_stats:get_pools" : "rule:admin_api", - "message:delete": "rule:admin_or_owner", - "message:get": "rule:admin_or_owner", - "message:get_all": "rule:admin_or_owner", - - "clusters:get": "rule:admin_api", - "clusters:get_all": "rule:admin_api", - "clusters:update": "rule:admin_api" -} diff --git a/cinder/values.yaml b/cinder/values.yaml index a4fbddf564..a6f445a262 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -180,8 +180,121 @@ conf: override: append: policy: - override: - append: + context_is_admin: role:admin + admin_or_owner: is_admin:True or project_id:%(project_id)s + default: rule:admin_or_owner + admin_api: is_admin:True + volume:create: '' + volume:delete: rule:admin_or_owner + volume:get: rule:admin_or_owner + volume:get_all: rule:admin_or_owner + volume:get_volume_metadata: rule:admin_or_owner + volume:create_volume_metadata: rule:admin_or_owner + volume:delete_volume_metadata: rule:admin_or_owner + volume:update_volume_metadata: rule:admin_or_owner + volume:get_volume_admin_metadata: rule:admin_api + volume:update_volume_admin_metadata: rule:admin_api + volume:get_snapshot: rule:admin_or_owner + volume:get_all_snapshots: rule:admin_or_owner + volume:create_snapshot: rule:admin_or_owner + volume:delete_snapshot: rule:admin_or_owner + volume:update_snapshot: rule:admin_or_owner + volume:get_snapshot_metadata: rule:admin_or_owner + volume:delete_snapshot_metadata: rule:admin_or_owner + volume:update_snapshot_metadata: rule:admin_or_owner + volume:extend: rule:admin_or_owner + volume:update_readonly_flag: rule:admin_or_owner + volume:retype: rule:admin_or_owner + volume:update: rule:admin_or_owner + volume_extension:types_manage: rule:admin_api + volume_extension:types_extra_specs: rule:admin_api + volume_extension:access_types_qos_specs_id: rule:admin_api + volume_extension:access_types_extra_specs: rule:admin_api + volume_extension:volume_type_access: rule:admin_or_owner + volume_extension:volume_type_access:addProjectAccess: rule:admin_api + volume_extension:volume_type_access:removeProjectAccess: rule:admin_api + volume_extension:volume_type_encryption: rule:admin_api + volume_extension:volume_encryption_metadata: rule:admin_or_owner + volume_extension:extended_snapshot_attributes: rule:admin_or_owner + volume_extension:volume_image_metadata: rule:admin_or_owner + volume_extension:quotas:show: '' + volume_extension:quotas:update: rule:admin_api + volume_extension:quotas:delete: rule:admin_api + volume_extension:quota_classes: rule:admin_api + volume_extension:quota_classes:validate_setup_for_nested_quota_use: rule:admin_api + volume_extension:volume_admin_actions:reset_status: rule:admin_api + volume_extension:snapshot_admin_actions:reset_status: rule:admin_api + volume_extension:backup_admin_actions:reset_status: rule:admin_api + volume_extension:volume_admin_actions:force_delete: rule:admin_api + volume_extension:volume_admin_actions:force_detach: rule:admin_api + volume_extension:snapshot_admin_actions:force_delete: rule:admin_api + volume_extension:backup_admin_actions:force_delete: rule:admin_api + volume_extension:volume_admin_actions:migrate_volume: rule:admin_api + volume_extension:volume_admin_actions:migrate_volume_completion: rule:admin_api + volume_extension:volume_actions:upload_public: rule:admin_api + volume_extension:volume_actions:upload_image: rule:admin_or_owner + volume_extension:volume_host_attribute: rule:admin_api + volume_extension:volume_tenant_attribute: rule:admin_or_owner + volume_extension:volume_mig_status_attribute: rule:admin_api + volume_extension:hosts: rule:admin_api + volume_extension:services:index: rule:admin_api + volume_extension:services:update: rule:admin_api + volume_extension:volume_manage: rule:admin_api + volume_extension:volume_unmanage: rule:admin_api + volume_extension:list_manageable: rule:admin_api + volume_extension:capabilities: rule:admin_api + volume:create_transfer: rule:admin_or_owner + volume:accept_transfer: '' + volume:delete_transfer: rule:admin_or_owner + volume:get_transfer: rule:admin_or_owner + volume:get_all_transfers: rule:admin_or_owner + volume_extension:replication:promote: rule:admin_api + volume_extension:replication:reenable: rule:admin_api + volume:failover_host: rule:admin_api + volume:freeze_host: rule:admin_api + volume:thaw_host: rule:admin_api + backup:create: '' + backup:delete: rule:admin_or_owner + backup:get: rule:admin_or_owner + backup:get_all: rule:admin_or_owner + backup:restore: rule:admin_or_owner + backup:backup-import: rule:admin_api + backup:backup-export: rule:admin_api + backup:update: rule:admin_or_owner + snapshot_extension:snapshot_actions:update_snapshot_status: '' + snapshot_extension:snapshot_manage: rule:admin_api + snapshot_extension:snapshot_unmanage: rule:admin_api + snapshot_extension:list_manageable: rule:admin_api + consistencygroup:create: group:nobody + consistencygroup:delete: group:nobody + consistencygroup:update: group:nobody + consistencygroup:get: group:nobody + consistencygroup:get_all: group:nobody + consistencygroup:create_cgsnapshot: group:nobody + consistencygroup:delete_cgsnapshot: group:nobody + consistencygroup:get_cgsnapshot: group:nobody + consistencygroup:get_all_cgsnapshots: group:nobody + group:group_types_manage: rule:admin_api + group:group_types_specs: rule:admin_api + group:access_group_types_specs: rule:admin_api + group:group_type_access: rule:admin_or_owner + group:create: '' + group:delete: rule:admin_or_owner + group:update: rule:admin_or_owner + group:get: rule:admin_or_owner + group:get_all: rule:admin_or_owner + group:create_group_snapshot: '' + group:delete_group_snapshot: rule:admin_or_owner + group:update_group_snapshot: rule:admin_or_owner + group:get_group_snapshot: rule:admin_or_owner + group:get_all_group_snapshots: rule:admin_or_owner + scheduler_extension:scheduler_stats:get_pools: rule:admin_api + message:delete: rule:admin_or_owner + message:get: rule:admin_or_owner + message:get_all: rule:admin_or_owner + clusters:get: rule:admin_api + clusters:get_all: rule:admin_api + clusters:update: rule:admin_api cinder_sudoers: override: append: