Commit 7ca83849 authored by Geoff Simmons's avatar Geoff Simmons

Set the "regular" config to "not available" when no Ingress is defined.

This was a remnant of earlier versions when the Pods were set to not
Ready when there is no Ingress to implement. No the Pods are always
ready, but we set the "configured" endpoint to respond with non-200
when nothing is defined.

However, if an Ingress had been defined previously, then deleted,
the http/https endpoints still responded as for the previous config.
This was semantically incorrect, and also meant that the VCL config
remained defined indefinitely. Now it becomes unlabeled, so it can
go cold and then be discarded.
parent e50a0c42
......@@ -732,8 +732,9 @@ func (vc *Controller) Update(
// SetNotReady may be called on the Delete event on an Ingress, if no
// Ingresses remain that are to be implemented by a Varnish Service.
// The Service is set to the not ready state, by relabelling VCL so
// that readiness checks are not answered with status 200.
// The Service is set to the not configured state, by relabelling VCL so
// that the "configured" endpoint is not answered with status 200. Also
// set the "regular" label to the "not available" config.
func (vc *Controller) SetNotReady(svcKey string) error {
svc, ok := vc.svcs[svcKey]
if !ok {
......@@ -744,18 +745,20 @@ func (vc *Controller) SetNotReady(svcKey string) error {
var errs AdmErrors
for _, inst := range svc.instances {
if err := vc.setCfgLabel(inst, notAvailCfg, readinessLabel,
false); err != nil {
for _, label := range []string{readinessLabel, regularLabel} {
if err := vc.setCfgLabel(inst, notAvailCfg, label,
false); err != nil {
if vc.ignorePermNetErr(err) {
if vc.ignorePermNetErr(err) {
continue
}
admErr := AdmError{
inst: inst.String(),
err: err,
}
errs = append(errs, admErr)
continue
}
admErr := AdmError{
inst: inst.String(),
err: err,
}
errs = append(errs, admErr)
continue
}
}
if len(errs) == 0 {
......
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