Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 5f592db

Browse files
simonswineJoshVanL
authored andcommitted
Hookup readiness probe with real liveness status
Signed-off-by: Christian Simon <[email protected]>
1 parent ad3b1b8 commit 5f592db

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cmd/app/run.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"net"
88
"strconv"
9-
"time"
109

1110
"github.com/spf13/cobra"
1211
"k8s.io/apiserver/pkg/server"
@@ -107,17 +106,14 @@ func NewRunCommand(stopCh <-chan struct{}) *cobra.Command {
107106
}
108107

109108
p := proxy.New(restConfig, oidcOptions,
110-
tokenReviewer, secureServingInfo, proxyOptions)
109+
tokenReviewer, secureServingInfo, healthCheck, proxyOptions)
111110

112111
// run proxy
113112
waitCh, err := p.Run(stopCh)
114113
if err != nil {
115114
return err
116115
}
117116

118-
time.Sleep(time.Second * 3)
119-
healthCheck.SetReady()
120-
121117
<-waitCh
122118

123119
return nil

pkg/proxy/proxy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"k8s.io/klog"
2323

2424
"github.com/jetstack/kube-oidc-proxy/cmd/app/options"
25+
"github.com/jetstack/kube-oidc-proxy/pkg/probe"
2526
"github.com/jetstack/kube-oidc-proxy/pkg/proxy/tokenreview"
2627
)
2728

@@ -50,17 +51,19 @@ type Proxy struct {
5051
restConfig *rest.Config
5152
clientTransport http.RoundTripper
5253
noAuthClientTransport http.RoundTripper
54+
healthCheck *probe.HealthCheck
5355

5456
options *Options
5557
}
5658

5759
func New(restConfig *rest.Config, oidcOptions *options.OIDCAuthenticationOptions,
58-
tokenReviewer *tokenreview.TokenReview, ssinfo *server.SecureServingInfo, options *Options) *Proxy {
60+
tokenReviewer *tokenreview.TokenReview, ssinfo *server.SecureServingInfo, healthCheck *probe.HealthCheck, options *Options) *Proxy {
5961
return &Proxy{
6062
restConfig: restConfig,
6163
oidcOptions: oidcOptions,
6264
tokenReviewer: tokenReviewer,
6365
secureServingInfo: ssinfo,
66+
healthCheck: healthCheck,
6467
options: options,
6568
}
6669
}
@@ -143,6 +146,7 @@ func (p *Proxy) Run(stopCh <-chan struct{}) (<-chan struct{}, error) {
143146
continue
144147
}
145148

149+
p.healthCheck.SetReady()
146150
klog.Info("OIDC provider initialized, proxy ready")
147151
klog.V(4).Infof("OIDC provider initialized, readiness check returned error: %+v", err)
148152
return

0 commit comments

Comments
 (0)