add ns networkpolicy
This commit is contained in:
13
test/network/OWNERS
Normal file
13
test/network/OWNERS
Normal file
@@ -0,0 +1,13 @@
|
||||
approvers:
|
||||
- magicsong
|
||||
- zryfish
|
||||
- zheng1
|
||||
|
||||
reviewers:
|
||||
- magicsong
|
||||
- zheng1
|
||||
- zryfish
|
||||
|
||||
labels:
|
||||
- area/controller
|
||||
- area/networking
|
||||
57
test/network/manifests/sample1.yaml
Normal file
57
test/network/manifests/sample1.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
apiVersion: network.kubesphere.io/v1alpha1
|
||||
kind: NamespaceNetworkPolicy
|
||||
metadata:
|
||||
name: allow-tcp-80
|
||||
namespace: production
|
||||
spec:
|
||||
selector: color == 'red'
|
||||
ingress:
|
||||
- action: Allow
|
||||
protocol: TCP
|
||||
source:
|
||||
selector: color == 'blue'
|
||||
# destination:
|
||||
# ports:
|
||||
# - 80
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx
|
||||
namespace: production
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nginx
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 1
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
color : red
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:alpine
|
||||
name: nginx
|
||||
imagePullPolicy: IfNotPresent
|
||||
resources:
|
||||
requests:
|
||||
cpu: "20m"
|
||||
memory: "55M"
|
||||
env:
|
||||
- name: ENVVARNAME
|
||||
value: ENVVARVALUE
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http
|
||||
restartPolicy: Always
|
||||
17
test/network/manifests/test-job.yaml
Normal file
17
test/network/manifests/test-job.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: test-connect
|
||||
namespace: production
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
color : blue
|
||||
spec:
|
||||
containers:
|
||||
- name: test-connect
|
||||
image: alpine
|
||||
command: ["ping", "10.17.30.131"]
|
||||
restartPolicy: Never
|
||||
backoffLimit: 1
|
||||
Reference in New Issue
Block a user