Skip to content

Commit

Permalink
fix: hook pod do not reconcile as expected when no web process found (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgetx authored Jun 27, 2024
1 parent ada6bd1 commit a7db4ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
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

0 comments on commit a7db4ed

Please sign in to comment.