Skip to content

Commit

Permalink
feat: Configure probes for che-gateway containers
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha committed Apr 16, 2024
1 parent 31e39c8 commit f7630ed
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che.v7.84.0-862.next
name: eclipse-che.v7.85.0-863.next
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1032,7 +1032,7 @@ spec:
minKubeVersion: 1.19.0
provider:
name: Eclipse Foundation
version: 7.84.0-862.next
version: 7.85.0-863.next
webhookdefinitions:
- admissionReviewVersions:
- v1
Expand Down
58 changes: 58 additions & 0 deletions pkg/deploy/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,40 @@ func getContainersSpec(ctx *chetypes.DeployContext) []corev1.Container {
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",
Expand Down Expand Up @@ -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,
},
},
}

Expand Down
36 changes: 36 additions & 0 deletions pkg/deploy/gateway/kube_rbac_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package gateway
import (
"strconv"

"k8s.io/apimachinery/pkg/util/intstr"

chev2 "github.com/eclipse-che/che-operator/api/v2"
"github.com/eclipse-che/che-operator/pkg/common/constants"
defaults "github.com/eclipse-che/che-operator/pkg/common/operator-defaults"
Expand Down Expand Up @@ -83,6 +85,40 @@ func getKubeRbacProxyContainerSpec(instance *chev2.CheCluster) corev1.Container
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,
},
}
}

Expand Down
38 changes: 38 additions & 0 deletions pkg/deploy/gateway/oauth_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"fmt"
"strings"

"k8s.io/apimachinery/pkg/util/intstr"

identityprovider "github.com/eclipse-che/che-operator/pkg/deploy/identity-provider"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -187,6 +189,8 @@ func getOauthProxyContainerSpec(ctx *chetypes.DeployContext) corev1.Container {
ImagePullPolicy: corev1.PullIfNotPresent,
Args: []string{
"--config=/etc/oauth-proxy/oauth-proxy.cfg",
"--ping-path=/ping",
"--exclude-logging-path=/ping",
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down Expand Up @@ -225,6 +229,40 @@ func getOauthProxyContainerSpec(ctx *chetypes.DeployContext) corev1.Container {
Value: configMapRevision,
},
},
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/ping",
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: "/ping",
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: int32(8080),
},
Scheme: corev1.URISchemeHTTP,
},
},
InitialDelaySeconds: 15,
TimeoutSeconds: 5,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 5,
},
}
}

Expand Down

0 comments on commit f7630ed

Please sign in to comment.