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 (
"github.com/sirupsen/logrus"
api_v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
core_v1_listers "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
)
const vclSpecErr = "VCLspecError"
const (
vclSpecErr = "VCLspecError"
svcNotFound = "SvcNotFound"
)
// SpecUpdaterConfig represents the user configuration for k8s
// resources that are considered for a VCL update.
......@@ -152,6 +156,11 @@ func (updater *SpecUpdater) getSpec() (vcl.Spec, error) {
}
svc, err := updater.svc.Services(ns).Get(name)
if err != nil {
if errors.IsNotFound(err) {
updater.vc.WarnEvt(svcNotFound,
"Service \"%s\" not found", svcKey)
continue
}
return spec, err
}
// XXX same name in different namespaces
......@@ -171,7 +180,7 @@ func (updater *SpecUpdater) getSpec() (vcl.Spec, error) {
svcsNotFound = append(svcsNotFound, name)
}
}
return spec, fmt.Errorf("Services not found, no update: %s",
updater.vc.WarnEvt(svcNotFound, "Services not found: %s",
svcsNotFound)
}
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