Skip to content

Commit

Permalink
Merge pull request #193 from layer5io/utkarsh-pro/fix/patches
Browse files Browse the repository at this point in the history
Patch operation fix
  • Loading branch information
kumarabd authored Feb 22, 2021
2 parents 3ee99f8 + f102fab commit a1226db
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion istio/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"strings"
"time"

"github.com/layer5io/meshery-adapter-library/adapter"
"github.com/layer5io/meshery-adapter-library/status"
Expand Down Expand Up @@ -36,7 +37,9 @@ func (istio *Istio) installAddon(namespace string, del bool, service string, pat
// Specifically choosing to ignore kiali dashboard's error.
// Referring to: https://github.com/kiali/kiali/issues/3112
if err != nil && !strings.Contains(err.Error(), "no matches for kind \"MonitoringDashboard\" in version \"monitoring.kiali.io/v1alpha1\"") {
return st, ErrAddonFromTemplate(err)
if !strings.Contains(err.Error(), "clusterIP") {
return st, ErrAddonFromTemplate(err)
}
}
}

Expand All @@ -50,16 +53,22 @@ func (istio *Istio) installAddon(namespace string, del bool, service string, pat
}

if !del {
time.Sleep(1 * time.Second)

_, err := istio.KubeClient.CoreV1().Services(namespace).Patch(context.TODO(), service, types.MergePatchType, []byte(jsonContents[0]), metav1.PatchOptions{})
if err != nil {
return st, ErrAddonFromTemplate(err)
}

time.Sleep(1 * time.Second)

_, err = istio.KubeClient.CoreV1().Services(namespace).Patch(context.TODO(), service, types.MergePatchType, []byte(jsonContents[1]), metav1.PatchOptions{})
if err != nil {
return st, ErrAddonFromTemplate(err)
}

time.Sleep(1 * time.Second)

_, err = istio.KubeClient.CoreV1().Services(namespace).Patch(context.TODO(), service, types.MergePatchType, []byte(jsonContents[2]), metav1.PatchOptions{})
if err != nil {
return st, ErrAddonFromTemplate(err)
Expand Down

0 comments on commit a1226db

Please sign in to comment.