new-integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/primitive/Helm.java
public static boolean install(HelmParams helmParams, Map<String, Object> chartValues) {
    String namespace = helmParams.getNamespace();

    // assertions for required parameters
    assertThat(namespace)
        .as("make sure namespace is not empty or null")
        .isNotNull()
        .isNotEmpty();

    assertThat(helmParams.getReleaseName())
        .as("make sure releaseName is not empty or null")
        .isNotNull()
        .isNotEmpty();

    assertThat(helmParams.getRepoUrl() != null && helmParams.getChartName() == null)
        .as("make sure chart name is not empty or null when repo url is provided")
        .isFalse();

    assertThat(helmParams.getRepoUrl() == null && helmParams.getChartDir() == null)
        .as("make sure repo url, chart name and chart dir are not empty or null. "
            + "repo url, chart name or chart dir must be provided")
        .isFalse();

    //chart reference to be used in Helm install
    String chartRef = helmParams.getChartDir();

    // use repo url as chart reference if provided
    if (helmParams.getRepoUrl() != null && helmParams.getChartName() != null) {
      if (helmParams.getRepoName() != null) {
        // call 'helm repo add <repo_name> <repo_url>' first to add the repo
        addRepo(helmParams.getRepoName(), helmParams.getRepoUrl());
        chartRef = helmParams.getRepoName() + "/" + helmParams.getChartName();
      } else {
        chartRef = helmParams.getChartName() + " --repo " + helmParams.getRepoUrl();
      }
    }

    getLogger().fine("Installing a chart in namespace {0} using chart reference {1}", namespace, chartRef);

    // build Helm install command
    String installCmd = String.format("helm install %1s %2s --namespace %3s ",
        helmParams.getReleaseName(), chartRef, helmParams.getNamespace());

    // if we have chart values file
    String chartValuesFile = helmParams.getChartValuesFile();
    if (chartValuesFile != null) {
      installCmd = installCmd + " --values " + chartValuesFile;
    }

    // if we have chart version
    String chartVersion = helmParams.getChartVersion();
    if (chartVersion != null) {
      installCmd = installCmd + " --version " + chartVersion;
    }

    // add override chart values
    installCmd = installCmd + valuesToString(chartValues);

    if (helmParams.getChartVersion() != null) {
      installCmd = installCmd + " --version " + helmParams.getChartVersion();
    }

    // run the command
    return exec(installCmd);

  }
/**
   * Installs a Helm chart.
   * @param helmParams the parameters to Helm install command like namespace, release name,
   *                   repo url or chart dir, chart name
   * @param chartValues the values to override in a chart
   * @return true on success, false otherwise
   */
Installs a Helm chart.
@param helmParams the parameters to Helm install command like namespace, release name,
repo url or chart dir, chart name
@param chartValues the values to override in a chart
@return true on success, false otherwise
Installs a Helm chart . @param helmParams the parameters to Helm install command like namespace release name repo url or chart dir chart name @param chartValues the values to override in a chart @return true on success false otherwise
public static boolean install(HelmParams helmParams, Map<String, Object> chartValues) {
    String namespace = helmParams.getNamespace();
    assertThat(namespace)
        .as("make sure namespace is not empty or null")
        .isNotNull()
        .isNotEmpty();
    assertThat(helmParams.getReleaseName())
        .as("make sure releaseName is not empty or null")
        .isNotNull()
        .isNotEmpty();
    assertThat(helmParams.getRepoUrl() != null && helmParams.getChartName() == null)
        .as("make sure chart name is not empty or null when repo url is provided")
        .isFalse();
    assertThat(helmParams.getRepoUrl() == null && helmParams.getChartDir() == null)
        .as("make sure repo url, chart name and chart dir are not empty or null. "
            + "repo url, chart name or chart dir must be provided")
        .isFalse();
    String chartRef = helmParams.getChartDir();
    if (helmParams.getRepoUrl() != null && helmParams.getChartName() != null) {
      if (helmParams.getRepoName() != null) {
        addRepo(helmParams.getRepoName(), helmParams.getRepoUrl());
        chartRef = helmParams.getRepoName() + "/" + helmParams.getChartName();
      } else {
        chartRef = helmParams.getChartName() + " --repo " + helmParams.getRepoUrl();
      }
    }
    getLogger().fine("Installing a chart in namespace {0} using chart reference {1}", namespace, chartRef);
    String installCmd = String.format("helm install %1s %2s --namespace %3s ",
        helmParams.getReleaseName(), chartRef, helmParams.getNamespace());
    String chartValuesFile = helmParams.getChartValuesFile();
    if (chartValuesFile != null) {
      installCmd = installCmd + " --values " + chartValuesFile;
    }
    String chartVersion = helmParams.getChartVersion();
    if (chartVersion != null) {
      installCmd = installCmd + " --version " + chartVersion;
    }
    installCmd = installCmd + valuesToString(chartValues);
    if (helmParams.getChartVersion() != null) {
      installCmd = installCmd + " --version " + helmParams.getChartVersion();
    }
    return exec(installCmd);
  }
public static boolean install ( HelmParams helmParams , Map < String , Object > chartValues ) { String namespace = helmParams . getNamespace ( ) ; assertThat ( namespace ) . as ( "make sure namespace is not empty or null" ) . isNotNull ( ) . isNotEmpty ( ) ; assertThat ( helmParams . getReleaseName ( ) ) . as ( "make sure releaseName is not empty or null" ) . isNotNull ( ) . isNotEmpty ( ) ; assertThat ( helmParams . getRepoUrl ( ) != null && helmParams . getChartName ( ) == null ) . as ( "make sure chart name is not empty or null when repo url is provided" ) . isFalse ( ) ; assertThat ( helmParams . getRepoUrl ( ) == null && helmParams . getChartDir ( ) == null ) . as ( "make sure repo url, chart name and chart dir are not empty or null. " + "repo url, chart name or chart dir must be provided" ) . isFalse ( ) ; String chartRef = helmParams . getChartDir ( ) ; if ( helmParams . getRepoUrl ( ) != null && helmParams . getChartName ( ) != null ) { if ( helmParams . getRepoName ( ) != null ) { addRepo ( helmParams . getRepoName ( ) , helmParams . getRepoUrl ( ) ) ; chartRef = helmParams . getRepoName ( ) + "/" + helmParams . getChartName ( ) ; } else { chartRef = helmParams . getChartName ( ) + " --repo " + helmParams . getRepoUrl ( ) ; } } getLogger ( ) . fine ( "Installing a chart in namespace {0} using chart reference {1}" , namespace , chartRef ) ; String installCmd = String . format ( "helm install %1s %2s --namespace %3s " , helmParams . getReleaseName ( ) , chartRef , helmParams . getNamespace ( ) ) ; String chartValuesFile = helmParams . getChartValuesFile ( ) ; if ( chartValuesFile != null ) { installCmd = installCmd + " --values " + chartValuesFile ; } String chartVersion = helmParams . getChartVersion ( ) ; if ( chartVersion != null ) { installCmd = installCmd + " --version " + chartVersion ; } installCmd = installCmd + valuesToString ( chartValues ) ; if ( helmParams . getChartVersion ( ) != null ) { installCmd = installCmd + " --version " + helmParams . getChartVersion ( ) ; } return exec ( installCmd ) ; }
Installs a Helm chart.
Installs a Helm chart .
// assertions for required parameters //chart reference to be used in Helm install // use repo url as chart reference if provided // call 'helm repo add <repo_name> <repo_url>' first to add the repo // build Helm install command // if we have chart values file // if we have chart version // add override chart values // run the command