Skip to content

Commit 8b94127

Browse files
authored
Merge pull request #191 from FogDong/fix-startup
fix: fix startup
2 parents 619078f + 3848820 commit 8b94127

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

helm/yatai-image-builder/templates/deployment.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,6 @@ spec:
9898
periodSeconds: 10
9999
successThreshold: 1
100100
timeoutSeconds: 1
101-
102-
startupProbe:
103-
httpGet:
104-
path: /startup
105-
port: 8081
106-
failureThreshold: 3
107-
periodSeconds: 10
108-
timeoutSeconds: 10
109101

110102
resources:
111103
{{- toYaml .Values.resources | nindent 12 }}

main.go

+8-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package main
1919
import (
2020
"context"
2121
"flag"
22-
"net/http"
2322
"os"
2423

2524
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
@@ -110,6 +109,14 @@ func main() {
110109
}
111110
//+kubebuilder:scaffold:builder
112111

112+
if !skipCheck {
113+
if err := verifyConfigurations(context.Background(), mgr.GetClient()); err != nil {
114+
setupLog.Error(err, "failed to verify configurations")
115+
os.Exit(1)
116+
return
117+
}
118+
}
119+
113120
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
114121
setupLog.Error(err, "unable to set up health check")
115122
os.Exit(1)
@@ -118,16 +125,6 @@ func main() {
118125
setupLog.Error(err, "unable to set up ready check")
119126
os.Exit(1)
120127
}
121-
mgr.GetWebhookServer().Register("/startup", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
122-
if !skipCheck {
123-
if err := verifyConfigurations(r.Context(), mgr.GetClient()); err != nil {
124-
setupLog.Error(err, "failed to verify configurations")
125-
w.WriteHeader(http.StatusInternalServerError)
126-
return
127-
}
128-
}
129-
w.WriteHeader(http.StatusOK)
130-
}))
131128

132129
setupLog.Info("starting manager")
133130
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {

0 commit comments

Comments
 (0)