diff --git a/pkg/harvester/edit/kubeovn.io.subnet/AccessControlList.vue b/pkg/harvester/edit/kubeovn.io.subnet/AccessControlList.vue
new file mode 100644
index 00000000..311f8197
--- /dev/null
+++ b/pkg/harvester/edit/kubeovn.io.subnet/AccessControlList.vue
@@ -0,0 +1,196 @@
+
+
+
+
+
+
+
diff --git a/pkg/harvester/edit/kubeovn.io.subnet/index.vue b/pkg/harvester/edit/kubeovn.io.subnet/index.vue
index 016a8f0f..afdae774 100644
--- a/pkg/harvester/edit/kubeovn.io.subnet/index.vue
+++ b/pkg/harvester/edit/kubeovn.io.subnet/index.vue
@@ -15,6 +15,7 @@ import { allHash } from '@shell/utils/promise';
import { HCI } from '../../types';
import ResourceTabs from '@shell/components/form/ResourceTabs/index';
import { Banner } from '@components/Banner';
+import AccessControlList from './AccessControlList';
export default {
name: 'EditSubnet',
@@ -32,6 +33,7 @@ export default {
ArrayList,
ResourceTabs,
Loading,
+ AccessControlList
},
mixins: [CreateEditView],
@@ -51,7 +53,8 @@ export default {
gatewayIP: '',
excludeIps: [],
private: false,
- enableDHCP
+ enableDHCP,
+ acls: []
});
},
@@ -143,6 +146,7 @@ export default {
async saveSubnet(buttonCb) {
const errors = [];
const name = this.value?.metadata?.name;
+ const hasEmptyAcls = this.value?.spec?.acls?.some((acl) => !acl.match || !acl.action || acl.priority === undefined || acl.priority === null);
try {
if (!name) {
@@ -153,6 +157,8 @@ export default {
errors.push(this.t('validation.required', { key: this.t('harvester.subnet.provider.label') }, true));
} else if (this.value.spec.excludeIps.includes('')) {
errors.push(this.t('harvester.validation.subnet.excludeIps'));
+ } else if (hasEmptyAcls) {
+ errors.push(this.t('harvester.validation.subnet.aclEmptyError'));
}
if (errors.length > 0) {
@@ -371,6 +377,17 @@ export default {
+
+
+
diff --git a/pkg/harvester/l10n/en-us.yaml b/pkg/harvester/l10n/en-us.yaml
index dbaafef5..1ba85caf 100644
--- a/pkg/harvester/l10n/en-us.yaml
+++ b/pkg/harvester/l10n/en-us.yaml
@@ -404,7 +404,7 @@ harvester:
sha512: 'Invalid SHA512 checksum.'
subnet:
excludeIps: 'Exclude IPs cannot be empty. Please remove or fill in the exclude IPs.'
-
+ aclEmptyError: The fields in subnet access control list rule can not be empty.
dashboard:
label: Dashboard
header: "Harvester Cluster: {cluster}"
@@ -1062,7 +1062,24 @@ harvester:
placeholder: e.g. 172.16.0.0/16
excludeIPs:
tooltip: The IP address list to reserve from automatic assignment. The gateway IP address is always excluded and will be automatically added to the list.
-
+ acl:
+ label: Access Control List
+ tooltip: The ACL to apply to this Subnet. Must be one of the ACLs in the same namespace.
+ action:
+ label: Action
+ placeholder: Please select an action
+ direction:
+ label: Direction
+ placeholder: Please select a direction
+ addRule: Add Rule
+ priority:
+ label: Priority
+ placeholder: Please select a priority
+ match:
+ label: Match
+ placeholder: e.g. ip4.dst == 10.10.0.2
+ banner: The supported field in ACL match can refer to KubeOvn Subnet ACL document
+
vpc:
noAddonEnabled:
prefix: The kubeovn-operator add-on is not enabled, click