kolla-kubernetes/helm/microservice/openvswitch-ovsdb-daemonset/templates/openvswitch-ovsdb-daemonset...

96 lines
3.8 KiB
YAML

{{- $restype := .Values.type }}
{{- $searchPath := printf ":global.kolla.openvswitch.db_%s.daemonset:global.kolla.openvswitch.db_%s.all:global.kolla.openvswitch.db.all:global.kolla.openvswitch.all:global.kolla.all" .Values.type .Values.type }}
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c "contName" "openvswitch-db-server" }}
{{- $_ := set $c "imageName" "image_full" }}
{{- $_ := set $c "tagName" "image_tag" }}
{{- $imageFull := include "kolla_build_image_full" $c }}
{{- $imagePullPolicy := include "kolla_val_get_str" (dict "key" "image_pull_policy" "searchPath" $searchPath "Values" .Values ) }}
{{- $containerConfigDirectory := include "kolla_val_get_str" (dict "key" "container_config_directory" "searchPath" $searchPath "Values" .Values ) }}
{{- $selectorKey := include "kolla_val_get_str" (dict "key" "selector_key" "searchPath" $searchPath "Values" .Values ) }}
{{- $selectorValue := include "kolla_val_get_str" (dict "key" "selector_value" "searchPath" $searchPath "Values" .Values ) }}
{{- $resourceName := printf "openvswitch-db-server-%s" $restype }}
{{- $netHostTrue := true }}
{{- $podTypeBootstrap := false }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "resourceName" $resourceName "Values" .Values "Release" .Release "searchPath" $searchPath }}
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: openvswitch-ovsdb-{{ $restype }}
labels:
component: openvswitch
system: openvswitch-db-{{ $restype }}
spec:
template:
metadata:
labels:
component: openvswitch
system: openvswitch-db-{{ $restype }}
spec:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: True
hostIPC: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-ovs-db
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
mkdir -p /var/log/kolla/openvswitch;
DB=/etc/openvswitch/conf.db;
/usr/bin/ovsdb-tool create $DB;
echo $(date) >> /var/log/kolla/db-create.log;
volumeMounts:
- name: openvswitch-db
mountPath: /etc/openvswitch/
- name: kolla-logs
mountPath: /var/log/kolla/
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}
name: main
securityContext:
privileged: true
env:
- name: KOLLA_CONFIG_STRATEGY
value: COPY_ONCE
volumeMounts:
{{- include "common_volume_mounts" $env | indent 12 }}
- mountPath: /etc/openvswitch
name: openvswitch-db
- mountPath: /var/run/openvswitch
name: openvswitch-run
- mountPath: /dev
name: host-dev
###
### Using command: directly instead of command defined in config.json is
### an exception due to the nature of openvswitch.
###
command: ["sh", "-c"]
args:
- /usr/sbin/ovsdb-server
/etc/openvswitch/conf.db
-vconsole:emer
-vsyslog:err
-vfile:info
--remote=punix:/var/run/openvswitch/db.sock
--remote=ptcp:6640:0.0.0.0
--log-file=/var/log/kolla/openvswitch/ovsdb-server.log
{{- include "common_containers" . | indent 8 }}
volumes:
{{- include "common_volumes" . | indent 8 }}
- name: openvswitch-db
emptyDir: {}
- name: openvswitch-run
hostPath:
path: /var/run/openvswitch
- name: host-dev
hostPath:
path: /dev
{{- end }}