DNS: add helper chart to OSH for setting up hosts resolv.conf
This PS adds a chart to setup the resolv.conf on hosts running openstack-helm. The purpose of this is to reduce friction when performing basic deployments of OS-H. Change-Id: I6c6348afb01869cff9a90328ede795d92a91fb12
This commit is contained in:
parent
dcf919ddf7
commit
66686005e5
23
dns-helper/Chart.yaml
Normal file
23
dns-helper/Chart.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Copyright 2017 The Openstack-Helm Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
description: OpenStack-Helm DNS Helper
|
||||||
|
name: dns-helper
|
||||||
|
version: 0.1.0
|
||||||
|
home: http://openstack-helm.readthedocs.io
|
||||||
|
sources:
|
||||||
|
- https://git.openstack.org/cgit/openstack/openstack-helm
|
||||||
|
maintainers:
|
||||||
|
- name: OpenStack-Helm Authors
|
18
dns-helper/requirements.yaml
Normal file
18
dns-helper/requirements.yaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright 2017 The Openstack-Helm Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
- name: helm-toolkit
|
||||||
|
repository: http://localhost:8879/charts
|
||||||
|
version: 0.1.0
|
20
dns-helper/templates/bin/_dns-helper.sh.tpl
Normal file
20
dns-helper/templates/bin/_dns-helper.sh.tpl
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2017 The Openstack-Helm Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cat /etc/resolv.conf > /host/etc/resolv.conf
|
||||||
|
tail -f /dev/null
|
23
dns-helper/templates/configmap-bin.yaml
Normal file
23
dns-helper/templates/configmap-bin.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Copyright 2017 The Openstack-Helm Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
{{- $envAll := . }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: dns-helper-bin
|
||||||
|
data:
|
||||||
|
dns-helper.sh: |
|
||||||
|
{{ tuple "bin/_dns-helper.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
@ -12,30 +12,38 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
{{- $envAll := . }}
|
||||||
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: extensions/v1beta1
|
||||||
kind: DaemonSet
|
kind: DaemonSet
|
||||||
metadata:
|
metadata:
|
||||||
name: resolv-conf-util
|
name: dns-helper
|
||||||
spec:
|
spec:
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
version: v0.1.0
|
{{ tuple $envAll "dns" "helper" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
name: resolv-conf-util
|
|
||||||
spec:
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
|
||||||
containers:
|
containers:
|
||||||
- name: resolv-conf-util
|
- name: dns-helper
|
||||||
image: docker.io/ubuntu:16.04
|
image: {{ .Values.images.dns_helper }}
|
||||||
|
imagePullPolicy: {{ .Values.images.pull_policy }}
|
||||||
command:
|
command:
|
||||||
- /bin/bash
|
- /tmp/dns-helper.sh
|
||||||
- -ecx
|
|
||||||
- |
|
|
||||||
cat /etc/resolv.conf > /host/etc/resolv.conf
|
|
||||||
tail -f /dev/null
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /host/etc/resolv.conf
|
- mountPath: /host/etc/resolv.conf
|
||||||
name: host-resolv-conf
|
name: host-resolv-conf
|
||||||
|
- name: dns-helper-bin
|
||||||
|
mountPath: /tmp/dns-helper.sh
|
||||||
|
subPath: dns-helper.sh
|
||||||
|
readOnly: true
|
||||||
volumes:
|
volumes:
|
||||||
- name: host-resolv-conf
|
- name: host-resolv-conf
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /etc/resolv.conf
|
path: /etc/resolv.conf
|
||||||
|
- name: dns-helper-bin
|
||||||
|
configMap:
|
||||||
|
name: dns-helper-bin
|
||||||
|
defaultMode: 0555
|
26
dns-helper/values.yaml
Normal file
26
dns-helper/values.yaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright 2017 The Openstack-Helm Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# Default values for cinder.
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
# Declare name/value pairs to be passed into your templates.
|
||||||
|
# name: value
|
||||||
|
|
||||||
|
labels:
|
||||||
|
node_selector_key: openstack-control-plane
|
||||||
|
node_selector_value: enabled
|
||||||
|
|
||||||
|
images:
|
||||||
|
dns_helper: docker.io/ubuntu:16.04
|
||||||
|
pull_policy: "IfNotPresent"
|
@ -29,6 +29,9 @@ if [ "x$HOST_OS" == "xfedora" ]; then
|
|||||||
sudo modprobe ip6_tables
|
sudo modprobe ip6_tables
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
helm install --namespace=openstack ${WORK_DIR}/dns-helper --name=dns-helper
|
||||||
|
kube_wait_for_pods openstack 180
|
||||||
|
|
||||||
if [ "x$PVC_BACKEND" == "xceph" ]; then
|
if [ "x$PVC_BACKEND" == "xceph" ]; then
|
||||||
kubectl label nodes ceph-storage=enabled --all
|
kubectl label nodes ceph-storage=enabled --all
|
||||||
CONTROLLER_MANAGER_POD=$(kubectl get -n kube-system pods -l component=kube-controller-manager --no-headers -o name | head -1 | awk -F '/' '{ print $NF }')
|
CONTROLLER_MANAGER_POD=$(kubectl get -n kube-system pods -l component=kube-controller-manager --no-headers -o name | head -1 | awk -F '/' '{ print $NF }')
|
||||||
|
@ -15,17 +15,12 @@ set -e
|
|||||||
|
|
||||||
function net_resolv_pre_kube {
|
function net_resolv_pre_kube {
|
||||||
sudo cp -f /etc/resolv.conf /etc/resolv-pre-kube.conf
|
sudo cp -f /etc/resolv.conf /etc/resolv-pre-kube.conf
|
||||||
|
sudo rm -f /etc/resolv.conf
|
||||||
cat << EOF | sudo tee /etc/resolv.conf
|
cat << EOF | sudo tee /etc/resolv.conf
|
||||||
nameserver 8.8.8.8
|
nameserver 8.8.8.8
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
function net_resolv_kube {
|
|
||||||
kubectl get namespace openstack || kubectl create namespace openstack
|
|
||||||
kubectl create --namespace openstack -f ${WORK_DIR}/tools/gate/manifests/resolv-conf-util.yaml
|
|
||||||
kube_wait_for_pods openstack 240
|
|
||||||
}
|
|
||||||
|
|
||||||
function net_resolv_post_kube {
|
function net_resolv_post_kube {
|
||||||
sudo cp -f /etc/resolv-pre-kube.conf /etc/resolv.conf
|
sudo cp -f /etc/resolv-pre-kube.conf /etc/resolv.conf
|
||||||
}
|
}
|
||||||
@ -42,4 +37,3 @@ function net_hosts_pre_kube {
|
|||||||
function net_hosts_post_kube {
|
function net_hosts_post_kube {
|
||||||
sudo cp -f /etc/hosts-pre-kube /etc/hosts
|
sudo cp -f /etc/hosts-pre-kube /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,4 +25,3 @@ if [ "x$PVC_BACKEND" == "xceph" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
kubeadm_aio_launch
|
kubeadm_aio_launch
|
||||||
net_resolv_kube
|
|
||||||
|
Loading…
Reference in New Issue
Block a user