Skip to content

Commit 14f7929

Browse files
authored
Merge pull request #13 from cert-manager/healthz-to-readyz
Change healthz to readyz for readiness probe
2 parents 09b0e84 + 08ade43 commit 14f7929

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

cmd/app/app.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ func NewCommand(ctx context.Context) *cobra.Command {
3131
return err
3232
}
3333

34-
healthz := healthz.New(opts.Logr, opts.HealthzPort, opts.HealthzPath)
35-
if err := healthz.Start(ctx); err != nil {
34+
readyz := healthz.New(opts.Logr, opts.ReadyzPort, opts.ReadyzPath)
35+
if err := readyz.Start(ctx); err != nil {
3636
return err
3737
}
3838

3939
// Create a new TLS provider for the serving certificate and private key.
4040
tlsProvider, err := agenttls.NewProvider(ctx, opts.Logr, opts.TLSOptions,
41-
opts.KubeOptions, opts.CertManagerOptions, healthz.Register())
41+
opts.KubeOptions, opts.CertManagerOptions, readyz.Register())
4242
if err != nil {
4343
return err
4444
}
@@ -52,7 +52,7 @@ func NewCommand(ctx context.Context) *cobra.Command {
5252
// Create an new server instance that implements the certificate signing API
5353
server := server.New(opts.Logr,
5454
opts.CertManagerOptions, opts.KubeOptions,
55-
healthz.Register())
55+
readyz.Register())
5656

5757
// Build the data which should be present in the well-known configmap in
5858
// all namespaces.

cmd/app/options/options.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ type AppOptions struct {
3434
logLevel string
3535
Logr *logrus.Entry
3636

37-
HealthzPort int
38-
HealthzPath string
37+
ReadyzPort int
38+
ReadyzPath string
3939
}
4040

4141
type CertManagerOptions struct {
@@ -151,12 +151,12 @@ func (a *AppOptions) addFlags(fs *pflag.FlagSet) {
151151
"log-level", "v", "info",
152152
"Log level (debug, info, warn, error, fatal, panic).")
153153

154-
fs.IntVar(&a.HealthzPort,
155-
"healthz-port", 8080,
154+
fs.IntVar(&a.ReadyzPort,
155+
"readiness-probe-port", 8080,
156156
"Port to expose the readiness probe.")
157157

158-
fs.StringVar(&a.HealthzPath,
159-
"healthz-path", "/healthz",
158+
fs.StringVar(&a.ReadyzPath,
159+
"readiness-probe-path", "/readyz",
160160
"HTTP path to expose the readiness probe server.")
161161
}
162162

deploy/charts/istio-csr/templates/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ spec:
3030
command: ["cert-manager-istio-agent"]
3131
args:
3232
- "--log-level={{.Values.agent.logLevel}}"
33-
- "--healthz-port={{.Values.agent.readinessProbe.port}}"
34-
- "--healthz-path={{.Values.agent.readinessProbe.path}}"
33+
- "--readiness-probe-port={{.Values.agent.readinessProbe.port}}"
34+
- "--readiness-probe-path={{.Values.agent.readinessProbe.path}}"
3535

3636
- "--serving-address={{.Values.agent.servingAddress}}:{{.Values.agent.servingPort}}"
3737
- "--serving-certificate-duration={{.Values.agent.certificateDuration}}"

deploy/charts/istio-csr/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ agent:
1717
logLevel: info # debug, info, warn, error, fatal, panic
1818
readinessProbe:
1919
port: 8080
20-
path: "/healthz"
20+
path: "/readyz"
2121

2222
servingAddress: 0.0.0.0
2323
servingPort: 6443

pkg/server/server.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ type Server struct {
4040
issuerRef cmmeta.ObjectReference
4141
preserveCRs bool
4242

43-
healthz *healthz.Check
43+
readyz *healthz.Check
4444
}
4545

4646
func New(log *logrus.Entry,
4747
cmOptions *options.CertManagerOptions,
4848
kubeOptions *options.KubeOptions,
49-
healthz *healthz.Check,
49+
readyz *healthz.Check,
5050
) *Server {
5151
return &Server{
5252
log: log.WithField("module", "certificate_provider"),
@@ -55,7 +55,7 @@ func New(log *logrus.Entry,
5555
maxDuration: cmOptions.MaximumClientCertificateDuration,
5656
issuerRef: cmOptions.IssuerRef,
5757
preserveCRs: cmOptions.PreserveCRs,
58-
healthz: healthz,
58+
readyz: readyz,
5959
}
6060
}
6161

@@ -77,14 +77,14 @@ func (s *Server) Run(ctx context.Context, tlsConfig *tls.Config, listenAddress s
7777
// handle termination gracefully
7878
go func() {
7979
<-ctx.Done()
80-
s.healthz.Set(false)
80+
s.readyz.Set(false)
8181
s.log.Info("shutting down grpc server")
8282
grpcServer.GracefulStop()
8383
s.log.Info("grpc server stopped")
8484
}()
8585

8686
s.log.Infof("grpc serving on %s", listener.Addr())
87-
s.healthz.Set(true)
87+
s.readyz.Set(true)
8888

8989
return grpcServer.Serve(listener)
9090
}

pkg/tls/tls.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ type Provider struct {
4141
issuerRef cmmeta.ObjectReference
4242

4343
mu sync.RWMutex
44-
healthz *healthz.Check
44+
readyz *healthz.Check
4545
tlsConfig *tls.Config
4646
}
4747

4848
// NewProvider will return a new provider where a TLS config is ready to be fetched.
4949
func NewProvider(ctx context.Context, log *logrus.Entry, tlsOptions *options.TLSOptions,
5050
kubeOptions *options.KubeOptions, cmOptions *options.CertManagerOptions,
51-
healthz *healthz.Check) (*Provider, error) {
51+
readyz *healthz.Check) (*Provider, error) {
5252

5353
p := &Provider{
5454
log: log.WithField("module", "serving_certificate"),
@@ -57,7 +57,7 @@ func NewProvider(ctx context.Context, log *logrus.Entry, tlsOptions *options.TLS
5757
customRootCA: len(tlsOptions.RootCACertFile) > 0,
5858
client: kubeOptions.CMClient,
5959
issuerRef: cmOptions.IssuerRef,
60-
healthz: healthz,
60+
readyz: readyz,
6161
}
6262

6363
if len(tlsOptions.RootCACertFile) > 0 {
@@ -86,7 +86,7 @@ func NewProvider(ctx context.Context, log *logrus.Entry, tlsOptions *options.TLS
8686

8787
select {
8888
case <-ctx.Done():
89-
p.healthz.Set(false)
89+
p.readyz.Set(false)
9090
p.log.Infof("closing renewal: %s", ctx.Err())
9191
timer.Stop()
9292
return
@@ -101,7 +101,7 @@ func NewProvider(ctx context.Context, log *logrus.Entry, tlsOptions *options.TLS
101101
}
102102
}()
103103

104-
p.healthz.Set(true)
104+
p.readyz.Set(true)
105105

106106
return p, nil
107107
}

0 commit comments

Comments
 (0)