Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 1 | --- |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 16 | {{- $onucount := (.Values.numOnus|int)}} |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 17 | {{- range $i, $junk := until (.Values.numOlts|int) }} |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 18 | {{- range $j, $junk1 := until ($onucount) }} |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 19 | --- |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 20 | apiVersion: v1 |
| 21 | kind: Service |
| 22 | metadata: |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 23 | name: onu{{ $i }}-{{ $j }} |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 24 | namespace: {{ $.Values.global.namespace }} |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 25 | labels: |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 26 | name: onu{{ $i }}-{{ $j }} |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 27 | spec: |
| 28 | ports: |
| 29 | - name: grpc |
| 30 | port: 50061 |
| 31 | targetPort: 50061 |
| 32 | selector: |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 33 | app: onu{{ $i }}-{{ $j }} |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 34 | --- |
| 35 | apiVersion: apps/v1beta1 |
| 36 | kind: Deployment |
| 37 | metadata: |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 38 | name: onu{{ $i }}-{{ $j }} |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 39 | namespace: {{ $.Values.global.namespace }} |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 40 | spec: |
| 41 | replicas: 1 |
| 42 | template: |
| 43 | metadata: |
| 44 | labels: |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 45 | app: onu{{ $i }}-{{ $j }} |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 46 | annotations: |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 47 | cni: "calico,pon{{ $i }}.{{ $j }}" |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 48 | spec: |
| 49 | affinity: |
| 50 | podAffinity: |
| 51 | preferredDuringSchedulingIgnoredDuringExecution: |
| 52 | - weight: 100 |
| 53 | podAffinityTerm: |
| 54 | labelSelector: |
| 55 | matchExpressions: |
| 56 | - key: app |
| 57 | operator: In |
| 58 | values: |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 59 | - rg{{ $i }}-{{ $j }} |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 60 | topologyKey: kubernetes.io/hostname |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 61 | containers: |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 62 | - name: onu{{ $i }}-{{ $j }} |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 63 | image: "{{ $.Values.global.registry }}{{ $.Values.images.onu.repository }}:{{ tpl $.Values.images.onu.tag $ }}" |
| 64 | imagePullPolicy: {{ $.Values.images.onu.pullPolicy }} |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 65 | env: |
| 66 | - name: POD_IP |
| 67 | valueFrom: |
| 68 | fieldRef: |
| 69 | fieldPath: status.podIP |
| 70 | - name: NAMESPACE |
| 71 | valueFrom: |
| 72 | fieldRef: |
| 73 | fieldPath: metadata.namespace |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 74 | args: |
| 75 | - "/app/ponsim" |
| 76 | - "-device_type" |
| 77 | - "ONU" |
| 78 | - "-parent_addr" |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 79 | - "olt{{ $i }}" |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 80 | - "-grpc_port" |
| 81 | - "50061" |
| 82 | - "-internal_if" |
| 83 | - "eth0" |
| 84 | - "-external_if" |
| 85 | - "eth1" |
| 86 | - "-promiscuous" |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 87 | {{- if not $.Values.legacyPonsim }} |
| 88 | - "-serial_number" |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 89 | - "PSMO{{ printf "%04d%04d" $i $j }}" |
| 90 | {{- end }} |
Andy Bavier | e21a5f5 | 2019-05-28 15:39:52 -0700 | [diff] [blame] | 91 | {{- end }} |
Andy Bavier | 2259a6b | 2018-07-12 15:27:48 -0700 | [diff] [blame] | 92 | |
| 93 | ports: |
| 94 | - containerPort: 50061 |
| 95 | name: grpc-port |
Sreeju | 7d7fc07 | 2019-06-13 12:03:00 -0600 | [diff] [blame] | 96 | {{- end }} |