Skip to content

Commit dbdc144

Browse files
Merge pull request #19977 from danwinship/update-migration-script
Update apiVersion in migrate-network-policy.sh, add comments
2 parents fd71d11 + e939fc6 commit dbdc144

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

contrib/migration/migrate-network-policy.sh

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
#!/bin/bash
22

3+
# Prepares a multitenant cluster for running the networkpolicy plugin by
4+
#
5+
# 1) creating NetworkPolicy objects (and Namespace labels) that
6+
# implement the same isolation/sharing as had been configured in
7+
# the multitenant cluster via "oc adm pod-network".
8+
#
9+
# 2) re-isolating all projects that had previously been joined or
10+
# made global (since the networkpolicy plugin requires every
11+
# project to have a distinct NetID).
12+
#
13+
# See the documentation for more information on how to use this script
14+
# (the section "Migrating from ovs-networkpolicy to ovs-multitenant"
15+
# in the "Configuring the SDN" document in the "Installation and
16+
# Configuration" guide).
17+
318
set -o errexit
419
set -o nounset
520
set -o pipefail
@@ -13,7 +28,7 @@ fi
1328
function default-deny() {
1429
oc create --namespace "$1" -f - <<EOF
1530
kind: NetworkPolicy
16-
apiVersion: extensions/v1beta1
31+
apiVersion: networking.k8s.io/v1
1732
metadata:
1833
name: default-deny
1934
spec:
@@ -24,7 +39,7 @@ EOF
2439
function allow-from-self() {
2540
oc create --namespace "$1" -f - <<EOF
2641
kind: NetworkPolicy
27-
apiVersion: extensions/v1beta1
42+
apiVersion: networking.k8s.io/v1
2843
metadata:
2944
name: allow-from-self
3045
spec:
@@ -38,7 +53,7 @@ EOF
3853
function allow-from-other() {
3954
oc create --namespace "$1" -f - <<EOF
4055
kind: NetworkPolicy
41-
apiVersion: extensions/v1beta1
56+
apiVersion: networking.k8s.io/v1
4257
metadata:
4358
name: $2
4459
spec:

contrib/migration/unmigrate-network-policy.sh

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#!/bin/bash
22

3+
# Undoes the effects of the migrate-network-policy.sh script by
4+
# re-isolating and re-making-global the previously isolated/global
5+
# projects.
6+
#
7+
# This only undoes the changes originally made by the migration script
8+
# (or other changes that were intentionally made to look the same as
9+
# the changes made by the migration script). It does not attempt to
10+
# convert arbitrary NetworkPolicy objects into multitenant-style
11+
# isolation.
12+
313
set -o errexit
414
set -o nounset
515
set -o pipefail

0 commit comments

Comments
 (0)