fix: clear the discovery cache after CRDs are installed

This fixes an issue in which a chart could not contain both a CRD and an instance of that CRD. It works around a stale cache by force cache invalidation whenever a CRD is added.

Closes #6316

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
pull/6332/head
Matt Butcher 6 years ago
parent 5bf7ca688f
commit e419668f8b
No known key found for this signature in database
GPG Key ID: DCD5F5E5EF32C345

@ -169,6 +169,15 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release.
}
return i.failRelease(rel, err)
}
// Invalidate the local cache.
if discoveryClient, err := i.cfg.RESTClientGetter.ToDiscoveryClient(); err != nil {
// On error, we don't want to bail out, since this is unlikely
// to impact the majority of charts.
i.cfg.Log("Could not clear the discovery cache: %s", err)
} else {
discoveryClient.Invalidate()
}
}
}

Loading…
Cancel
Save