Skip to content

Commit

Permalink
provision/kubernetes: fix merge services when service does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarsa committed Nov 16, 2018
1 parent 82be8e5 commit 81688fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions provision/kubernetes/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1032,12 +1032,12 @@ func (m *serviceManager) DeployService(ctx context.Context, a provision.App, pro

func mergeServices(client *ClusterClient, svc *apiv1.Service) (*apiv1.Service, bool, error) {
existing, err := client.CoreV1().Services(svc.Namespace).Get(svc.Name, metav1.GetOptions{})
if err != nil && !k8sErrors.IsNotFound(err) {
if err != nil {
if k8sErrors.IsNotFound(err) {
return svc, true, nil
}
return nil, false, errors.WithStack(err)
}
if existing == nil {
return svc, true, nil
}
for i := 0; i < len(svc.Spec.Ports) && i < len(existing.Spec.Ports); i++ {
svc.Spec.Ports[i].NodePort = existing.Spec.Ports[i].NodePort
}
Expand Down

0 comments on commit 81688fb

Please sign in to comment.