public boolean applyNamespace ( Namespace entity ) { String namespace = getOrCreateMetadata ( entity ) . getName ( ) ; log . info ( "Using namespace: " + namespace ) ; String name = getName ( entity ) ; Objects . requireNonNull ( name , "No name for " + entity ) ; Namespace old = kubernetesClient . namespaces ( ) . withName ( name ) . get ( ) ; if ( ! isRunning ( old ) ) { try { Object answer = kubernetesClient . namespaces ( ) . create ( entity ) ; logGeneratedEntity ( "Created namespace: " , namespace , entity , answer ) ; return true ; } catch ( Exception e ) { onApplyError ( "Failed to create namespace: " + name + " due " + e . getMessage ( ) , e ) ; } } return false ; }
Returns true if the namespace is created