From 4c3b510409475e9e2f9a65e1e0a9d3f1b4608c91 Mon Sep 17 00:00:00 2001 From: Tanmay Jain Date: Fri, 5 Jul 2024 13:03:42 +0530 Subject: [PATCH] small code enhancements --- Dockerfile | 2 +- api/v1/aerospikecluster_validating_webhook.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7ad06900d..fd34029de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM --platform=$BUILDPLATFORM golang:1.21 as builder +FROM --platform=$BUILDPLATFORM golang:1.21 AS builder # OS and Arch args ARG TARGETOS diff --git a/api/v1/aerospikecluster_validating_webhook.go b/api/v1/aerospikecluster_validating_webhook.go index f1152e9b1..7a4512ab2 100644 --- a/api/v1/aerospikecluster_validating_webhook.go +++ b/api/v1/aerospikecluster_validating_webhook.go @@ -2398,10 +2398,8 @@ func validateOperationUpdate(oldSpec, newSpec *AerospikeClusterSpec, status *Aer oldOp = &oldSpec.Operations[0] } - if !reflect.DeepEqual(oldOp, newOp) { - if oldOp != nil && oldOp.ID == newOp.ID { - return fmt.Errorf("operation %s cannot be updated", newOp.ID) - } + if oldOp != nil && oldOp.ID == newOp.ID && !reflect.DeepEqual(oldOp, newOp) { + return fmt.Errorf("operation %s cannot be updated", newOp.ID) } allPodNames := GetAllPodNames(status.Pods)