Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the probes from legacy endpoints to tcp ports #155

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading