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

fix: hook pod do not reconcile as expected when no web process found #1425

Merged
merged 1 commit into from
Jun 27, 2024
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
1 change: 1 addition & 0 deletions operator/api/v1alpha1/bkapp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const (
ScalingPolicyDefault ScalingPolicy = "default"
)

// ProbeSet defines the probes configuration
type ProbeSet struct {
// liveness is the configuration for liveness probes.
// +optional
Expand Down
1 change: 1 addition & 0 deletions operator/api/v1alpha2/bkapp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ const (
ScalingPolicyDefault ScalingPolicy = "default"
)

// ProbeSet defines the probes configuration
type ProbeSet struct {
// liveness is the configuration for liveness probes.
// +optional
Expand Down
16 changes: 2 additions & 14 deletions operator/pkg/controllers/bkapp/hooks/resources/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,6 @@ func BuildPreReleaseHook(bkapp *paasv1alpha2.BkApp, status *paasv1alpha2.HookSta
return nil
}

proc := bkapp.Spec.GetWebProcess()
if proc == nil {
return nil
}

// Use the web process's image and pull policy to run the hook.
// This behavior might be changed in the future when paasv1alpha1.BkApp is fully removed.
image, pullPolicy, err := paasv1alpha2.NewProcImageGetter(bkapp).Get("web")
if err != nil {
return nil
}

if status == nil {
status = &paasv1alpha2.HookStatus{
Type: paasv1alpha2.HookPreRelease,
Expand Down Expand Up @@ -155,12 +143,12 @@ func BuildPreReleaseHook(bkapp *paasv1alpha2.BkApp, status *paasv1alpha2.HookSta
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Image: image,
Image: bkapp.Spec.Build.Image,
Command: kubeutil.ReplaceCommandEnvVariables(command),
Args: kubeutil.ReplaceCommandEnvVariables(args),
Env: common.GetAppEnvs(bkapp),
Name: "hook",
ImagePullPolicy: pullPolicy,
ImagePullPolicy: bkapp.Spec.Build.ImagePullPolicy,
// pre-hook 使用默认资源配置
Resources: envs.NewProcResourcesGetter(bkapp).Default(),
// TODO: 挂载点
Expand Down