Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atlas-12675: Replacing google dns with internal csp #11

Open
wants to merge 1 commit into
base: v1.0.0-ib
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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