Skip to content

Commit

Permalink
updating ports in statefulsets.
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayja committed Sep 22, 2023
1 parent 84ad372 commit 4b69906
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ func (r *SingleClusterReconciler) updateServicePorts(service *corev1.Service) er
)
}

r.Log.Info(
"Service already exist. Updated existing service",
"name", utils.NamespacedName(service.Namespace, service.Name),
)

return nil
}

Expand Down
14 changes: 14 additions & 0 deletions controllers/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,17 @@ func (r *SingleClusterReconciler) updateSTSStorage(
sortContainerVolumeAttachments(st.Spec.Template.Spec.Containers)
}

func (r *SingleClusterReconciler) updateSTSPorts(
st *appsv1.StatefulSet,
) {
ports := getSTSContainerPort(
r.aeroCluster.Spec.PodSpec.MultiPodPerHost,
r.aeroCluster.Spec.AerospikeConfig,
)

st.Spec.Template.Spec.Containers[0].Ports = ports
}

func sortContainerVolumeAttachments(containers []corev1.Container) {
for idx := range containers {
sort.Slice(
Expand All @@ -572,6 +583,9 @@ func (r *SingleClusterReconciler) updateSTS(
// Update settings from pod spec.
r.updateSTSFromPodSpec(statefulSet, rackState)

// Updating ports when switching between tls and non-tls.
r.updateSTSPorts(statefulSet)

// Update the images for all containers from the spec.
// Our Pod Spec does not contain image for the Aerospike Server
// Container.
Expand Down

0 comments on commit 4b69906

Please sign in to comment.