Skip to content

Commit

Permalink
drop requests to prometheus ingress if is not using the dns name (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Tadeu Panato Junior authored Aug 26, 2020
1 parent 3dbef0d commit fc12f86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions helm-charts/nginx_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ controller:
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"

internal:
enabled: true
annotations:
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0

enableHttp: true
enableHttps: true
targetPorts:
Expand Down Expand Up @@ -62,7 +62,7 @@ controller:
return 308 https://$host$request_uri;
}
resources:
resources:
limits:
cpu: 1000m
memory: 500Mi
Expand Down
4 changes: 3 additions & 1 deletion internal/provisioner/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,16 @@ func (p *prometheus) NewHelmDeployment() *helmDeployment {
}
prometheusDNS := fmt.Sprintf("%s.prometheus.%s", p.cluster.ID, privateDomainName)

helmValueArguments := fmt.Sprintf("server.ingress.hosts={%[1]s},server.ingress.annotations.nginx\\.ingress\\.kubernetes\\.io/configuration-snippet='if ($host != \"%[1]s\") {return 404;}'", prometheusDNS)

return &helmDeployment{
chartDeploymentName: "prometheus",
chartName: "stable/prometheus",
kops: p.kops,
kopsProvisioner: p.provisioner,
logger: p.logger,
namespace: "prometheus",
setArgument: fmt.Sprintf("server.ingress.hosts={%s}", prometheusDNS),
setArgument: helmValueArguments,
valuesPath: "helm-charts/prometheus_values.yaml",
desiredVersion: p.desiredVersion,
}
Expand Down

0 comments on commit fc12f86

Please sign in to comment.