Commit 89761388 authored by Geoff Simmons's avatar Geoff Simmons

Don't fail if not all of the Services have been created yet.

But generate Warning events identifying the missing Services.
parent 418ee04d
...@@ -40,11 +40,15 @@ import ( ...@@ -40,11 +40,15 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
api_v1 "k8s.io/api/core/v1" api_v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
core_v1_listers "k8s.io/client-go/listers/core/v1" core_v1_listers "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
) )
const vclSpecErr = "VCLspecError" const (
vclSpecErr = "VCLspecError"
svcNotFound = "SvcNotFound"
)
// SpecUpdaterConfig represents the user configuration for k8s // SpecUpdaterConfig represents the user configuration for k8s
// resources that are considered for a VCL update. // resources that are considered for a VCL update.
...@@ -152,6 +156,11 @@ func (updater *SpecUpdater) getSpec() (vcl.Spec, error) { ...@@ -152,6 +156,11 @@ func (updater *SpecUpdater) getSpec() (vcl.Spec, error) {
} }
svc, err := updater.svc.Services(ns).Get(name) svc, err := updater.svc.Services(ns).Get(name)
if err != nil { if err != nil {
if errors.IsNotFound(err) {
updater.vc.WarnEvt(svcNotFound,
"Service \"%s\" not found", svcKey)
continue
}
return spec, err return spec, err
} }
// XXX same name in different namespaces // XXX same name in different namespaces
...@@ -171,7 +180,7 @@ func (updater *SpecUpdater) getSpec() (vcl.Spec, error) { ...@@ -171,7 +180,7 @@ func (updater *SpecUpdater) getSpec() (vcl.Spec, error) {
svcsNotFound = append(svcsNotFound, name) svcsNotFound = append(svcsNotFound, name)
} }
} }
return spec, fmt.Errorf("Services not found, no update: %s", updater.vc.WarnEvt(svcNotFound, "Services not found: %s",
svcsNotFound) svcsNotFound)
} }
spec.Services = svcsSpec spec.Services = svcsSpec
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment