new-integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/Namespace.java
public static void addLabelsToNamespace(String name, Map<String, String> labels)
      throws ApiException {
    boolean found = false;
    V1NamespaceList namespaces = Kubernetes.listNamespacesAsObjects();
    if (!namespaces.getItems().isEmpty()) {
      for (var ns : namespaces.getItems()) {
        if (name.equals(ns.getMetadata().getName())) {
          ns.metadata(ns.getMetadata().labels(labels));
          Kubernetes.replaceNamespace(ns);
          found = true;
        }
      }
    }
    if (!found) {
      getLogger().severe("Namespace {0} not found or failed to add labels", name);
    }
  }
/**
   * Add labels to a namespace.
   *
   * @param name name of the namespace
   * @param labels map of labels to add to the namespace
   * @throws ApiException when adding labels to namespace fails
   */
Add labels to a namespace.
@param name name of the namespace
@param labels map of labels to add to the namespace
@throws ApiException when adding labels to namespace fails
Add labels to a namespace . @param name name of the namespace @param labels map of labels to add to the namespace @throws ApiException when adding labels to namespace fails
public static void addLabelsToNamespace(String name, Map<String, String> labels)
      throws ApiException {
    boolean found = false;
    V1NamespaceList namespaces = Kubernetes.listNamespacesAsObjects();
    if (!namespaces.getItems().isEmpty()) {
      for (var ns : namespaces.getItems()) {
        if (name.equals(ns.getMetadata().getName())) {
          ns.metadata(ns.getMetadata().labels(labels));
          Kubernetes.replaceNamespace(ns);
          found = true;
        }
      }
    }
    if (!found) {
      getLogger().severe("Namespace {0} not found or failed to add labels", name);
    }
  }
public static void addLabelsToNamespace ( String name , Map < String , String > labels ) throws ApiException { boolean found = false ; V1NamespaceList namespaces = Kubernetes . listNamespacesAsObjects ( ) ; if ( ! namespaces . getItems ( ) . isEmpty ( ) ) { for ( var ns : namespaces . getItems ( ) ) { if ( name . equals ( ns . getMetadata ( ) . getName ( ) ) ) { ns . metadata ( ns . getMetadata ( ) . labels ( labels ) ) ; Kubernetes . replaceNamespace ( ns ) ; found = true ; } } } if ( ! found ) { getLogger ( ) . severe ( "Namespace {0} not found or failed to add labels" , name ) ; } }
Add labels to a namespace.
Add labels to a namespace .