File tree Expand file tree Collapse file tree
manager/integration/deploy/backupstores
terraform/aws/sles/user-data-scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ apiVersion : networking.k8s.io/v1
2+ kind : NetworkPolicy
3+ metadata :
4+ # Purpose: Allow ingress traffic to the NFS BackupStore
5+ name : allow-backupstore-nfs-ingress
6+ namespace : default
7+ spec :
8+ # Target: Apply to pods with label app: longhorn-test-nfs
9+ podSelector :
10+ matchLabels :
11+ app : longhorn-test-nfs
12+ policyTypes :
13+ - Ingress
14+ ingress :
15+ # Rule 1: Allow traffic from the longhorn-system namespace (Production Backup Traffic)
16+ - from :
17+ - namespaceSelector :
18+ matchLabels :
19+ kubernetes.io/metadata.name : longhorn-system
20+ # Rule 2: Allow traffic from the Test Client Pod within the SAME namespace (Test Traffic)
21+ # Note: A podSelector without a namespaceSelector implies the current namespace.
22+ - from :
23+ - podSelector :
24+ matchLabels :
25+ longhorn-test : test-job # Matches the specific label of the longhorn-test pod
26+ ports :
27+ - protocol : TCP
28+ port : 2049 # NFS port
29+ - protocol : TCP
30+ port : 111 # RPCBind port
31+
32+ ---
33+ apiVersion : networking.k8s.io/v1
34+ kind : NetworkPolicy
35+ metadata :
36+ # Purpose: Allow ingress traffic to the MinIO BackupStore
37+ name : allow-backupstore-minio-ingress
38+ namespace : default
39+ spec :
40+ # Target: Apply to pods with label app: longhorn-test-minio
41+ podSelector :
42+ matchLabels :
43+ app : longhorn-test-minio
44+ policyTypes :
45+ - Ingress
46+ ingress :
47+ # Rule 1: Allow traffic from the longhorn-system namespace (Production Backup Traffic)
48+ - from :
49+ - namespaceSelector :
50+ matchLabels :
51+ kubernetes.io/metadata.name : longhorn-system
52+ # Rule 2: Allow traffic from the Test Client Pod within the SAME namespace (Test Traffic)
53+ - from :
54+ - podSelector :
55+ matchLabels :
56+ longhorn-test : test-job # Matches the specific label of the longhorn-test pod
57+ ports :
58+ - protocol : TCP
59+ port : 9000 # MinIO API port
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ main(){
4444 create_instance_mapping_configmap
4545
4646 install_backupstores
47+ install_backupstores_networkpolicy
4748 setup_azurite_backup_store
4849 install_csi_snapshotter
4950 create_nad_without_storage_network
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ main(){
4141
4242 create_longhorn_namespace
4343 install_backupstores
44+ install_backupstores_networkpolicy
4445 setup_azurite_backup_store
4546 install_csi_snapshotter
4647
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ main(){
3535
3636 create_longhorn_namespace
3737 install_backupstores
38+ install_backupstores_networkpolicy
3839 setup_azurite_backup_store
3940 install_csi_snapshotter
4041
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ main(){
5858
5959 create_longhorn_namespace
6060 install_backupstores
61+ install_backupstores_networkpolicy
6162 setup_azurite_backup_store
6263 install_csi_snapshotter
6364
Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ setup_azurite_backup_store(){
5757 kubectl delete pod az-cli --ignore-not-found
5858}
5959
60+ install_backupstores_networkpolicy (){
61+ BACKUPSTORE_NETWORK_POLICY_URL=" https://raw.githubusercontent.com/longhorn/longhorn-tests/master/manager/integration/deploy/backupstores/backupstore-networkpolicy.yaml"
62+ kubectl create -f ${BACKUPSTORE_NETWORK_POLICY_URL}
63+ }
64+
6065if [[ " ${BASH_SOURCE[0]} " == " ${0} " ]]; then
6166 if declare -f " $1 " > /dev/null; then
6267 " $@ "
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ main(){
7676 fi
7777 setup_azurite_backup_store
7878 fi
79+ install_backupstores_networkpolicy
7980 install_csi_snapshotter
8081 if [[ " ${TF_VAR_enable_mtls} " == true ]]; then
8182 enable_mtls
Original file line number Diff line number Diff line change 8484 systemctl restart systemd-sysctl
8585 useradd -r -c " etcd user" -s /sbin/nologin -M etcd -U
8686 cat << EOF >> /etc/rancher/rke2/config.yaml
87- profile: "cis-1.23"
87+ profile: "cis"
88+ kube-apiserver-arg:
89+ - 'service-account-extend-token-expiration=false'
8890EOF
8991fi
9092
Original file line number Diff line number Diff line change 6262 systemctl restart systemd-sysctl
6363 useradd -r -c " etcd user" -s /sbin/nologin -M etcd -U
6464 cat << EOF >> /etc/rancher/rke2/config.yaml
65- profile: "cis-1.23"
65+ profile: "cis"
66+ kube-apiserver-arg:
67+ - 'service-account-extend-token-expiration=false'
6668EOF
6769fi
6870
You can’t perform that action at this time.
0 commit comments