Skip to content

Commit

Permalink
Atlas-12675: Replacing google dns with internal csp
Browse files Browse the repository at this point in the history
  • Loading branch information
shrutipathak2 authored and shruti pathak committed May 18, 2022
1 parent 21379d1 commit ce609d4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ spec:
{{- end }}
- "--metrics-port"
- "{{ .Values.global.prometheus.port }}"
- "--public-server"
- "{{ .Values.host.cpNoa.domain | required "set host.cpNoa.domain" | quote }}"
env:
- name: TLS_CERT_FILE
value: /dapr/cert/tls.crt
Expand Down
3 changes: 3 additions & 0 deletions charts/dapr/charts/dapr_sidecar_injector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ webhookFailurePolicy: Ignore
sidecarImagePullPolicy: Always
runAsNonRoot: true
resources: {}
host:
cpNoa:
domain: ""
8 changes: 7 additions & 1 deletion utils/host.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package utils

import (
"fmt"
"net"
"os"

Expand All @@ -18,9 +19,14 @@ func GetHostAddress() (string, error) {
return val, nil
}

publicLookupAddr, ok := os.LookupEnv("public-server")
if !ok {
publicLookupAddr = "cp.noa.infoblox.com"
}

// Use udp so no handshake is made.
// Any IP can be used, since connection is not established, but we used a known DNS IP.
conn, err := net.Dial("udp", "8.8.8.8:80")
conn, err := net.Dial("udp", fmt.Sprintf("%s:80", publicLookupAddr))
if err != nil {
// Could not find one via a UDP connection, so we fallback to the "old" way: try first non-loopback IPv4:
addrs, err := net.InterfaceAddrs()
Expand Down

0 comments on commit ce609d4

Please sign in to comment.