new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java
public static HelmParams installAndVerifyPrometheus(String promReleaseName,
                                                      String promNamespace,
                                                      String promValueFile,
                                                      String promVersion,
                                                      int promServerNodePort,
                                                      int alertManagerNodePort) {
    LoggingFacade logger = getLogger();
    // Helm install parameters
    HelmParams promHelmParams = new HelmParams()
        .releaseName(promReleaseName)
        .namespace(promNamespace)
        .chartDir("stable/prometheus")
        .chartValuesFile(promValueFile);

    if (promVersion != null) {
      promHelmParams.chartVersion(promVersion);
    }

    // prometheus chart values to override
    PrometheusParams prometheusParams = new PrometheusParams()
        .helmParams(promHelmParams)
        .nodePortServer(promServerNodePort)
        .nodePortAlertManager(alertManagerNodePort);

    // install prometheus
    logger.info("Installing prometheus in namespace {0}", promNamespace);
    assertTrue(installPrometheus(prometheusParams),
        String.format("Failed to install prometheus in namespace %s", promNamespace));
    logger.info("Prometheus installed in namespace {0}", promNamespace);

    // list Helm releases matching operator release name in operator namespace
    logger.info("Checking prometheus release {0} status in namespace {1}",
        promReleaseName, promNamespace);
    assertTrue(isHelmReleaseDeployed(promReleaseName, promNamespace),
        String.format("Prometheus release %s is not in deployed status in namespace %s",
            promReleaseName, promNamespace));
    logger.info("Prometheus release {0} status is deployed in namespace {1}",
        promReleaseName, promNamespace);

    // wait for the promethues pods to be ready
    logger.info("Wait for the promethues pod is ready in namespace {0}", promNamespace);
    withStandardRetryPolicy
        .conditionEvaluationListener(
            condition -> logger.info("Waiting for prometheus to be running in namespace {0} "
                    + "(elapsed time {1}ms, remaining time {2}ms)",
                promNamespace,
                condition.getElapsedTimeInMS(),
                condition.getRemainingTimeInMS()))
        .until(assertDoesNotThrow(() -> isPrometheusReady(promNamespace),
            "prometheusIsReady failed with ApiException"));

    return promHelmParams;
  }
/**
   * Install Prometheus and wait up to five minutes until the prometheus pods are ready.
   *
   * @param promReleaseName the prometheus release name
   * @param promNamespace the prometheus namespace in which the operator will be installed
   * @param promValueFile the promeheus value.yaml file path
   * @param promVersion the version of the prometheus helm chart
   * @param promServerNodePort nodePort value for prometheus server
   * @param alertManagerNodePort nodePort value for alertmanager
   * @return the prometheus Helm installation parameters
   */
Install Prometheus and wait up to five minutes until the prometheus pods are ready.
Install Prometheus and wait up to five minutes until the prometheus pods are ready .
public static HelmParams installAndVerifyPrometheus(String promReleaseName,
                                                      String promNamespace,
                                                      String promValueFile,
                                                      String promVersion,
                                                      int promServerNodePort,
                                                      int alertManagerNodePort) {
    LoggingFacade logger = getLogger();
    HelmParams promHelmParams = new HelmParams()
        .releaseName(promReleaseName)
        .namespace(promNamespace)
        .chartDir("stable/prometheus")
        .chartValuesFile(promValueFile);
    if (promVersion != null) {
      promHelmParams.chartVersion(promVersion);
    }
    PrometheusParams prometheusParams = new PrometheusParams()
        .helmParams(promHelmParams)
        .nodePortServer(promServerNodePort)
        .nodePortAlertManager(alertManagerNodePort);
    logger.info("Installing prometheus in namespace {0}", promNamespace);
    assertTrue(installPrometheus(prometheusParams),
        String.format("Failed to install prometheus in namespace %s", promNamespace));
    logger.info("Prometheus installed in namespace {0}", promNamespace);
    logger.info("Checking prometheus release {0} status in namespace {1}",
        promReleaseName, promNamespace);
    assertTrue(isHelmReleaseDeployed(promReleaseName, promNamespace),
        String.format("Prometheus release %s is not in deployed status in namespace %s",
            promReleaseName, promNamespace));
    logger.info("Prometheus release {0} status is deployed in namespace {1}",
        promReleaseName, promNamespace);
    logger.info("Wait for the promethues pod is ready in namespace {0}", promNamespace);
    withStandardRetryPolicy
        .conditionEvaluationListener(
            condition -> logger.info("Waiting for prometheus to be running in namespace {0} "
                    + "(elapsed time {1}ms, remaining time {2}ms)",
                promNamespace,
                condition.getElapsedTimeInMS(),
                condition.getRemainingTimeInMS()))
        .until(assertDoesNotThrow(() -> isPrometheusReady(promNamespace),
            "prometheusIsReady failed with ApiException"));
    return promHelmParams;
  }
public static HelmParams installAndVerifyPrometheus ( String promReleaseName , String promNamespace , String promValueFile , String promVersion , int promServerNodePort , int alertManagerNodePort ) { LoggingFacade logger = getLogger ( ) ; HelmParams promHelmParams = new HelmParams ( ) . releaseName ( promReleaseName ) . namespace ( promNamespace ) . chartDir ( "stable/prometheus" ) . chartValuesFile ( promValueFile ) ; if ( promVersion != null ) { promHelmParams . chartVersion ( promVersion ) ; } PrometheusParams prometheusParams = new PrometheusParams ( ) . helmParams ( promHelmParams ) . nodePortServer ( promServerNodePort ) . nodePortAlertManager ( alertManagerNodePort ) ; logger . info ( "Installing prometheus in namespace {0}" , promNamespace ) ; assertTrue ( installPrometheus ( prometheusParams ) , String . format ( "Failed to install prometheus in namespace %s" , promNamespace ) ) ; logger . info ( "Prometheus installed in namespace {0}" , promNamespace ) ; logger . info ( "Checking prometheus release {0} status in namespace {1}" , promReleaseName , promNamespace ) ; assertTrue ( isHelmReleaseDeployed ( promReleaseName , promNamespace ) , String . format ( "Prometheus release %s is not in deployed status in namespace %s" , promReleaseName , promNamespace ) ) ; logger . info ( "Prometheus release {0} status is deployed in namespace {1}" , promReleaseName , promNamespace ) ; logger . info ( "Wait for the promethues pod is ready in namespace {0}" , promNamespace ) ; withStandardRetryPolicy . conditionEvaluationListener ( condition -> logger . info ( "Waiting for prometheus to be running in namespace {0} " + "(elapsed time {1}ms, remaining time {2}ms)" , promNamespace , condition . getElapsedTimeInMS ( ) , condition . getRemainingTimeInMS ( ) ) ) . until ( assertDoesNotThrow ( ( ) -> isPrometheusReady ( promNamespace ) , "prometheusIsReady failed with ApiException" ) ) ; return promHelmParams ; }
Install Prometheus and wait up to five minutes until the prometheus pods are ready.
Install Prometheus and wait up to five minutes until the prometheus pods are ready .
// Helm install parameters // prometheus chart values to override // install prometheus // list Helm releases matching operator release name in operator namespace // wait for the promethues pods to be ready