@@ -28,18 +28,18 @@ func (r *AtlasNetworkContainerReconciler) create(workflowCtx *workflow.Context,
2828 return r .ready (workflowCtx , req .networkContainer , createdContainer )
2929}
3030
31- func (r * AtlasNetworkContainerReconciler ) sync (workflowCtx * workflow.Context , req * reconcileRequest , container * networkcontainer.NetworkContainer ) (ctrl.Result , error ) {
32- cfg := networkcontainer .NewNetworkContainerConfig (
31+ func (r * AtlasNetworkContainerReconciler ) sync (workflowCtx * workflow.Context , req * reconcileRequest , atlasContainer * networkcontainer.NetworkContainer ) (ctrl.Result , error ) {
32+ desiredConfig := networkcontainer .NewNetworkContainerConfig (
3333 req .networkContainer .Spec .Provider , & req .networkContainer .Spec .AtlasNetworkContainerConfig )
3434 // only the CIDR block can be updated in a container
35- if cfg .CIDRBlock != container .NetworkContainerConfig .CIDRBlock {
36- return r .update (workflowCtx , req , container )
35+ if desiredConfig .CIDRBlock != atlasContainer .NetworkContainerConfig .CIDRBlock {
36+ return r .update (workflowCtx , req , atlasContainer . ID , desiredConfig )
3737 }
38- return r .ready (workflowCtx , req .networkContainer , container )
38+ return r .ready (workflowCtx , req .networkContainer , atlasContainer )
3939}
4040
41- func (r * AtlasNetworkContainerReconciler ) update (workflowCtx * workflow.Context , req * reconcileRequest , container * networkcontainer.NetworkContainer ) (ctrl.Result , error ) {
42- updatedContainer , err := req .service .Update (workflowCtx .Context , req .projectID , container . ID , & container . NetworkContainerConfig )
41+ func (r * AtlasNetworkContainerReconciler ) update (workflowCtx * workflow.Context , req * reconcileRequest , id string , config * networkcontainer.NetworkContainerConfig ) (ctrl.Result , error ) {
42+ updatedContainer , err := req .service .Update (workflowCtx .Context , req .projectID , id , config )
4343 if err != nil {
4444 wrappedErr := fmt .Errorf ("failed to update container: %w" , err )
4545 return r .terminate (workflowCtx , req .networkContainer , workflow .NetworkContainerNotConfigured , wrappedErr ), nil
0 commit comments