Skip to content

Commit

Permalink
Expose 6653 port on each node through NodePort to allow OF Master/Sta…
Browse files Browse the repository at this point in the history
…ndby connection (#201)

* [VOL-3415] exposing openflow on all ONOS replicas through nodeports

* Fixing the selector

* Using only nodeports with pod name as selector

* fixing selector and adding values to expose nodeports

* Bumping the chart version

* Defaulting exposeNodePorts to false

* Changing flag name
  • Loading branch information
Andrea-Campanella authored Sep 7, 2020
1 parent a5cd39f commit fbaef1e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.idea/
build/release
build/_output
.DS_Store
2 changes: 1 addition & 1 deletion onos-classic/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
apiVersion: v1
name: onos-classic
version: 0.1.7
version: 0.1.8
kubeVersion: ">=1.10.0"
appVersion: 2.2.4
description: ONOS cluster
Expand Down
42 changes: 24 additions & 18 deletions onos-classic/templates/nodeports.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
---
{{- if .Values.onosOfPort }}
{{- if .Values.onosApiPort }}
apiVersion: v1
kind: Service
metadata:
name: onos-of
name: onos-api
spec:
type: NodePort
ports:
- name: onos-of
port: 6653
nodePort: {{ .Values.onosOfPort }}
- name: onos-api
port: 8181
nodePort: {{ .Values.onosApiPort }}
selector:
app: {{ template "fullname" . }}
{{- end}}
{{- end}}
---
{{- if .Values.onosApiPort }}
{{- if .Values.onosSshPort }}
apiVersion: v1
kind: Service
metadata:
name: onos-api
name: onos-ssh
spec:
type: NodePort
ports:
- name: onos-api
port: 8181
nodePort: {{ .Values.onosApiPort }}
- name: onos-ssh
port: 8101
nodePort: {{ .Values.onosSshPort }}
selector:
app: {{ template "fullname" . }}
{{- end}}
{{- end}}

# workaround for . not working, see
# https://github.com/helm/helm/issues/1311
{{- if .Values.individualOpenFlowNodePorts }}
{{- $root := . -}}
{{ range $k, $index := until (atoi (quote .Values.replicas) | default 3) }}
---
{{- if .Values.onosSshPort }}
apiVersion: v1
kind: Service
metadata:
name: onos-ssh
name: onos-of-{{ $index }}
spec:
type: NodePort
ports:
- name: onos-ssh
port: 8101
nodePort: {{ .Values.onosSshPort }}
- name: onos-of-{{ $index }}
port: 6653
nodePort: {{ add $index 31653 }}
selector:
app: {{ template "fullname" . }}
statefulset.kubernetes.io/pod-name: onos-onos-classic-{{ $index }}
{{ end }}
{{- end}}
9 changes: 5 additions & 4 deletions onos-classic/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ metadata:
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
{{- with .Values.ports }}
ports:
{{- range . }}
- name: {{ .name }}
port: {{ .port }}
protocol: {{ .protocol | default "TCP" | quote }}
- name: {{ .name }}
port: {{ .port }}
protocol: {{ .protocol | default "TCP" | quote }}
{{- end }}
{{- end }}
# ONOS and Atomix need to be able to talk to each other for ONOS to become ready
publishNotReadyAddresses: true
clusterIP: None
selector:
app: {{ template "fullname" . }}

2 changes: 2 additions & 0 deletions onos-classic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ resources:
cpu: 0.5
memory: 512Mi

individualOpenFlowNodePorts: false

ports:
- name: openflow
port: 6653
Expand Down

0 comments on commit fbaef1e

Please sign in to comment.