Remove temp DNS resolver fix

This PS adopts DNS resolver fix from this osh-infra project:

https: //review.opendev.org/c/openstack/openstack-helm-infra/+/914686
Change-Id: Ie4a27422dbc9c71681c44635547f8b3a89aa6e45
This commit is contained in:
Sergiy Markin 2024-03-29 20:45:52 +00:00
parent 6e89848cc1
commit 65e5a5d3e5

View File

@ -45,26 +45,17 @@ EOF
kubectl apply -f /tmp/${NAMESPACE}-ns.yaml kubectl apply -f /tmp/${NAMESPACE}-ns.yaml
done done
# DNS resolve temp fix
cat << EOF | sudo tee /etc/resolv.conf > /dev/null
nameserver 10.96.0.10
nameserver 8.8.8.8
nameserver 8.8.4.4
search svc.cluster.local cluster.local
options ndots:5 timeout:1 attempts:1
EOF
# CoreDNS version upgrade # CoreDNS version upgrade
kubectl set image deployment coredns -n kube-system "coredns=registry.k8s.io/coredns/coredns:${COREDNS_VERSION}" kubectl set image deployment coredns -n kube-system "coredns=registry.k8s.io/coredns/coredns:${COREDNS_VERSION}"
kubectl rollout restart -n kube-system deployment/coredns kubectl rollout restart -n kube-system deployment/coredns
kubectl rollout status --watch --timeout=300s -n kube-system deployment/coredns kubectl rollout status --watch --timeout=300s -n kube-system deployment/coredns
# Add control-plane.minikube.internal host resord into CodeDNS # Add control-plane.minikube.internal host resord into CodeDNS
PATCH=$(mktemp) PATCH=$(mktemp)
HOSTIP=$(hostname -I| awk '{print $1}') HOSTIP=$(hostname -I| awk '{print $1}')
kubectl get configmap coredns -n kube-system -o json | jq -r "{data: .data}" > "${PATCH}" kubectl get configmap coredns -n kube-system -o json | jq -r "{data: .data}" > "${PATCH}"
sed -i "s;forward . /etc/resolv.conf {\\\n max_concurrent 1000\\\n }\\\n;forward . /etc/resolv.conf {\\\n }\\\n hosts {\\\n $HOSTIP control-plane.minikube.internal\\\n fallthrough\\\n }\\\n;" "${PATCH}" sed -i "s;forward . 8.8.8.8 {\\\n max_concurrent 1000\\\n }\\\n;forward . 8.8.8.8 {\\\n max_concurrent 1000\\\n }\\\nhosts {\\\n $HOSTIP control-plane.minikube.internal\\\n fallthrough\\\n }\\\n;" "${PATCH}"
kubectl patch configmap coredns -n kube-system --patch-file "${PATCH}" kubectl patch configmap coredns -n kube-system --patch-file "${PATCH}"
rm -f "${PATCH}" rm -f "${PATCH}"
kubectl rollout restart -n kube-system deployment/coredns kubectl rollout restart -n kube-system deployment/coredns