Skip to content

Commit

Permalink
Change the probes from legacy endpoints to tcp ports (#155)
Browse files Browse the repository at this point in the history
#154

Signed-off-by: asararatnakar <[email protected]>
  • Loading branch information
asararatnakar authored Nov 29, 2023
1 parent bda3480 commit 9648d73
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/offering/base/orderer/override/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
logf "sigs.k8s.io/controller-runtime/pkg/log"
)

Expand Down Expand Up @@ -107,10 +108,30 @@ func (o *Override) CreateDeployment(instance *current.IBPOrderer, k8sDep *appsv1
if err != nil {
return errors.New("orderer container not found in deployment spec")
}

grpcWeb, err := deployment.GetContainer(PROXY)
if err != nil {
return errors.New("proxy container not found in deployment spec")
}

// Change the legacy LivenessProbe from /settings endpoint to tcp port 8080
if grpcWeb.LivenessProbe.Handler.TCPSocket == nil {
grpcWeb.LivenessProbe.Handler = corev1.Handler{
TCPSocket: &corev1.TCPSocketAction{
Port: intstr.FromInt(8080),
},
}
}

// Change the legacy ReadinessProbe from /settings endpoint to tcp port 8080
if grpcWeb.ReadinessProbe.Handler.TCPSocket == nil {
grpcWeb.ReadinessProbe.Handler = corev1.Handler{
TCPSocket: &corev1.TCPSocketAction{
Port: intstr.FromInt(8080),
},
}
}

_, err = deployment.GetContainer(INIT)
if err != nil {
return errors.New("init container not found in deployment spec")
Expand Down
19 changes: 19 additions & 0 deletions pkg/offering/base/peer/override/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
)

// Container names
Expand Down Expand Up @@ -190,6 +191,24 @@ func (o *Override) CreateDeployment(instance *current.IBPPeer, k8sDep *appsv1.De
grpcwebContainer.AppendEnvIfMissingOverrideIfPresent("SERVER_TLS_CLIENT_CA_FILES", certsData)
peerContainer.AppendEnvIfMissingOverrideIfPresent("CORE_PEER_TLS_ROOTCERT_FILE", certsData)

// Change the legacy LivenessProbe from /settings endpoint to tcp port 8080
if grpcwebContainer.LivenessProbe.Handler.TCPSocket == nil {
grpcwebContainer.LivenessProbe.Handler = corev1.Handler{
TCPSocket: &corev1.TCPSocketAction{
Port: intstr.FromInt(8080),
},
}
}

// Change the legacy ReadinessProbe from /settings endpoint to tcp port 8080
if grpcwebContainer.ReadinessProbe.Handler.TCPSocket == nil {
grpcwebContainer.ReadinessProbe.Handler = corev1.Handler{
TCPSocket: &corev1.TCPSocketAction{
Port: intstr.FromInt(8080),
},
}
}

// Check if intermediate tlscerts exists
if util.IntermediateSecretExists(o.Client, instance.Namespace, tlsintercertSecret) {
secretName := fmt.Sprintf("tls-%s-intercerts", instance.Name)
Expand Down

0 comments on commit 9648d73

Please sign in to comment.