Skip to content

Commit

Permalink
fix: adds nginx.org/websocket-services annotation for che ingress (#921)
Browse files Browse the repository at this point in the history
* fix: adds nginx.org/websocket-services annotation for che ingress

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha authored Jul 15, 2021
1 parent e29484f commit fb1f238
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/deploy/ingres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ func TestIngressSpec(t *testing.T) {
{
name: "Test custom host",
ingressName: "test",
ingressComponent: "test-component",
ingressComponent: "che",
ingressHost: "test-host",
ingressPath: "",
serviceName: "che",
serviceName: "che-host",
servicePort: 8080,
ingressCustomSettings: orgv1.IngressCustomSettings{
Labels: "type=default",
Expand All @@ -66,7 +66,7 @@ func TestIngressSpec(t *testing.T) {
Namespace: "eclipse-che",
Labels: map[string]string{
"type": "default",
"app.kubernetes.io/component": "test-component",
"app.kubernetes.io/component": "che",
"app.kubernetes.io/instance": DefaultCheFlavor(cheCluster),
"app.kubernetes.io/managed-by": DefaultCheFlavor(cheCluster) + "-operator",
"app.kubernetes.io/name": DefaultCheFlavor(cheCluster),
Expand All @@ -77,7 +77,8 @@ func TestIngressSpec(t *testing.T) {
"nginx.ingress.kubernetes.io/proxy-connect-timeout": "3600",
"nginx.ingress.kubernetes.io/proxy-read-timeout": "3600",
"nginx.ingress.kubernetes.io/ssl-redirect": "false",
"annotation-key": "annotation-value",
"nginx.org/websocket-services": "che-host",
"annotation-key": "annotation-value",
},
},
TypeMeta: metav1.TypeMeta{
Expand All @@ -93,7 +94,7 @@ func TestIngressSpec(t *testing.T) {
Paths: []v1beta1.HTTPIngressPath{
{
Backend: v1beta1.IngressBackend{
ServiceName: "che",
ServiceName: "che-host",
ServicePort: intstr.FromInt(8080),
},
Path: "/",
Expand Down
5 changes: 5 additions & 0 deletions pkg/deploy/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ func GetIngressSpec(
},
}

if component == cheFlavor {
// adds annotation, see details https://github.com/eclipse/che/issues/19434#issuecomment-810325262
ingress.ObjectMeta.Annotations["nginx.org/websocket-services"] = serviceName
}

if tlsSupport {
ingress.Spec.TLS = []v1beta1.IngressTLS{
{
Expand Down

0 comments on commit fb1f238

Please sign in to comment.