From d291a35754cba5aa55b0fb149bf2e304731ab9c5 Mon Sep 17 00:00:00 2001 From: Andy Lee Date: Thu, 7 May 2026 13:15:47 +0800 Subject: [PATCH] feat: add PodSecurityStandard setting (#842) * feat: add PodSecurity Standard setting Signed-off-by: Andy Lee * refactor: unneeded change Signed-off-by: Andy Lee * refactor: filter by isSystem namespace Signed-off-by: Andy Lee * refactor: add fallback logic Signed-off-by: Andy Lee --------- Signed-off-by: Andy Lee --- .../cluster-pod-security-standard.vue | 196 ++++++++++++++++++ pkg/harvester/config/feature-flags.js | 3 +- pkg/harvester/config/settings.ts | 6 +- pkg/harvester/l10n/en-us.yaml | 8 + 4 files changed, 211 insertions(+), 2 deletions(-) create mode 100644 pkg/harvester/components/settings/cluster-pod-security-standard.vue diff --git a/pkg/harvester/components/settings/cluster-pod-security-standard.vue b/pkg/harvester/components/settings/cluster-pod-security-standard.vue new file mode 100644 index 00000000..f548471f --- /dev/null +++ b/pkg/harvester/components/settings/cluster-pod-security-standard.vue @@ -0,0 +1,196 @@ + + + diff --git a/pkg/harvester/config/feature-flags.js b/pkg/harvester/config/feature-flags.js index 7023756f..4aa24d04 100644 --- a/pkg/harvester/config/feature-flags.js +++ b/pkg/harvester/config/feature-flags.js @@ -65,7 +65,8 @@ const FEATURE_FLAGS = { 'vGPUAsPCIDevice', 'instanceManagerResourcesSetting', 'rwxNetworkSetting', - 'createPVCWithDataVolume' + 'createPVCWithDataVolume', + 'clusterPodSecurityStandardSetting' ], 'v1.8.1': [], 'v1.9.0': [], diff --git a/pkg/harvester/config/settings.ts b/pkg/harvester/config/settings.ts index e7977f76..3d34f29a 100644 --- a/pkg/harvester/config/settings.ts +++ b/pkg/harvester/config/settings.ts @@ -41,7 +41,8 @@ export const HCI_SETTING = { RANCHER_CLUSTER: 'rancher-cluster', MAX_HOTPLUG_RATIO: 'max-hotplug-ratio', KUBEVIRT_MIGRATION: 'kubevirt-migration', - INSTANCE_MANAGER_RESOURCES: 'instance-manager-resources' + INSTANCE_MANAGER_RESOURCES: 'instance-manager-resources', + CLUSTER_POD_SECURITY_STANDARD: 'cluster-pod-security-standard' }; export const HCI_ALLOWED_SETTINGS = { @@ -130,6 +131,9 @@ export const HCI_ALLOWED_SETTINGS = { }, [HCI_SETTING.INSTANCE_MANAGER_RESOURCES]: { kind: 'json', from: 'import', featureFlag: 'instanceManagerResourcesSetting' + }, + [HCI_SETTING.CLUSTER_POD_SECURITY_STANDARD]: { + kind: 'json', from: 'import', canReset: true, featureFlag: 'clusterPodSecurityStandardSetting' } }; diff --git a/pkg/harvester/l10n/en-us.yaml b/pkg/harvester/l10n/en-us.yaml index dbbb4823..c22e0f23 100644 --- a/pkg/harvester/l10n/en-us.yaml +++ b/pkg/harvester/l10n/en-us.yaml @@ -1286,6 +1286,13 @@ harvester: rancherCluster: kubeConfig: Rancher KubeConfig removeUpstreamClusterWhenNamespaceIsDeleted: Remove Upstream Cluster When Namespace Is Deleted + clusterPodSecurityStandard: + whitelistedNamespaces: + label: 'Whitelisted Namespaces' + privilegedNamespaces: + label: 'Privileged Namespaces' + restrictedNamespaces: + label: 'Restricted Namespaces' storageNetwork: range: placeholder: e.g. 172.16.0.0/24 @@ -2043,6 +2050,7 @@ advancedSettings: 'harv-max-hotplug-ratio': 'The ratio for kubevirt to limit the maximum CPU and memory that can be hotplugged to a VM. The value could be an integer between 1 and 20, default to 4.' 'harv-kubevirt-migration': 'Configure cluster-wide KubeVirt live migration parameters.' 'harv-instance-manager-resources': 'Configure resource percentage reservations for Longhorn instance manager V1 and V2. Valid instance manager CPU range between 0 - 40.' + 'harv-cluster-pod-security-standard': 'Enforce Kubernetes Pod Security Standards (PSS) at the cluster level.' typeLabel: kubevirt.io.virtualmachine: |-