public void installTemplate ( Template entity , String sourceName ) { OpenShiftClient openShiftClient = getOpenShiftClient ( ) ; if ( openShiftClient == null ) { // lets not install the template on Kubernetes! return ; } if ( ! isProcessTemplatesLocally ( ) ) { String namespace = getNamespace ( ) ; String id = getName ( entity ) ; Objects . requireNonNull ( id , "No name for " + entity + " " + sourceName ) ; Template old = openShiftClient . templates ( ) . inNamespace ( namespace ) . withName ( id ) . get ( ) ; if ( isRunning ( old ) ) { if ( UserConfigurationCompare . configEqual ( entity , old ) ) { log . info ( "Template has not changed so not doing anything" ) ; } else { boolean recreateMode = isRecreateMode ( ) ; // TODO seems you can't update templates right now recreateMode = true ; if ( recreateMode ) { openShiftClient . templates ( ) . inNamespace ( namespace ) . withName ( id ) . delete ( ) ; doCreateTemplate ( entity , namespace , sourceName ) ; } else { log . info ( "Updating a Template from " + sourceName ) ; try { Object answer = openShiftClient . templates ( ) . inNamespace ( namespace ) . withName ( id ) . replace ( entity ) ; log . info ( "Updated Template: " + answer ) ; } catch ( Exception e ) { onApplyError ( "Failed to update Template from " + sourceName + ". " + e + ". " + entity , e ) ; } } } } else { if ( ! isAllowCreate ( ) ) { log . warn ( "Creation disabled so not creating a Template from " + sourceName + " namespace " + namespace + " name " + getName ( entity ) ) ; } else { doCreateTemplate ( entity , namespace , sourceName ) ; } } } }
Installs the template into the namespace without processing it