mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-15 06:43:54 +00:00
create fn for dns manifests
This commit is contained in:
parent
b7d9fac5fd
commit
134487191d
@ -95,6 +95,12 @@ spec:
|
|||||||
- name: coredns
|
- name: coredns
|
||||||
image: coredns/coredns:0.9.10
|
image: coredns/coredns:0.9.10
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 170Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 70Mi
|
||||||
args: [ "-conf", "/etc/coredns/Corefile" ]
|
args: [ "-conf", "/etc/coredns/Corefile" ]
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
|
@ -95,6 +95,12 @@ spec:
|
|||||||
- name: coredns
|
- name: coredns
|
||||||
image: coredns/coredns:0.9.10
|
image: coredns/coredns:0.9.10
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 170Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 70Mi
|
||||||
args: [ "-conf", "/etc/coredns/Corefile" ]
|
args: [ "-conf", "/etc/coredns/Corefile" ]
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
|
@ -95,6 +95,12 @@ spec:
|
|||||||
- name: coredns
|
- name: coredns
|
||||||
image: coredns/coredns:0.9.10
|
image: coredns/coredns:0.9.10
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 170Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 70Mi
|
||||||
args: [ "-conf", "/etc/coredns/Corefile" ]
|
args: [ "-conf", "/etc/coredns/Corefile" ]
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
|
@ -1228,6 +1228,36 @@ function update-prometheus-to-sd-parameters {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Prepares the manifests of coreDNS for k8s addons.
|
||||||
|
function setup-coredns-manifest {
|
||||||
|
local -r coredns_file="${dst_dir}/dns/coredns.yaml"
|
||||||
|
mv "${dst_dir}/dns/coredns.yaml.in" "${coredns_file}"
|
||||||
|
# Replace the salt configurations with variable values.
|
||||||
|
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${coredns_file}"
|
||||||
|
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${coredns_file}"
|
||||||
|
sed -i -e "s@{{ *pillar\['service_cluster_ip_range'\] *}}@${SERVICE_CLUSTER_IP_RANGE}@g" "${coredns_file}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prepares the manifests of kube-dns for k8s addons.
|
||||||
|
function setup-kube-dns-manifest {
|
||||||
|
local -r kubedns_file="${dst_dir}/dns/kube-dns.yaml"
|
||||||
|
mv "${dst_dir}/dns/kube-dns.yaml.in" "${kubedns_file}"
|
||||||
|
if [ -n "${CUSTOM_KUBE_DNS_YAML:-}" ]; then
|
||||||
|
# Replace with custom GKE kube-dns deployment.
|
||||||
|
cat > "${kubedns_file}" <<EOF
|
||||||
|
$(echo "$CUSTOM_KUBE_DNS_YAML")
|
||||||
|
EOF
|
||||||
|
update-prometheus-to-sd-parameters ${kubedns_file}
|
||||||
|
fi
|
||||||
|
# Replace the salt configurations with variable values.
|
||||||
|
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${kubedns_file}"
|
||||||
|
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${kubedns_file}"
|
||||||
|
|
||||||
|
if [[ "${ENABLE_DNS_HORIZONTAL_AUTOSCALER:-}" == "true" ]]; then
|
||||||
|
setup-addon-manifests "addons" "dns-horizontal-autoscaler"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Prepares the manifests of k8s addons, and starts the addon manager.
|
# Prepares the manifests of k8s addons, and starts the addon manager.
|
||||||
# Vars assumed:
|
# Vars assumed:
|
||||||
# CLUSTER_NAME
|
# CLUSTER_NAME
|
||||||
@ -1293,32 +1323,11 @@ EOF
|
|||||||
setup-addon-manifests "addons" "metrics-server"
|
setup-addon-manifests "addons" "metrics-server"
|
||||||
fi
|
fi
|
||||||
if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then
|
if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then
|
||||||
|
setup-addon-manifests "addons" "dns"
|
||||||
if [[ "${CLUSTER_DNS_CORE_DNS:-}" == "true" ]]; then
|
if [[ "${CLUSTER_DNS_CORE_DNS:-}" == "true" ]]; then
|
||||||
setup-addon-manifests "addons" "dns"
|
setup-coredns-manifest
|
||||||
local -r coredns_file="${dst_dir}/dns/coredns.yaml"
|
|
||||||
mv "${dst_dir}/dns/coredns.yaml.in" "${coredns_file}"
|
|
||||||
# Replace the salt configurations with variable values.
|
|
||||||
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${coredns_file}"
|
|
||||||
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${coredns_file}"
|
|
||||||
sed -i -e "s@{{ *pillar\['service_cluster_ip_range'\] *}}@${SERVICE_CLUSTER_IP_RANGE}@g" "${coredns_file}"
|
|
||||||
else
|
else
|
||||||
setup-addon-manifests "addons" "dns"
|
setup-kube-dns-manifest
|
||||||
local -r kubedns_file="${dst_dir}/dns/kube-dns.yaml"
|
|
||||||
mv "${dst_dir}/dns/kube-dns.yaml.in" "${kubedns_file}"
|
|
||||||
if [ -n "${CUSTOM_KUBE_DNS_YAML:-}" ]; then
|
|
||||||
# Replace with custom GKE kube-dns deployment.
|
|
||||||
cat > "${kubedns_file}" <<EOF
|
|
||||||
$(echo "$CUSTOM_KUBE_DNS_YAML")
|
|
||||||
EOF
|
|
||||||
update-prometheus-to-sd-parameters ${kubedns_file}
|
|
||||||
fi
|
|
||||||
# Replace the salt configurations with variable values.
|
|
||||||
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${kubedns_file}"
|
|
||||||
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${kubedns_file}"
|
|
||||||
|
|
||||||
if [[ "${ENABLE_DNS_HORIZONTAL_AUTOSCALER:-}" == "true" ]]; then
|
|
||||||
setup-addon-manifests "addons" "dns-horizontal-autoscaler"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ "${ENABLE_CLUSTER_REGISTRY:-}" == "true" ]]; then
|
if [[ "${ENABLE_CLUSTER_REGISTRY:-}" == "true" ]]; then
|
||||||
|
@ -1762,6 +1762,36 @@ function update-prometheus-to-sd-parameters {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Sets up the manifests of coreDNS for k8s addons.
|
||||||
|
function setup-coredns-manifest {
|
||||||
|
local -r coredns_file="${dst_dir}/dns/coredns.yaml"
|
||||||
|
mv "${dst_dir}/dns/coredns.yaml.in" "${coredns_file}"
|
||||||
|
# Replace the salt configurations with variable values.
|
||||||
|
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${coredns_file}"
|
||||||
|
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${coredns_file}"
|
||||||
|
sed -i -e "s@{{ *pillar\['service_cluster_ip_range'\] *}}@${SERVICE_CLUSTER_IP_RANGE}@g" "${coredns_file}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Sets up the manifests of kube-dns for k8s addons.
|
||||||
|
function setup-kube-dns-manifest {
|
||||||
|
local -r kubedns_file="${dst_dir}/dns/kube-dns.yaml"
|
||||||
|
mv "${dst_dir}/dns/kube-dns.yaml.in" "${kubedns_file}"
|
||||||
|
if [ -n "${CUSTOM_KUBE_DNS_YAML:-}" ]; then
|
||||||
|
# Replace with custom GKE kube-dns deployment.
|
||||||
|
cat > "${kubedns_file}" <<EOF
|
||||||
|
$(echo "$CUSTOM_KUBE_DNS_YAML")
|
||||||
|
EOF
|
||||||
|
update-prometheus-to-sd-parameters ${kubedns_file}
|
||||||
|
fi
|
||||||
|
# Replace the salt configurations with variable values.
|
||||||
|
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${kubedns_file}"
|
||||||
|
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${kubedns_file}"
|
||||||
|
|
||||||
|
if [[ "${ENABLE_DNS_HORIZONTAL_AUTOSCALER:-}" == "true" ]]; then
|
||||||
|
setup-addon-manifests "addons" "dns-horizontal-autoscaler"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Prepares the manifests of k8s addons, and starts the addon manager.
|
# Prepares the manifests of k8s addons, and starts the addon manager.
|
||||||
# Vars assumed:
|
# Vars assumed:
|
||||||
# CLUSTER_NAME
|
# CLUSTER_NAME
|
||||||
@ -1837,32 +1867,11 @@ EOF
|
|||||||
setup-addon-manifests "addons" "metrics-server"
|
setup-addon-manifests "addons" "metrics-server"
|
||||||
fi
|
fi
|
||||||
if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then
|
if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then
|
||||||
|
setup-addon-manifests "addons" "dns"
|
||||||
if [[ "${CLUSTER_DNS_CORE_DNS:-}" == "true" ]]; then
|
if [[ "${CLUSTER_DNS_CORE_DNS:-}" == "true" ]]; then
|
||||||
setup-addon-manifests "addons" "dns"
|
setup-coredns-manifest
|
||||||
local -r coredns_file="${dst_dir}/dns/coredns.yaml"
|
|
||||||
mv "${dst_dir}/dns/coredns.yaml.in" "${coredns_file}"
|
|
||||||
# Replace the salt configurations with variable values.
|
|
||||||
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${coredns_file}"
|
|
||||||
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${coredns_file}"
|
|
||||||
sed -i -e "s@{{ *pillar\['service_cluster_ip_range'\] *}}@${SERVICE_CLUSTER_IP_RANGE}@g" "${coredns_file}"
|
|
||||||
else
|
else
|
||||||
setup-addon-manifests "addons" "dns"
|
setup-kube-dns-manifest
|
||||||
local -r kubedns_file="${dst_dir}/dns/kube-dns.yaml"
|
|
||||||
mv "${dst_dir}/dns/kube-dns.yaml.in" "${kubedns_file}"
|
|
||||||
if [ -n "${CUSTOM_KUBE_DNS_YAML:-}" ]; then
|
|
||||||
# Replace with custom GKE kube-dns deployment.
|
|
||||||
cat > "${kubedns_file}" <<EOF
|
|
||||||
$(echo "$CUSTOM_KUBE_DNS_YAML")
|
|
||||||
EOF
|
|
||||||
update-prometheus-to-sd-parameters ${kubedns_file}
|
|
||||||
fi
|
|
||||||
# Replace the salt configurations with variable values.
|
|
||||||
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${kubedns_file}"
|
|
||||||
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${kubedns_file}"
|
|
||||||
|
|
||||||
if [[ "${ENABLE_DNS_HORIZONTAL_AUTOSCALER:-}" == "true" ]]; then
|
|
||||||
setup-addon-manifests "addons" "dns-horizontal-autoscaler"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ "${ENABLE_CLUSTER_REGISTRY:-}" == "true" ]]; then
|
if [[ "${ENABLE_CLUSTER_REGISTRY:-}" == "true" ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user