Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: S-mishina <seiryu.mishina@zozo.com>
  • Loading branch information
S-mishina committed May 15, 2024
1 parent 80cae71 commit 65867f7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/router/istio.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,6 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {

if canary.Spec.Service.Delegation {
// delegate VirtualService requires the hosts and gateway empty.
virtualService.Spec.Gateways = []string{}
virtualService.Spec.Hosts = []string{}
newSpec.Hosts = []string{}
newSpec.Gateways = []string{}
}
Expand Down Expand Up @@ -332,15 +330,15 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {
)
labelsDiff := cmp.Diff(newMetadata.Labels, virtualService.Labels, cmpopts.EquateEmpty())
annotationsDiff := cmp.Diff(newMetadata.Annotations, virtualService.Annotations, cmpopts.EquateEmpty())
if specDiff != "" || labelsDiff != "" || annotationsDiff != "" || canary.Spec.Service.Delegation {
if specDiff != "" || labelsDiff != "" || annotationsDiff != "" {
vtClone := virtualService.DeepCopy()
vtClone.Spec = newSpec
vtClone.ObjectMeta.Annotations = newMetadata.Annotations
vtClone.ObjectMeta.Labels = newMetadata.Labels
//If annotation kubectl.kubernetes.io/last-applied-configuration is present no need to duplicate
//serialization. If not present store the serialized object in annotation
//flagger.kubernetes.app/original-configuration
if _, ok := vtClone.Annotations[kubectlAnnotation]; !ok && specDiff != "" || canary.Spec.Service.Delegation {
if _, ok := vtClone.Annotations[kubectlAnnotation]; !ok && specDiff != ""{
b, err := json.Marshal(virtualService.Spec)
if err != nil {
ir.logger.Warnf("Unable to marshal VS %s for orig-configuration annotation", virtualService.Name)
Expand Down

0 comments on commit 65867f7

Please sign in to comment.