<p>I've the following code which works,I was able to create a helm chart in the target cluster.
when you install some chart until the application (within the chart) is available it takes time ,
How can I check if the application that installed via helm chart is up and running ?
is there a way to do it with the helm client (we are using helm 3.5.2)</p>
<pre><code>tmpfile, err := ioutil.TempFile(kp, kcp)
if err != nil {
    log.Error(err, &quot;error&quot;)
}

defer os.Remove(tmpfile.Name()) 

if _, err := tmpfile.Write(cfg); err != nil {
    return err
}
if err := tmpfile.Close(); err != nil {
    return err
}

kcfgFilePath := tmpfile.Name()
settings := cli.New()
ac := new(action.Configuration)
clientGetter := genericclioptions.NewConfigFlags(false)
clientGetter.KubeConfig = &amp;kcfgFilePath



for _, chartInstallation := range charts {
    chart, err := loader.Load(chartInstallation.Path)
    if err != nil {
        return err
    }

    releaseName := releaseName + &quot;-&quot; + chartInstallation.Name
    if err := ac.Init(clientGetter, settings.Namespace(), os.Getenv(&quot;HELM_DRIVER&quot;), func(format string, v ...interface{}) {
        
    }); err != nil {
        return err
    }
    releasePresent := true
    statusAction := action.NewStatus(ac)
    status, err := statusAction.Run(releaseName)
    if err != nil {
        if strings.Contains(err.Error(), driver.ErrReleaseNotFound.Error()) {
            releasePresent = false
        } else {
            return err
        }
    }

    if !releasePresent {
        // install chart
        installAction := action.NewInstall(ac)
        installAction.CreateNamespace = true
        installAction.Namespace = chartInstallation.Namespace
        installAction.ReleaseName = releaseName

        _, err := installAction.Run(chart, nil)
        if err != nil {
            return err
        }
        log.Info(“chart installed: &quot;, &quot;releaseName&quot;, releaseName)
    }

    if status != nil {
        if releasePresent &amp;&amp; status.Info.Status.String() == release.StatusFailed.String() { 
            upgradeAction := action.NewUpgrade(ac)
            upgradeAction.Wait = true
            upgradeAction.ReuseValues = false
            upgradeAction.Recreate = false
            _, err := upgradeAction.Run(releaseName, chart, nil)
            if err != nil {
                return err
            }
        }
    }
</code></pre>

PJEM
<p>You need to <code>helm install</code> (or <code>upgrade</code>) using the <a href="https://helm.sh/docs/intro/using_helm/#helpful-options-for-installupgraderollback" rel="nofollow noreferrer"><code>--wait</code> flag</a>:</p>
<blockquote>
<p><code>--wait</code>: Waits until all Pods are in a ready state, PVCs are bound, Deployments have minimum (Desired minus <code>maxUnavailable</code>) Pods in ready
state and Services have an IP address (and Ingress if a LoadBalancer)
before marking the release as successful. It will wait for as long as
the <code>--timeout</code> [...]</p>
</blockquote>
<p>Make sure that your pods have <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/" rel="nofollow noreferrer">Liveness and Readiness</a> checks. Using the <code>--wait</code> the release will only return successfully after these checks are passing.</p>
