Enable hostNetwork for person-detection app
Change-Id: Ib8a5bf675a8c984c6645e2991abe57a2f0a00857
diff --git a/apps/person-detection-app/templates/NOTES.txt b/apps/person-detection-app/templates/NOTES.txt
index 3315e01..6f6b085 100644
--- a/apps/person-detection-app/templates/NOTES.txt
+++ b/apps/person-detection-app/templates/NOTES.txt
@@ -4,24 +4,5 @@
*/}}
1. Get the application URL by running these commands:
-{{- if .Values.ingress.enabled }}
-{{- range $host := .Values.ingress.hosts }}
- {{- range .paths }}
- http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
- {{- end }}
-{{- end }}
-{{- else if contains "NodePort" .Values.service.streaming.type }}
- export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "person-detection-app.fullname" . }})
- export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
- echo http://$NODE_IP:$NODE_PORT
-{{- else if contains "LoadBalancer" .Values.service.streaming.type }}
- NOTE: It may take a few minutes for the LoadBalancer IP to be available.
- You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "person-detection-app.fullname" . }}'
- export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "person-detection-app.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
- echo http://$SERVICE_IP:{{ .Values.service.streaming.port }}
-{{- else if contains "ClusterIP" .Values.service.streaming.type }}
- export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "person-detection-app.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
- export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
- echo "Visit http://127.0.0.1:8080 to use your application"
- kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
-{{- end }}
+ export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -l app.kubernetes.io/name=person-detection-app -o jsonpath="{.items[*].status.podIP}")
+ echo http://$NODE_IP:5000
diff --git a/apps/person-detection-app/templates/deployment.yaml b/apps/person-detection-app/templates/deployment.yaml
index 09058d2..71a7f8d 100644
--- a/apps/person-detection-app/templates/deployment.yaml
+++ b/apps/person-detection-app/templates/deployment.yaml
@@ -33,6 +33,8 @@
serviceAccountName: {{ include "person-detection-app.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
+ hostNetwork: true
+ dnsPolicy: ClusterFirstWithHostNet
containers:
- name: {{ .Chart.Name }}
securityContext:
@@ -47,12 +49,12 @@
- name: ROCUSER
valueFrom:
secretKeyRef:
- name: rocsecret
+ name: {{ .Values.rocSecret }}
key: username
- name: ROCPASSWORD
valueFrom:
secretKeyRef:
- name: rocsecret
+ name: {{ .Values.rocSecret }}
key: password
- name: ROCURL
value: {{ .Values.rocUrl }}
diff --git a/apps/person-detection-app/templates/ingress.yaml b/apps/person-detection-app/templates/ingress.yaml
deleted file mode 100644
index 25822dd..0000000
--- a/apps/person-detection-app/templates/ingress.yaml
+++ /dev/null
@@ -1,67 +0,0 @@
-{{/*
-# Copyright 2022-present Open Networking Foundation
-
-# SPDX-License-Identifier: Apache-2.0
-*/}}
-
-{{- if .Values.ingress.enabled -}}
-{{- $fullName := include "person-detection-app.fullname" . -}}
-{{- $svcPort := .Values.service.streaming.port -}}
-{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
- {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
- {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
- {{- end }}
-{{- end }}
-{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
-apiVersion: networking.k8s.io/v1
-{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
-apiVersion: networking.k8s.io/v1beta1
-{{- else -}}
-apiVersion: extensions/v1beta1
-{{- end }}
-kind: Ingress
-metadata:
- name: {{ $fullName }}
- labels:
- {{- include "person-detection-app.labels" . | nindent 4 }}
- {{- with .Values.ingress.annotations }}
- annotations:
- {{- toYaml . | nindent 4 }}
- {{- end }}
-spec:
- {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
- ingressClassName: {{ .Values.ingress.className }}
- {{- end }}
- {{- if .Values.ingress.tls }}
- tls:
- {{- range .Values.ingress.tls }}
- - hosts:
- {{- range .hosts }}
- - {{ . | quote }}
- {{- end }}
- secretName: {{ .secretName }}
- {{- end }}
- {{- end }}
- rules:
- {{- range .Values.ingress.hosts }}
- - host: {{ .host | quote }}
- http:
- paths:
- {{- range .paths }}
- - path: {{ .path }}
- {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
- pathType: {{ .pathType }}
- {{- end }}
- backend:
- {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
- service:
- name: {{ $fullName }}-streaming
- port:
- number: {{ $svcPort }}
- {{- else }}
- serviceName: {{ $fullName }}-streaming
- servicePort: {{ $svcPort }}
- {{- end }}
- {{- end }}
- {{- end }}
-{{- end }}
diff --git a/apps/person-detection-app/templates/service.yaml b/apps/person-detection-app/templates/service.yaml
deleted file mode 100644
index 3b37784..0000000
--- a/apps/person-detection-app/templates/service.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-{{/*
-# Copyright 2022-present Open Networking Foundation
-
-# SPDX-License-Identifier: Apache-2.0
-*/}}
-
-apiVersion: v1
-kind: Service
-metadata:
- name: {{ include "person-detection-app.fullname" . }}-streaming
- labels:
- {{- include "person-detection-app.labels" . | nindent 4 }}
-spec:
- type: {{ .Values.service.streaming.type }}
- ports:
- - port: {{ .Values.service.streaming.port }}
- protocol: TCP
- selector:
- {{- include "person-detection-app.selectorLabels" . | nindent 4 }}
----
-apiVersion: v1
-kind: Service
-metadata:
- name: {{ include "person-detection-app.fullname" . }}-input
- labels:
- {{- include "person-detection-app.labels" . | nindent 4 }}
-spec:
- type: {{ .Values.service.input.type }}
- ports:
- - port: {{ .Values.service.input.port }}
- protocol: UDP
- selector:
- {{- include "person-detection-app.selectorLabels" . | nindent 4 }}
diff --git a/apps/person-detection-app/templates/tests/test-connection.yaml b/apps/person-detection-app/templates/tests/test-connection.yaml
deleted file mode 100644
index 23c6081..0000000
--- a/apps/person-detection-app/templates/tests/test-connection.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-{{/*
-# Copyright 2022-present Open Networking Foundation
-
-# SPDX-License-Identifier: Apache-2.0
-*/}}
-
-apiVersion: v1
-kind: Pod
-metadata:
- name: "{{ include "person-detection-app.fullname" . }}-test-connection"
- labels:
- {{- include "person-detection-app.labels" . | nindent 4 }}
- annotations:
- "helm.sh/hook": test
-spec:
- containers:
- - name: wget
- image: busybox
- command: ['wget']
- args: ['{{ include "person-detection-app.fullname" . }}:{{ .Values.service.streaming.port }}']
- restartPolicy: Never