|
|
@ -38,6 +38,7 @@ import (
|
|
|
|
"helm.sh/helm/v3/pkg/downloader"
|
|
|
|
"helm.sh/helm/v3/pkg/downloader"
|
|
|
|
"helm.sh/helm/v3/pkg/engine"
|
|
|
|
"helm.sh/helm/v3/pkg/engine"
|
|
|
|
"helm.sh/helm/v3/pkg/getter"
|
|
|
|
"helm.sh/helm/v3/pkg/getter"
|
|
|
|
|
|
|
|
"helm.sh/helm/v3/pkg/kube"
|
|
|
|
kubefake "helm.sh/helm/v3/pkg/kube/fake"
|
|
|
|
kubefake "helm.sh/helm/v3/pkg/kube/fake"
|
|
|
|
"helm.sh/helm/v3/pkg/postrender"
|
|
|
|
"helm.sh/helm/v3/pkg/postrender"
|
|
|
|
"helm.sh/helm/v3/pkg/release"
|
|
|
|
"helm.sh/helm/v3/pkg/release"
|
|
|
@ -242,6 +243,7 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release.
|
|
|
|
// Mark this release as in-progress
|
|
|
|
// Mark this release as in-progress
|
|
|
|
rel.SetStatus(release.StatusPendingInstall, "Initial install underway")
|
|
|
|
rel.SetStatus(release.StatusPendingInstall, "Initial install underway")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var adoptedResources kube.ResourceList
|
|
|
|
resources, err := i.cfg.KubeClient.Build(bytes.NewBufferString(rel.Manifest), !i.DisableOpenAPIValidation)
|
|
|
|
resources, err := i.cfg.KubeClient.Build(bytes.NewBufferString(rel.Manifest), !i.DisableOpenAPIValidation)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, errors.Wrap(err, "unable to build kubernetes objects from release manifest")
|
|
|
|
return nil, errors.Wrap(err, "unable to build kubernetes objects from release manifest")
|
|
|
@ -254,9 +256,11 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release.
|
|
|
|
// deleting the release because the manifest will be pointing at that
|
|
|
|
// deleting the release because the manifest will be pointing at that
|
|
|
|
// resource
|
|
|
|
// resource
|
|
|
|
if !i.ClientOnly && !isUpgrade {
|
|
|
|
if !i.ClientOnly && !isUpgrade {
|
|
|
|
if err := existingResourceConflict(resources); err != nil {
|
|
|
|
toBeUpdated, err := existingResourceConflict(resources, rel.Name)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return nil, errors.Wrap(err, "rendered manifests contain a resource that already exists. Unable to continue with install")
|
|
|
|
return nil, errors.Wrap(err, "rendered manifests contain a resource that already exists. Unable to continue with install")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
adoptedResources = toBeUpdated
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Bail out here if it is a dry run
|
|
|
|
// Bail out here if it is a dry run
|
|
|
@ -291,7 +295,7 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release.
|
|
|
|
// At this point, we can do the install. Note that before we were detecting whether to
|
|
|
|
// At this point, we can do the install. Note that before we were detecting whether to
|
|
|
|
// do an update, but it's not clear whether we WANT to do an update if the re-use is set
|
|
|
|
// do an update, but it's not clear whether we WANT to do an update if the re-use is set
|
|
|
|
// to true, since that is basically an upgrade operation.
|
|
|
|
// to true, since that is basically an upgrade operation.
|
|
|
|
if _, err := i.cfg.KubeClient.Create(resources); err != nil {
|
|
|
|
if _, err := i.cfg.KubeClient.Update(adoptedResources, resources, false); err != nil {
|
|
|
|
return i.failRelease(rel, err)
|
|
|
|
return i.failRelease(rel, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|