summaryrefslogtreecommitdiff
path: root/helmcharts/dp-trace-telemetry/helm/templates/deployment.yaml
blob: 502392aff713f65c86b5cc336d4beb51972c40da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dp-trace-telemetry
  labels:
    app: dp-trace-telemetry
    component: dp-trace-telemetry
  annotations:
    configmap.reloader.stakater.com/reload: dp-trace-telemetry-{{ .Release.Name }}

spec:
  replicas: 1
  selector:
    matchLabels:
      app: dp-trace-telemetry
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: dp-trace-telemetry
        serviceFunction: {{.Release.Name}}
        component: dp-trace-telemetry
      annotations:
        kubectl.kubernetes.io/default-container: dp-trace-telemetry
        prometheus.io/port: "9005"
        prometheus.io/scrape: "true"
    spec:
      serviceAccountName: {{ .Release.Name }}
      shareProcessNamespace: true
      tolerations:
      - key: node-role.kubernetes.io/control-plane
        operator: Exists
        effect: NoSchedule
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
      containers:
      - name: inotify-dynamic-conf
        image: "registry.gdnt-cloud.website/tsg/os/dp-trace-telemetry:{{ .Chart.AppVersion }}"
        imagePullPolicy: Never
        command:
          - "bash"
          - "-ec"
          - |
            /usr/local/bin/j2 -f yaml  /templates/dp_trace_dy.conf.j2 /templates/values.yaml -o /opt/tsg/dp_trace_telemetry/share_conf/dp_trace_dy.conf
            WATCH_DIR="/templates/values.yaml"
            while inotifywait -r -e modify,create "$WATCH_DIR"; do
              echo "send HUB signal to dp_trace"
              /usr/local/bin/j2 -f yaml  /templates/dp_trace_dy.conf.j2 /templates/values.yaml -o /opt/tsg/dp_trace_telemetry/share_conf/dp_trace_dy.conf
              pkill -1 dp-trace-telemetry
              echo "signal send"
            done
        volumeMounts:
        - name: dp-trace-dy
          mountPath: "/templates/values.yaml"
          subPath: "values.yaml"
        - name: share-config
          mountPath: /opt/tsg/dp_trace_telemetry/share_conf/
        lifecycle:
          postStart:
            exec:
              command:
                - "bash"
                - "-ec"
                - |
                  while true; do
                    if [ -f "/opt/tsg/dp_trace_telemetry/share_conf/dp_trace_dy.conf" ]; then
                      echo "File /opt/tsg/dp_trace_telemetry/share_conf/dp_trace_dy.conf exists. Exiting."
                      exit 0
                    fi
                    echo "File /opt/tsg/dp_trace_telemetry/share_conf/dp_trace_dy.conf does not exist. Sleeping for 2 seconds."
                    sleep 2
                  done
      - name: dp-trace-telemetry
        image: "registry.gdnt-cloud.website/tsg/os/dp-trace-telemetry:{{ .Chart.AppVersion }}"
        imagePullPolicy: Never
        workingDir: /opt/tsg/dp_trace_telemetry/
        command: 
          - "bash"
          - "-ec"
          - |
            ln -sf /opt/tsg/dp_trace_telemetry/share_conf/dp_trace_dy.conf /opt/tsg/dp_trace_telemetry/etc/dp_trace_dy.conf
            /usr/local/bin/entrypoint.sh \
            {{- if .Values.datapath_trace.debug.enable_prestart_script }}
            --enable_prestart \
            {{- end }}
            {{- if .Values.datapath_trace.debug.enable_interactive_startup }}
            --enable_interactive_startup \
            {{- end }}
            || echo "Failed to start."
        volumeMounts:
        - name: dp-trace-telemetry-configs-volume
          mountPath: "/templates/values.yaml"
          subPath: "values.yaml"
        - name: dp-telemetry-daemon
          mountPath: /var/lib/dp_telemetry_daemon
        - name: share-config
          mountPath: /opt/tsg/dp_trace_telemetry/share_conf/
        - name: localtime-node
          mountPath: /etc/localtime
          readOnly: true 
        - name: opt-tsg-mrzcpd
          mountPath: /opt/tsg/mrzcpd
          mountPropagation: HostToContainer
          readOnly: false
        - name: var-run-mrzcpd
          mountPath: /var/run/mrzcpd
          readOnly: false
        - name: var-run-dpdk
          mountPath: /var/run/dpdk
          readOnly: false
        - name: profile-mrzcpd
          mountPath: /etc/profile.d/mrzcpd.sh
          readOnly: true
        - name: ldconfig-mrzcpd
          mountPath: /etc/ld.so.conf.d/mrzcpd.conf
          readOnly: true
        {{- if .Values.datapath_trace.debug.enable_mount_host_filesystem }}
        - name: host-root
          mountPath: /host
        {{- end }}
        {{- if .Values.datapath_trace.debug.enable_prestart_script }}
        - name: prestart-dir
          mountPath: /tmp/prestart
        - name: dp-trace-prestart
          mountPath: /opt/tsg/scripts/prestart.sh
        {{- end }}
        env:
        - name: SLED_IP
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP
        - name: DEPLOYMENT_NAME
          value: dp-trace-telemetry
        securityContext:
          privileged: true
        ports:
          - containerPort: 9086
{{- if  .Values.datapath_trace.debug.enable_liveness_probe  }}
        livenessProbe:
          httpGet:
            httpHeaders:
            - name: Custom-Header
              value: Awesome
            path: /probe
            port: 9086
          initialDelaySeconds: 30
          periodSeconds: 3
          successThreshold: 1
          timeoutSeconds: 10
        startupProbe:
          httpGet:
            httpHeaders:
            - name: Custom-Header
              value: Awesome
            path: /probe
            port: 9086
          initialDelaySeconds: 30
          periodSeconds: 3
          successThreshold: 1
          timeoutSeconds: 10
{{- end }}
      initContainers:
      - name: init-packet-io-engine-ready
        image: "registry.gdnt-cloud.website/tsg/os/dp-trace-telemetry:{{ .Chart.AppVersion }}"
        imagePullPolicy: Never
        command:
          - "bash"
          - "-ec"
          - |
            until [ $(curl -s -o /dev/null -w "%{http_code}" http://${NODE_IP}:9086/probe) -eq 200 ]; do echo waiting for packet-io-engine ready; sleep 2; done
        env:
        - name: NODE_IP
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP
      - name: init-default-svc
        image: "registry.gdnt-cloud.website/tsg/os/dp-trace-telemetry:{{ .Chart.AppVersion }}"
        imagePullPolicy: Never
        command:
          - "bash"
          - "-ec"
          - |
            until nslookup kubernetes.default.svc; do echo waiting for kubernetes service; sleep 2; done
      volumes:
      - name: share-config
        emptyDir: {}
      - name: dp-trace-telemetry-configs-volume
        configMap:
          name: dp-trace-telemetry-{{ .Release.Name }}
      - name: prestart-dir
        hostPath: 
          path: /etc/tsg-os/{{ .Release.Name }}/
          type: DirectoryOrCreate
      - name: dp-trace-prestart
        hostPath:
      {{- if .Values.datapath_trace.debug.prestart_script }}
          path: {{ .Values.datapath_trace.debug.prestart_script }}
      {{- else }}
          path: /etc/tsg-os/{{ .Release.Name }}/dp_trace_prestart_script.sh
      {{- end }}
          type: FileOrCreate
      - name: opt-tsg-mrzcpd
        hostPath:
          path: /opt/tsg/mrzcpd
      - name: var-run-mrzcpd
        hostPath:
          path: /var/run/mrzcpd
      - name: var-run-dpdk
        hostPath:
          path: /var/run/dpdk
      - name: profile-mrzcpd
        hostPath:
          path: /etc/profile.d/mrzcpd.sh
          type: File
      - name: ldconfig-mrzcpd
        hostPath:
          path: /etc/ld.so.conf.d/mrzcpd.conf
          type: File
      - name: localtime-node
        hostPath:
          path: /etc/localtime
      - name: dp-telemetry-daemon
        hostPath:
          path: /var/lib/dp_telemetry_daemon
          type: DirectoryOrCreate
      - name: dp-trace-dy
        configMap:
          name: dp-trace-telemetry-reload-{{ .Release.Name }}
      - name: host-root
        hostPath:
          path: /