Skip to content

Commit

Permalink
fix(insights): add port to INSIGHTS_PROXY (#674) (#675)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2fc1e3e)

Co-authored-by: Elliott Baron <[email protected]>
  • Loading branch information
mergify[bot] and ebaron authored Nov 9, 2023
1 parent 4afebeb commit edb1d28
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/controllers/insights/insights.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (r *InsightsReconciler) createOrUpdateProxyService(ctx context.Context, svc
svc.Spec.Ports = []corev1.ServicePort{
{
Name: "proxy",
Port: 8080,
Port: ProxyServicePort,
TargetPort: intstr.FromString("proxy"),
},
{
Expand Down Expand Up @@ -278,7 +278,7 @@ func (r *InsightsReconciler) createOrUpdateProxyPodSpec(deploy *appsv1.Deploymen
container.Ports = []corev1.ContainerPort{
{
Name: "proxy",
ContainerPort: 8080,
ContainerPort: ProxyServicePort,
},
{
Name: "management",
Expand Down
1 change: 1 addition & 0 deletions internal/controllers/insights/insights_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const (
InsightsConfigMapName = "insights-proxy"
ProxyDeploymentName = InsightsConfigMapName
ProxyServiceName = ProxyDeploymentName
ProxyServicePort = 8080
ProxySecretName = "apicastconf"
EnvInsightsBackendDomain = "INSIGHTS_BACKEND_DOMAIN"
EnvInsightsProxyDomain = "INSIGHTS_PROXY_DOMAIN"
Expand Down
3 changes: 2 additions & 1 deletion internal/controllers/insights/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (i *InsightsIntegration) deleteConfigMap(ctx context.Context, namespace str
func (i *InsightsIntegration) getProxyURL(namespace string) *url.URL {
return &url.URL{
Scheme: "http", // TODO add https support (r.IsCertManagerInstalled)
Host: fmt.Sprintf("%s.%s.svc.cluster.local", ProxyServiceName, namespace),
Host: fmt.Sprintf("%s.%s.svc.cluster.local:%d", ProxyServiceName, namespace,
ProxyServicePort),
}
}
2 changes: 1 addition & 1 deletion internal/controllers/insights/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var _ = Describe("InsightsIntegration", func() {
result, err := integration.Setup()
Expect(err).ToNot(HaveOccurred())
Expect(result).ToNot(BeNil())
Expect(result.String()).To(Equal("http://insights-proxy.test.svc.cluster.local"))
Expect(result.String()).To(Equal("http://insights-proxy.test.svc.cluster.local:8080"))
})

It("should create config map", func() {
Expand Down

0 comments on commit edb1d28

Please sign in to comment.