-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4367 from sadasu/custom-dns
OCPBUGS-29067: GCP Custom-DNS: Update services that run on control plane nodes
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
templates/common/gcp/files/usr-local-bin-update-dns-server.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
mode: 0755 | ||
path: "/usr/local/bin/update-dns-server" | ||
contents: | ||
inline: | | ||
#!/bin/bash | ||
# For GCP, updating the NetworkManager configuration file to | ||
# include the IP address of the local node as the default DNS | ||
# resolver when UserProvisionedDNS is enabled. | ||
# A CoreDNS static pod running on the node is responsible for | ||
# resolving the api, api-int and *.apps URLs. | ||
mkdir -p /etc/NetworkManager/conf.d | ||
cat <<EOF | tee /etc/NetworkManager/conf.d/dns-servers.conf | ||
# Added by OpenShift | ||
[global-dns-domain-*] | ||
servers=$(ip --json route get 8.8.8.8 | jq -r ".[0].prefsrc"),169.254.169.254 | ||
EOF | ||
# network manager may already be running at this point. | ||
# reload to update /etc/resolv.conf with this configuration | ||
nmcli general reload conf | ||
nmcli general reload dns-rc | ||
echo "Done updating dns-server.conf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: gcp-update-dns.service | ||
enabled: {{if and (eq .Infra.Status.PlatformStatus.Type "GCP") (.Infra.Status.PlatformStatus.GCP) (.Infra.Status.PlatformStatus.GCP.CloudLoadBalancerConfig) (eq .Infra.Status.PlatformStatus.GCP.CloudLoadBalancerConfig.DNSType "ClusterHosted") }}true{{else}}false{{end}} | ||
contents: | | ||
[Unit] | ||
Description=Update Default GCP Resolver | ||
# We don't need to do this on the firstboot | ||
After=firstboot-osupdate.target | ||
# Wait for NetworkManager to report it's online | ||
After=NetworkManager-wait-online.service | ||
# Run before kubelet | ||
Before=kubelet-dependencies.target | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/usr/local/bin/update-dns-server | ||
[Install] | ||
RequiredBy=kubelet-dependencies.target |
2 changes: 1 addition & 1 deletion
2
templates/master/00-master/gcp/units/openshift-gcp-routes.service.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters