Add operator deployment readiness probe (#1874)
* Add operator deployment readiness probe
This commit is contained in:
		
							parent
							
								
									29cec0ceda
								
							
						
					
					
						commit
						625e804dc4
					
				|  | @ -57,6 +57,14 @@ spec: | ||||||
| {{ toYaml .Values.resources | indent 10 }} | {{ toYaml .Values.resources | indent 10 }} | ||||||
|         securityContext: |         securityContext: | ||||||
| {{ toYaml .Values.securityContext | indent 10 }} | {{ toYaml .Values.securityContext | indent 10 }} | ||||||
|  |         {{- if .Values.readinessProbe }} | ||||||
|  |         readinessProbe: | ||||||
|  |           httpGet: | ||||||
|  |             path: /readyz | ||||||
|  |             port: {{ .Values.configLoggingRestApi.api_port }} | ||||||
|  |           initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} | ||||||
|  |           periodSeconds: {{ .Values.readinessProbe.periodSeconds }} | ||||||
|  |         {{- end }} | ||||||
|       {{- if .Values.imagePullSecrets }} |       {{- if .Values.imagePullSecrets }} | ||||||
|       imagePullSecrets: |       imagePullSecrets: | ||||||
| {{ toYaml .Values.imagePullSecrets | indent 8 }} | {{ toYaml .Values.imagePullSecrets | indent 8 }} | ||||||
|  |  | ||||||
|  | @ -470,6 +470,11 @@ securityContext: | ||||||
|   readOnlyRootFilesystem: true |   readOnlyRootFilesystem: true | ||||||
|   allowPrivilegeEscalation: false |   allowPrivilegeEscalation: false | ||||||
| 
 | 
 | ||||||
|  | # Allow to setup operator Deployment readiness probe | ||||||
|  | readinessProbe: | ||||||
|  |   initialDelaySeconds: 5 | ||||||
|  |   periodSeconds: 10 | ||||||
|  | 
 | ||||||
| # Affinity for pod assignment | # Affinity for pod assignment | ||||||
| # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity | # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity | ||||||
| affinity: {} | affinity: {} | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ import ( | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| 
 |  | ||||||
| 	"github.com/zalando/postgres-operator/pkg/cluster" | 	"github.com/zalando/postgres-operator/pkg/cluster" | ||||||
| 	"github.com/zalando/postgres-operator/pkg/spec" | 	"github.com/zalando/postgres-operator/pkg/spec" | ||||||
| 	"github.com/zalando/postgres-operator/pkg/util" | 	"github.com/zalando/postgres-operator/pkg/util" | ||||||
|  | @ -87,6 +86,7 @@ func New(controller controllerInformer, port int, logger *logrus.Logger) *Server | ||||||
| 	mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace)) | 	mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace)) | ||||||
| 
 | 
 | ||||||
| 	mux.Handle("/status/", http.HandlerFunc(s.controllerStatus)) | 	mux.Handle("/status/", http.HandlerFunc(s.controllerStatus)) | ||||||
|  | 	mux.Handle("/readyz/", http.HandlerFunc(s.controllerReady)) | ||||||
| 	mux.Handle("/config/", http.HandlerFunc(s.operatorConfig)) | 	mux.Handle("/config/", http.HandlerFunc(s.operatorConfig)) | ||||||
| 
 | 
 | ||||||
| 	mux.HandleFunc("/clusters/", s.clusters) | 	mux.HandleFunc("/clusters/", s.clusters) | ||||||
|  | @ -155,6 +155,10 @@ func (s *Server) controllerStatus(w http.ResponseWriter, req *http.Request) { | ||||||
| 	s.respond(s.controller.GetStatus(), nil, w) | 	s.respond(s.controller.GetStatus(), nil, w) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (s *Server) controllerReady(w http.ResponseWriter, req *http.Request) { | ||||||
|  | 	s.respond("OK", nil, w) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (s *Server) operatorConfig(w http.ResponseWriter, req *http.Request) { | func (s *Server) operatorConfig(w http.ResponseWriter, req *http.Request) { | ||||||
| 	s.respond(map[string]interface{}{ | 	s.respond(map[string]interface{}{ | ||||||
| 		"controller": s.controller.GetConfig(), | 		"controller": s.controller.GetConfig(), | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue