Skip to content
Merged
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
36 changes: 31 additions & 5 deletions charts/azdo-proxy/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,43 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "azdo-proxy.fullname" . }}-deny-ingress
name: {{ include "azdo-proxy.fullname" . }}
labels:
{{- include "azdo-proxy.labels" . | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "azdo-proxy.labels" . | nindent 6 }}
policyTypes:
- Ingress
- Egress
ingress:
- from:
- podSelector: {}
- from:
- podSelector:
matchLabels:
app: source-controller
ports:
- port: 8080
Comment on lines +16 to +21
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

- from:
- namespaceSelector:
matchLabels:
name: prometheus
ports:
- port: 9090
egress:
- {}
podSelector: {}
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
- to:
- namespaceSelector: {}
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
{{- end }}
1 change: 1 addition & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func proxyHandler(logger logr.Logger, proxies map[string]*httputil.ReverseProxy,

// Overwrite the authorization header with the PAT token
logger.Info("Authenticated request", "path", r.URL.Path)
r.Host = target.Host
r.Header.Del("Authorization")
patB64 := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("pat:%s", pat)))
r.Header.Add("Authorization", "Basic "+patB64)
Expand Down