feat: Configure probes for che-gateway containers (#1825)

* feat: Configure probes for che-gateway containers

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
pull/1828/head
Anatolii Bazko 2024-04-17 15:22:41 +02:00 committed by GitHub
parent 5ec5bc0d75
commit 32974f029e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 141 additions and 5 deletions

View File

@ -100,7 +100,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation support: Eclipse Foundation
name: eclipse-che.v7.84.0-862.next name: eclipse-che.v7.85.0-863.next
namespace: placeholder namespace: placeholder
spec: spec:
apiservicedefinitions: {} apiservicedefinitions: {}
@ -1032,7 +1032,7 @@ spec:
minKubeVersion: 1.19.0 minKubeVersion: 1.19.0
provider: provider:
name: Eclipse Foundation name: Eclipse Foundation
version: 7.84.0-862.next version: 7.85.0-863.next
webhookdefinitions: webhookdefinitions:
- admissionReviewVersions: - admissionReviewVersions:
- v1 - v1

View File

@ -491,6 +491,40 @@ func getContainersSpec(ctx *chetypes.DeployContext) []corev1.Container {
corev1.ResourceCPU: resource.MustParse("0.1"), corev1.ResourceCPU: resource.MustParse("0.1"),
}, },
}, },
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/ping",
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: int32(8090),
},
Scheme: corev1.URISchemeHTTP,
},
},
InitialDelaySeconds: 5,
TimeoutSeconds: 5,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 5,
},
LivenessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/ping",
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: int32(8090),
},
Scheme: corev1.URISchemeHTTP,
},
},
InitialDelaySeconds: 15,
TimeoutSeconds: 5,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 5,
},
}, },
{ {
Name: "configbump", Name: "configbump",
@ -531,6 +565,30 @@ func getContainersSpec(ctx *chetypes.DeployContext) []corev1.Container {
}, },
}, },
}, },
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
Exec: &corev1.ExecAction{
Command: []string{"configbump", "--version"},
},
},
InitialDelaySeconds: 5,
TimeoutSeconds: 5,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 5,
},
LivenessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
Exec: &corev1.ExecAction{
Command: []string{"configbump", "--version"},
},
},
InitialDelaySeconds: 15,
TimeoutSeconds: 5,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 5,
},
}, },
} }

View File

@ -15,6 +15,8 @@ package gateway
import ( import (
"strconv" "strconv"
"k8s.io/apimachinery/pkg/util/intstr"
chev2 "github.com/eclipse-che/che-operator/api/v2" chev2 "github.com/eclipse-che/che-operator/api/v2"
"github.com/eclipse-che/che-operator/pkg/common/constants" "github.com/eclipse-che/che-operator/pkg/common/constants"
defaults "github.com/eclipse-che/che-operator/pkg/common/operator-defaults" defaults "github.com/eclipse-che/che-operator/pkg/common/operator-defaults"
@ -83,6 +85,40 @@ func getKubeRbacProxyContainerSpec(instance *chev2.CheCluster) corev1.Container
corev1.ResourceCPU: resource.MustParse("0.1"), corev1.ResourceCPU: resource.MustParse("0.1"),
}, },
}, },
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/ping",
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: int32(8090),
},
Scheme: corev1.URISchemeHTTP,
},
},
InitialDelaySeconds: 5,
TimeoutSeconds: 5,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 5,
},
LivenessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/ping",
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: int32(8090),
},
Scheme: corev1.URISchemeHTTP,
},
},
InitialDelaySeconds: 15,
TimeoutSeconds: 5,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 5,
},
} }
} }

View File

@ -16,6 +16,8 @@ import (
"fmt" "fmt"
"strings" "strings"
"k8s.io/apimachinery/pkg/util/intstr"
identityprovider "github.com/eclipse-che/che-operator/pkg/deploy/identity-provider" identityprovider "github.com/eclipse-che/che-operator/pkg/deploy/identity-provider"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
@ -185,9 +187,15 @@ func getOauthProxyContainerSpec(ctx *chetypes.DeployContext) corev1.Container {
Name: "oauth-proxy", Name: "oauth-proxy",
Image: defaults.GetGatewayAuthenticationSidecarImage(ctx.CheCluster), Image: defaults.GetGatewayAuthenticationSidecarImage(ctx.CheCluster),
ImagePullPolicy: corev1.PullIfNotPresent, ImagePullPolicy: corev1.PullIfNotPresent,
Args: []string{ Args: map[bool][]string{
"--config=/etc/oauth-proxy/oauth-proxy.cfg", true: {
}, "--config=/etc/oauth-proxy/oauth-proxy.cfg",
},
false: {
"--config=/etc/oauth-proxy/oauth-proxy.cfg",
"--ping-path=/ping",
"--exclude-logging-path=/ping"},
}[infrastructure.IsOpenShift()],
VolumeMounts: []corev1.VolumeMount{ VolumeMounts: []corev1.VolumeMount{
{ {
Name: "oauth-proxy-config", Name: "oauth-proxy-config",
@ -225,6 +233,40 @@ func getOauthProxyContainerSpec(ctx *chetypes.DeployContext) corev1.Container {
Value: configMapRevision, Value: configMapRevision,
}, },
}, },
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: map[bool]string{true: "/oauth/healthz", false: "/ping"}[infrastructure.IsOpenShift()],
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: int32(8080),
},
Scheme: corev1.URISchemeHTTP,
},
},
InitialDelaySeconds: 5,
TimeoutSeconds: 5,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 5,
},
LivenessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: map[bool]string{true: "/oauth/healthz", false: "/ping"}[infrastructure.IsOpenShift()],
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: int32(8080),
},
Scheme: corev1.URISchemeHTTP,
},
},
InitialDelaySeconds: 15,
TimeoutSeconds: 5,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 5,
},
} }
} }