diff --git a/pkg/common-env.go b/pkg/common-env.go index d8f42c8..90c6651 100644 --- a/pkg/common-env.go +++ b/pkg/common-env.go @@ -3,7 +3,6 @@ package pkg import ( goctx "context" "os" - "strconv" "strings" "github.com/go-logr/logr" @@ -27,7 +26,6 @@ type InitParams struct { networkInfo *networkInfo podName string namespace string - rackID string nodeID string workDir string tlsName string @@ -108,7 +106,6 @@ func PopulateInitParams(ctx goctx.Context) (*InitParams, error) { k8sClient: k8sClient, podName: podName, namespace: namespace, - rackID: strconv.Itoa(rack.ID), nodeID: nodeID, workDir: workDir, logger: logger, diff --git a/pkg/update_pod_status_util.go b/pkg/update_pod_status_util.go index 85512ea..38d1021 100644 --- a/pkg/update_pod_status_util.go +++ b/pkg/update_pod_status_util.go @@ -18,6 +18,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/json" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/util/retry" "sigs.k8s.io/controller-runtime/pkg/client" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" @@ -597,6 +598,32 @@ func (initp *InitParams) manageVolumesAndUpdateStatus(ctx context.Context, resta metadata.InitializedVolumes = initializedVolumes metadata.DirtyVolumes = dirtyVolumes + data, err := os.ReadFile(aerospikeConf) + if err != nil { + return err + } + + if pod.Annotations == nil { + pod.Annotations = make(map[string]string) + } + + pod.Annotations["aerospikeConf"] = string(data) + + if err := retry.OnError(retry.DefaultBackoff, func(err error) bool { + // Customize the error check for retrying, return true to retry, false to stop retrying + return true + }, func() error { + // Patch the resource + if err := initp.k8sClient.Update(ctx, pod); err != nil { + return err + } + + initp.logger.Info("Pod status patched successfully", "podname", initp.podName) + return nil + }); err != nil { + return err + } + initp.logger.Info("Updating pod status", "podname", initp.podName) return initp.updateStatus(ctx, metadata)