diff --git a/pkg/apis/deployment/v1alpha/member_status.go b/pkg/apis/deployment/v1alpha/member_status.go index 0e102a7a5..8d5110d5e 100644 --- a/pkg/apis/deployment/v1alpha/member_status.go +++ b/pkg/apis/deployment/v1alpha/member_status.go @@ -56,7 +56,7 @@ type MemberStatus struct { // CleanoutJobID holds the ID of the agency job for cleaning out this server CleanoutJobID string `json:"cleanout-job-id,omitempty"` // SideCarSpecs contains list of specifications specified for side cars - SideCarSpecs map[string]v1.Container + SideCarSpecs map[string]v1.Container `json:"sidecars-specs,omitempty"` // ArangoVersion holds the ArangoDB version in member ArangoVersion driver.Version `json:"arango-version,omitempty"` //ImageId holds the members ArangoDB image ID diff --git a/pkg/deployment/reconcile/action_rotate_member.go b/pkg/deployment/reconcile/action_rotate_member.go index 3ad14469e..e6cbe7a07 100644 --- a/pkg/deployment/reconcile/action_rotate_member.go +++ b/pkg/deployment/reconcile/action_rotate_member.go @@ -26,7 +26,6 @@ import ( "context" "time" - "k8s.io/api/core/v1" api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha" "github.com/rs/zerolog" ) @@ -119,15 +118,6 @@ func (a *actionRotateMember) CheckProgress(ctx context.Context) (bool, bool, err m.Phase = api.MemberPhaseNone m.RecentTerminations = nil // Since we're rotating, we do not care about old terminations. m.CleanoutJobID = "" - - group := a.action.Group - var groupSpec = a.actionCtx.GetSpec().GetServerGroupSpec(group) - // Check for missing side cars in - m.SideCarSpecs = make(map[string]v1.Container) - for _, specSidecar := range groupSpec.GetSidecars() { - m.SideCarSpecs[specSidecar.Name] = *specSidecar.DeepCopy() - } - if err := a.actionCtx.UpdateMember(m); err != nil { return false, false, maskAny(err) } diff --git a/pkg/deployment/reconcile/plan_builder.go b/pkg/deployment/reconcile/plan_builder.go index 8399f1d62..80e96575f 100644 --- a/pkg/deployment/reconcile/plan_builder.go +++ b/pkg/deployment/reconcile/plan_builder.go @@ -429,70 +429,7 @@ func podNeedsRotation(log zerolog.Logger, p v1.Pod, apiObject metav1.Object, spe // sideCarRequireRotation checks if side car requires rotation including default parameters func sideCarRequireRotation(wanted, given *v1.Container) bool { - if !reflect.DeepEqual(wanted.Args, given.Args) { - return true - } - if !reflect.DeepEqual(wanted.Command, given.Command) { - return true - } - if !reflect.DeepEqual(wanted.Env, given.Env) { - return true - } - if !reflect.DeepEqual(wanted.EnvFrom, given.EnvFrom) { - return true - } - if wanted.Image != given.Image { - return true - } - if wanted.ImagePullPolicy != given.ImagePullPolicy { - if wanted.ImagePullPolicy != "Always" || !strings.HasSuffix(given.Image, ":latest") { - return true - } - } - if wanted.Lifecycle != given.Lifecycle { - return true - } - if wanted.LivenessProbe != given.LivenessProbe { - return true - } - if !reflect.DeepEqual(wanted.Ports, given.Ports) { - return true - } - if wanted.ReadinessProbe != given.ReadinessProbe { - return true - } - if !reflect.DeepEqual(wanted.Resources, given.Resources) { - return true - } - if wanted.SecurityContext != given.SecurityContext { - return true - } - if wanted.Stdin != given.Stdin { - return true - } - if wanted.StdinOnce != given.StdinOnce { - return true - } - if wanted.TerminationMessagePath != given.TerminationMessagePath { - return true - } - if wanted.TerminationMessagePolicy != given.TerminationMessagePolicy { - return true - } - if wanted.TTY != given.TTY { - return true - } - if !reflect.DeepEqual(wanted.VolumeDevices, given.VolumeDevices) { - return true - } - if !reflect.DeepEqual(wanted.VolumeMounts, given.VolumeMounts) { - return true - } - if wanted.WorkingDir != given.WorkingDir { - return true - } - - return false + return !reflect.DeepEqual(wanted, given) } // resourcesRequireRotation returns true if the resource requirements have changed such that a rotation is required diff --git a/pkg/deployment/resources/pod_creator.go b/pkg/deployment/resources/pod_creator.go index 4d129d763..b2ca0fb82 100644 --- a/pkg/deployment/resources/pod_creator.go +++ b/pkg/deployment/resources/pod_creator.go @@ -671,6 +671,12 @@ func (r *Resources) createPodForMember(spec api.DeploymentSpec, memberID string, m.ArangoVersion = status.CurrentImage.ArangoDBVersion m.ImageID = status.CurrentImage.ImageID + // Check for missing side cars in + m.SideCarSpecs = make(map[string]v1.Container) + for _, specSidecar := range groupSpec.GetSidecars() { + m.SideCarSpecs[specSidecar.Name] = *specSidecar.DeepCopy() + } + log.Debug().Str("pod-name", m.PodName).Msg("Created pod") } else if group.IsArangosync() { // Check image