Skip to content

Commit

Permalink
Merge pull request #25 from adyanth/bug-24
Browse files Browse the repository at this point in the history
🐛 Update labels instead of overwriting them
  • Loading branch information
adyanth authored Feb 22, 2022
2 parents 1c8ca60 + b1922a1 commit 97d52aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion controllers/clustertunnel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ func (r *ClusterTunnelReconciler) cleanupTunnel() (ctrl.Result, bool, error) {
}

func (r *ClusterTunnelReconciler) updateTunnelStatus() error {
r.tunnel.Labels = labelsForClusterTunnel(*r.tunnel)
for k, v := range labelsForClusterTunnel(*r.tunnel) {
r.tunnel.Labels[k] = v
}
if err := r.Update(r.ctx, r.tunnel); err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion controllers/service_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ func (r *ServiceReconciler) creationLogic() error {
}

// Add labels for Service
r.service.Labels = r.labelsForService()
for k, v := range r.labelsForService() {
r.service.Labels[k] = v
}

// Update Service resource
if err := r.Update(r.ctx, r.service); err != nil {
Expand Down
4 changes: 3 additions & 1 deletion controllers/tunnel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ func (r *TunnelReconciler) cleanupTunnel() (ctrl.Result, bool, error) {
}

func (r *TunnelReconciler) updateTunnelStatus() error {
r.tunnel.Labels = labelsForTunnel(*r.tunnel)
for k, v := range labelsForTunnel(*r.tunnel) {
r.tunnel.Labels[k] = v
}
if err := r.Update(r.ctx, r.tunnel); err != nil {
return err
}
Expand Down

0 comments on commit 97d52aa

Please sign in to comment.