fix: expose container to host only with labels (#1880)

Signed-off-by: ahmed.g <ahmed.g@adjoe.io>
Signed-off-by: TessaIO <ahmedgrati1999@gmail.com>
This commit is contained in:
TessaIO
2024-05-29 16:05:04 -04:00
committed by GitHub
parent 29f6765fc6
commit 3bf98301f7
52 changed files with 19 additions and 163 deletions
@@ -80,7 +80,6 @@ spec:
name: web
ports:
- containerPort: 5000
hostPort: 5000
protocol: TCP
volumeMounts:
- mountPath: /code
-1
View File
@@ -80,7 +80,6 @@ spec:
name: web
ports:
- containerPort: 5000
hostPort: 5000
protocol: TCP
volumeMounts:
- mountPath: /code
@@ -107,7 +107,6 @@ spec:
name: web
ports:
- containerPort: 5000
hostPort: 5000
protocol: TCP
volumeMounts:
- mountPath: /code
-1
View File
@@ -107,7 +107,6 @@ spec:
name: web
ports:
- containerPort: 5000
hostPort: 5000
protocol: TCP
volumeMounts:
- mountPath: /code
@@ -37,7 +37,6 @@ spec:
name: foo
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
@@ -51,7 +51,6 @@ spec:
name: alpine
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
@@ -78,7 +77,6 @@ spec:
name: debian
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
@@ -37,7 +37,6 @@ spec:
name: web
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
@@ -45,10 +45,8 @@ spec:
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
volumeMounts:
- mountPath: /certs
@@ -45,10 +45,8 @@ spec:
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
volumeMounts:
- mountPath: /certs
@@ -41,9 +41,7 @@ spec:
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
restartPolicy: Always
@@ -44,10 +44,8 @@ spec:
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
volumeMounts:
- mountPath: /certs
@@ -44,10 +44,8 @@ spec:
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
volumeMounts:
- mountPath: /certs
@@ -40,10 +40,8 @@ spec:
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
restartPolicy: Always
test: false
-1
View File
@@ -44,7 +44,6 @@ spec:
name: redis
ports:
- containerPort: 6379
hostPort: 6379
protocol: TCP
restartPolicy: Never
-1
View File
@@ -44,7 +44,6 @@ spec:
name: redis
ports:
- containerPort: 6379
hostPort: 6379
protocol: TCP
restartPolicy: Never
-4
View File
@@ -70,10 +70,8 @@ spec:
name: another-namenode
ports:
- containerPort: 50070
hostPort: 50070
protocol: TCP
- containerPort: 8020
hostPort: 8020
protocol: TCP
resources: {}
restartPolicy: Always
@@ -135,10 +133,8 @@ spec:
name: namenode
ports:
- containerPort: 50070
hostPort: 50070
protocol: TCP
- containerPort: 8020
hostPort: 8020
protocol: TCP
resources: {}
restartPolicy: Always
-4
View File
@@ -92,10 +92,8 @@ spec:
name: another-namenode
ports:
- containerPort: 50070
hostPort: 50070
protocol: TCP
- containerPort: 8020
hostPort: 8020
protocol: TCP
resources: {}
restartPolicy: Always
@@ -169,10 +167,8 @@ spec:
name: namenode
ports:
- containerPort: 50070
hostPort: 50070
protocol: TCP
- containerPort: 8020
hostPort: 8020
protocol: TCP
resources: {}
restartPolicy: Always
-4
View File
@@ -68,10 +68,8 @@ spec:
name: another-namenode
ports:
- containerPort: 50070
hostPort: 50070
protocol: TCP
- containerPort: 8020
hostPort: 8020
protocol: TCP
restartPolicy: Always
@@ -123,10 +121,8 @@ spec:
name: namenode
ports:
- containerPort: 50070
hostPort: 50070
protocol: TCP
- containerPort: 8020
hostPort: 8020
protocol: TCP
restartPolicy: Always
-4
View File
@@ -78,10 +78,8 @@ spec:
name: another-namenode
ports:
- containerPort: 50070
hostPort: 50070
protocol: TCP
- containerPort: 8020
hostPort: 8020
protocol: TCP
restartPolicy: Always
test: false
@@ -149,10 +147,8 @@ spec:
name: namenode
ports:
- containerPort: 50070
hostPort: 50070
protocol: TCP
- containerPort: 8020
hostPort: 8020
protocol: TCP
restartPolicy: Always
test: false
@@ -45,6 +45,5 @@ spec:
name: app
ports:
- containerPort: 3000
hostPort: 3000
protocol: TCP
restartPolicy: Always
@@ -44,7 +44,6 @@ spec:
name: app
ports:
- containerPort: 3000
hostPort: 3000
protocol: TCP
restartPolicy: Always
test: false
-1
View File
@@ -77,7 +77,6 @@ spec:
name: web
ports:
- containerPort: 5000
hostPort: 5000
protocol: TCP
restartPolicy: Always
-1
View File
@@ -104,7 +104,6 @@ spec:
name: web
ports:
- containerPort: 5000
hostPort: 5000
protocol: TCP
restartPolicy: Always
test: false
@@ -41,7 +41,6 @@ spec:
name: front-end
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
@@ -41,7 +41,6 @@ spec:
name: front-end
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
@@ -40,7 +40,6 @@ spec:
name: front-end
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
test: false
@@ -40,7 +40,6 @@ spec:
name: front-end
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
test: false
+2
View File
@@ -2,6 +2,8 @@ version: "3.3"
services:
nginx:
labels:
kompose.container.kompose.controller.port.expose: true
ports:
- target: 80
published: 80
@@ -13,7 +13,6 @@ spec:
selector:
io.kompose.service: nginx
---
apiVersion: apps/v1
kind: Deployment
@@ -37,8 +36,6 @@ spec:
name: nginx
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
@@ -35,7 +35,6 @@ spec:
name: nginx
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
test: false
-1
View File
@@ -47,7 +47,6 @@ spec:
name: web
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
-1
View File
@@ -44,7 +44,6 @@ spec:
name: web
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
test: false
+1 -2
View File
@@ -39,11 +39,10 @@ spec:
name: threats-client
ports:
- containerPort: 8080
hostPort: 8080
protocol: TCP
- args:
- sleep
- infinity
image: busybox
name: threats-server
restartPolicy: Always
restartPolicy: Always
-1
View File
@@ -37,7 +37,6 @@ spec:
name: nginx
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
-1
View File
@@ -37,7 +37,6 @@ spec:
name: test
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
securityContext:
readOnlyRootFilesystem: true
-1
View File
@@ -35,7 +35,6 @@ spec:
name: test
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
securityContext:
readOnlyRootFilesystem: true
@@ -36,7 +36,6 @@ spec:
name: nginx
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
@@ -35,7 +35,6 @@ spec:
name: nginx
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
test: false
-1
View File
@@ -48,7 +48,6 @@ spec:
name: librenms
ports:
- containerPort: 8000
hostPort: 8000
protocol: TCP
volumeMounts:
- mountPath: /data
@@ -39,7 +39,6 @@ spec:
name: front-end
ports:
- containerPort: 80
hostPort: 80
protocol: TCP
restartPolicy: Always
-2
View File
@@ -67,7 +67,6 @@ spec:
name: db
ports:
- containerPort: 3306
hostPort: 3306
protocol: TCP
volumeMounts:
- mountPath: /var/lib/mysql
@@ -118,7 +117,6 @@ spec:
name: wordpress
ports:
- containerPort: 80
hostPort: 8000
protocol: TCP
volumeMounts:
- mountPath: /var/www/html
-4
View File
@@ -63,7 +63,6 @@ spec:
name: db
ports:
- containerPort: 3306
hostPort: 3306
protocol: TCP
volumeMounts:
- mountPath: /var/lib/mysql
@@ -114,7 +113,6 @@ spec:
name: db
ports:
- containerPort: 3306
hostPort: 3306
protocol: TCP
volumeMounts:
- mountPath: /var/lib/mysql
@@ -185,7 +183,6 @@ spec:
name: wordpress
ports:
- containerPort: 80
hostPort: 8000
protocol: TCP
volumeMounts:
- mountPath: /var/www/html
@@ -236,7 +233,6 @@ spec:
name: wordpress
ports:
- containerPort: 80
hostPort: 8000
protocol: TCP
volumeMounts:
- mountPath: /var/www/html
-40
View File
@@ -17,9 +17,6 @@ spec:
- name: "3000"
port: 3000
targetPort: 3000
- name: 3000-tcp
port: 3000
targetPort: 3000
- name: "3001"
port: 3001
targetPort: 3001
@@ -90,8 +87,6 @@ spec:
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.service.type: loadbalancer
labels:
io.kompose.service: redis-tcp
name: redis-tcp
@@ -108,8 +103,6 @@ spec:
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.service.type: loadbalancer
labels:
io.kompose.service: redis-udp
name: redis-udp
@@ -156,64 +149,36 @@ spec:
- containerPort: 3005
protocol: TCP
- containerPort: 8000
hostPort: 8000
protocol: TCP
- containerPort: 8080
hostPort: 9090
protocol: TCP
- containerPort: 8081
hostPort: 9091
protocol: TCP
- containerPort: 22
hostPort: 49100
protocol: TCP
- containerPort: 8001
hostIP: 127.0.0.1
hostPort: 8001
protocol: TCP
- containerPort: 5000
hostIP: 127.0.0.1
hostPort: 5000
protocol: TCP
- containerPort: 5001
hostIP: 127.0.0.1
hostPort: 5001
protocol: TCP
- containerPort: 5002
hostIP: 127.0.0.1
hostPort: 5002
protocol: TCP
- containerPort: 5003
hostIP: 127.0.0.1
hostPort: 5003
protocol: TCP
- containerPort: 5004
hostIP: 127.0.0.1
hostPort: 5004
protocol: TCP
- containerPort: 5005
hostIP: 127.0.0.1
hostPort: 5005
protocol: TCP
- containerPort: 5006
hostIP: 127.0.0.1
hostPort: 5006
protocol: TCP
- containerPort: 5007
hostIP: 127.0.0.1
hostPort: 5007
protocol: TCP
- containerPort: 5008
hostIP: 127.0.0.1
hostPort: 5008
protocol: TCP
- containerPort: 5009
hostIP: 127.0.0.1
hostPort: 5009
protocol: TCP
- containerPort: 5010
hostIP: 127.0.0.1
hostPort: 5010
protocol: TCP
resources:
limits:
@@ -227,8 +192,6 @@ spec:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.service.type: loadbalancer
labels:
io.kompose.service: redis
name: redis
@@ -239,8 +202,6 @@ spec:
io.kompose.service: redis
template:
metadata:
annotations:
kompose.service.type: loadbalancer
labels:
io.kompose.network/v2-default: "true"
io.kompose.service: redis
@@ -252,7 +213,6 @@ spec:
- containerPort: 6379
protocol: TCP
- containerPort: 1235
hostPort: 1234
protocol: UDP
resources:
limits:
-38
View File
@@ -17,9 +17,6 @@ spec:
- name: "3000"
port: 3000
targetPort: 3000
- name: 3000-tcp
port: 3000
targetPort: 3000
- name: "3001"
port: 3001
targetPort: 3001
@@ -90,8 +87,6 @@ spec:
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.service.type: loadbalancer
labels:
io.kompose.service: redis-tcp
name: redis-tcp
@@ -108,8 +103,6 @@ spec:
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.service.type: loadbalancer
labels:
io.kompose.service: redis-udp
name: redis-udp
@@ -156,64 +149,36 @@ spec:
- containerPort: 3005
protocol: TCP
- containerPort: 8000
hostPort: 8000
protocol: TCP
- containerPort: 8080
hostPort: 9090
protocol: TCP
- containerPort: 8081
hostPort: 9091
protocol: TCP
- containerPort: 22
hostPort: 49100
protocol: TCP
- containerPort: 8001
hostIP: 127.0.0.1
hostPort: 8001
protocol: TCP
- containerPort: 5000
hostIP: 127.0.0.1
hostPort: 5000
protocol: TCP
- containerPort: 5001
hostIP: 127.0.0.1
hostPort: 5001
protocol: TCP
- containerPort: 5002
hostIP: 127.0.0.1
hostPort: 5002
protocol: TCP
- containerPort: 5003
hostIP: 127.0.0.1
hostPort: 5003
protocol: TCP
- containerPort: 5004
hostIP: 127.0.0.1
hostPort: 5004
protocol: TCP
- containerPort: 5005
hostIP: 127.0.0.1
hostPort: 5005
protocol: TCP
- containerPort: 5006
hostIP: 127.0.0.1
hostPort: 5006
protocol: TCP
- containerPort: 5007
hostIP: 127.0.0.1
hostPort: 5007
protocol: TCP
- containerPort: 5008
hostIP: 127.0.0.1
hostPort: 5008
protocol: TCP
- containerPort: 5009
hostIP: 127.0.0.1
hostPort: 5009
protocol: TCP
- containerPort: 5010
hostIP: 127.0.0.1
hostPort: 5010
protocol: TCP
resources:
limits:
@@ -227,8 +192,6 @@ spec:
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
annotations:
kompose.service.type: loadbalancer
labels:
io.kompose.service: redis
name: redis
@@ -249,7 +212,6 @@ spec:
- containerPort: 6379
protocol: TCP
- containerPort: 1235
hostPort: 1234
protocol: UDP
resources:
limits:
-6
View File
@@ -2,8 +2,6 @@
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.service.type: headless
labels:
io.kompose.service: redis
name: redis
@@ -49,8 +47,6 @@ spec:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.service.type: headless
labels:
io.kompose.service: redis
name: redis
@@ -61,8 +57,6 @@ spec:
io.kompose.service: redis
template:
metadata:
annotations:
kompose.service.type: headless
labels:
io.kompose.network/v30-default: "true"
io.kompose.service: redis
-6
View File
@@ -2,8 +2,6 @@
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.service.type: headless
labels:
io.kompose.service: redis
name: redis
@@ -27,8 +25,6 @@ spec:
replicas: 1
selector:
io.kompose.service: foo
strategy:
resources: {}
template:
metadata:
labels:
@@ -79,8 +75,6 @@ spec:
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
annotations:
kompose.service.type: headless
labels:
io.kompose.service: redis
name: redis