Skip to content

Commit 3ee2d9a

Browse files
authored
Patches for 0.5.1 release (#352)
* handled potential nil dereference (#349) * Automated cherry pick of #347: Removed update operation from pod webhook (#348) * removed update operation from webhook * added to helm chart * removed restarting group log (#350)
1 parent 2f73269 commit 3ee2d9a

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

charts/lws/templates/webhook/webhook.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ webhooks:
4343
- v1
4444
operations:
4545
- CREATE
46-
- UPDATE
4746
resources:
4847
- pods
4948
sideEffects: None

config/webhook/manifests.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ webhooks:
4040
- v1
4141
operations:
4242
- CREATE
43-
- UPDATE
4443
resources:
4544
- pods
4645
sideEffects: None

pkg/controllers/pod_controller.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"errors"
2222
"fmt"
2323
"strconv"
24+
"time"
2425

2526
appsv1 "k8s.io/api/apps/v1"
2627
corev1 "k8s.io/api/core/v1"
@@ -89,7 +90,6 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
8990
return ctrl.Result{}, err
9091
}
9192
if leaderDeleted {
92-
log.V(2).Info("restarting the group")
9393
return ctrl.Result{}, nil
9494
}
9595

@@ -127,6 +127,10 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
127127
log.Error(err, "Getting lws revisions")
128128
return ctrl.Result{}, err
129129
}
130+
if revision == nil {
131+
log.V(2).Info("Revision has not been created yet, requeing reconciler for pod %s", pod.Name)
132+
return ctrl.Result{Requeue: true, RequeueAfter: time.Second}, nil
133+
}
130134
statefulSet, err := constructWorkerStatefulSetApplyConfiguration(pod, leaderWorkerSet, revision)
131135
if err != nil {
132136
return ctrl.Result{}, err

pkg/webhooks/pod_webhook.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (p *PodWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (ad
7777
return nil, nil
7878
}
7979

80-
//+kubebuilder:webhook:path=/mutate--v1-pod,mutating=true,failurePolicy=fail,groups="",resources=pods,verbs=create;update,versions=v1,name=mpod.kb.io,sideEffects=None,admissionReviewVersions=v1
80+
//+kubebuilder:webhook:path=/mutate--v1-pod,mutating=true,failurePolicy=fail,groups="",resources=pods,verbs=create,versions=v1,name=mpod.kb.io,sideEffects=None,admissionReviewVersions=v1
8181

8282
func (p *PodWebhook) Default(ctx context.Context, obj runtime.Object) error {
8383
log := logf.FromContext(ctx)

0 commit comments

Comments
 (0)