File tree 2 files changed +28
-3
lines changed
2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
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
+
3
18
set -o errexit
4
19
set -o nounset
5
20
set -o pipefail
13
28
function default-deny() {
14
29
oc create --namespace " $1 " -f - << EOF
15
30
kind: NetworkPolicy
16
- apiVersion: extensions/v1beta1
31
+ apiVersion: networking.k8s.io/v1
17
32
metadata:
18
33
name: default-deny
19
34
spec:
24
39
function allow-from-self() {
25
40
oc create --namespace " $1 " -f - << EOF
26
41
kind: NetworkPolicy
27
- apiVersion: extensions/v1beta1
42
+ apiVersion: networking.k8s.io/v1
28
43
metadata:
29
44
name: allow-from-self
30
45
spec:
38
53
function allow-from-other() {
39
54
oc create --namespace " $1 " -f - << EOF
40
55
kind: NetworkPolicy
41
- apiVersion: extensions/v1beta1
56
+ apiVersion: networking.k8s.io/v1
42
57
metadata:
43
58
name: $2
44
59
spec:
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
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
+
3
13
set -o errexit
4
14
set -o nounset
5
15
set -o pipefail
You can’t perform that action at this time.
0 commit comments