When mwan3Conf changes, the mwan3Conf controller update the sdewan
instance status to trigger the sdewan reconcile. Before this patch, we
update only the status field `IsApplied=false`. It could happen that the
field `IsApplied` was already false, if this is the case sdewan
reconcile will not be triggered. Because the sdewan CR is not changed.
This patch is to add another field in sdewan status, to make sure sdewan
reconcile is triggered once the mwan3Conf changes.
Signed-off-by: chengli3 <cheng1.li@intel.com>
Change-Id: I8f01733c373326b9167342118fd166834a7a8c45
// Important: Run "make" to regenerate code after modifying this file
// +optional
Mwan3Status Mwan3Status `json:"mwan3Status"`
+ Msg string `json:"msg"`
}
// +kubebuilder:object:root=true
status:
description: SdewanStatus defines the observed state of Sdewan
properties:
+ msg:
+ type: string
mwan3Status:
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
of cluster Important: Run "make" to regenerate code after modifying
- isApplied
- name
type: object
+ required:
+ - msg
type: object
type: object
version: v1alpha1
import (
"context"
+ "time"
"github.com/go-logr/logr"
"k8s.io/apimachinery/pkg/api/errors"
// Updating sdewan to set status isapplied = false
// this will trigger sdewan controller to apply the new conf
sdewan.Status.Mwan3Status = batchv1alpha1.Mwan3Status{Name: instance.Name, IsApplied: false}
+ sdewan.Status.Msg = "triggered by mwan3Conf update at " + time.Now().String()
err := r.Status().Update(ctx, &sdewan)
if err != nil {
log.Error(err, "Failed to update the sdewan instance status", "sdewan", sdewan.Name)