@@ -903,7 +903,7 @@ else if (StartupControlConstants.AUTO_STARTUPCONTROL.equals(sc)) {
903903 info .setServerStartupInfo (ssic );
904904 LOGGER .exiting ();
905905 return doNext (scaleDownIfNecessary (info , servers ,
906- checkServerServices (info , new ManagedServerUpIteratorStep (ssic , next ))),
906+ new ClusterServicesStep (info , new ManagedServerUpIteratorStep (ssic , next ))),
907907 packet );
908908 case StartupControlConstants .ADMIN_STARTUPCONTROL :
909909 case StartupControlConstants .NONE_STARTUPCONTROL :
@@ -912,7 +912,7 @@ else if (StartupControlConstants.AUTO_STARTUPCONTROL.equals(sc)) {
912912 info .setServerStartupInfo (null );
913913 LOGGER .exiting ();
914914 return doNext (scaleDownIfNecessary (info , servers ,
915- checkServerServices (info , next )),
915+ new ClusterServicesStep (info , next )),
916916 packet );
917917 }
918918 }
@@ -949,84 +949,18 @@ private static List<V1EnvVar> startInAdminMode(List<V1EnvVar> env) {
949949 return env ;
950950 }
951951
952- private static Step checkServerServices (DomainPresenceInfo info , Step next ) {
953- Collection <String > allServers = new ArrayList <>();
954- Collection <ServerStartupInfo > ssic = new ArrayList <>();
955-
956- WlsDomainConfig scan = info .getScan ();
957-
958- // Iterate all servers
959- for (WlsClusterConfig wlsClusterConfig : scan .getClusterConfigs ().values ()) {
960- for (WlsServerConfig wlsServerConfig : wlsClusterConfig .getServerConfigs ()) {
961- String serverName = wlsServerConfig .getListenAddress ();
962- if (!allServers .contains (serverName )) {
963- allServers .add (serverName );
964- ssic .add (new ServerStartupInfo (wlsServerConfig , wlsClusterConfig , null , null ));
965- }
966- }
967- }
968- for (Map .Entry <String , WlsServerConfig > wlsServerConfig : scan .getServerConfigs ().entrySet ()) {
969- String serverName = wlsServerConfig .getKey ();
970- if (!allServers .contains (serverName )) {
971- allServers .add (serverName );
972- ssic .add (new ServerStartupInfo (wlsServerConfig .getValue (), null , null , null ));
973- }
974- }
975-
976- return new ManagedServerServicesStep (info , ssic , next );
977- }
978-
979- private static class ManagedServerServicesStep extends Step {
952+ private static class ClusterServicesStep extends Step {
980953 private final DomainPresenceInfo info ;
981- private final Collection <ServerStartupInfo > ssic ;
982954
983- public ManagedServerServicesStep (DomainPresenceInfo info , Collection < ServerStartupInfo > ssic , Step next ) {
955+ public ClusterServicesStep (DomainPresenceInfo info , Step next ) {
984956 super (next );
985957 this .info = info ;
986- this .ssic = ssic ;
987958 }
988959
989960 @ Override
990961 public NextAction apply (Packet packet ) {
991962 Collection <StepAndPacket > startDetails = new ArrayList <>();
992963
993- for (ServerStartupInfo ssi : ssic ) {
994- Packet p = packet .clone ();
995- WlsServerConfig serverConfig = ssi .serverConfig ;
996- ServerStartup serverStartup = ssi .serverStartup ;
997- String serverName = serverConfig .getName ();
998- p .put (ProcessingConstants .SERVER_SCAN , serverConfig );
999- p .put (ProcessingConstants .CLUSTER_SCAN , ssi .clusterConfig );
1000- p .put (ProcessingConstants .ENVVARS , ssi .envVars );
1001-
1002- DomainSpec spec = info .getDomain ().getSpec ();
1003- Integer nodePort = null ;
1004- if (serverStartup == null ) {
1005- List <ServerStartup > ssl = spec .getServerStartup ();
1006- if (ssl != null ) {
1007- for (ServerStartup ss : ssl ) {
1008- if (serverName .equals (ss .getServerName ())) {
1009- serverStartup = ss ;
1010- break ;
1011- }
1012- }
1013- }
1014- }
1015-
1016- if (serverStartup != null ) {
1017- nodePort = serverStartup .getNodePort ();
1018- }
1019-
1020- p .put (ProcessingConstants .SERVER_NAME , serverName );
1021- if (ssi .clusterConfig != null ) {
1022- p .put (ProcessingConstants .CLUSTER_NAME , ssi .clusterConfig .getClusterName ());
1023- }
1024- p .put (ProcessingConstants .PORT , serverConfig .getListenPort ());
1025- p .put (ProcessingConstants .NODE_PORT , nodePort );
1026-
1027- startDetails .add (new StepAndPacket (ServiceHelper .createForServerStep (null ), p ));
1028- }
1029-
1030964 // Add cluster services
1031965 WlsDomainConfig scan = info .getScan ();
1032966 if (scan != null ) {
@@ -1100,6 +1034,13 @@ public NextAction apply(Packet packet) {
11001034 p .put (ProcessingConstants .CLUSTER_SCAN , ssi .clusterConfig );
11011035 p .put (ProcessingConstants .ENVVARS , ssi .envVars );
11021036
1037+ p .put (ProcessingConstants .SERVER_NAME , ssi .serverConfig .getName ());
1038+ p .put (ProcessingConstants .PORT , ssi .serverConfig .getListenPort ());
1039+ ServerStartup ss = ssi .serverStartup ;
1040+ if (ss != null ) {
1041+ p .put (ProcessingConstants .NODE_PORT , ss .getNodePort ());
1042+ }
1043+
11031044 startDetails .add (new StepAndPacket (bringManagedServerUp (ssi , null ), p ));
11041045 }
11051046
@@ -1202,7 +1143,9 @@ public ServerDownStep(String serverName, ServerKubernetesObjects sko, Step next)
12021143
12031144 @ Override
12041145 public NextAction apply (Packet packet ) {
1205- return doNext (PodHelper .deletePodStep (sko , new ServerDownFinalizeStep (serverName , next )), packet );
1146+ return doNext (PodHelper .deletePodStep (sko ,
1147+ ServiceHelper .deleteServiceStep (sko ,
1148+ new ServerDownFinalizeStep (serverName , next ))), packet );
12061149 }
12071150 }
12081151
@@ -1228,7 +1171,8 @@ public NextAction apply(Packet packet) {
12281171 // "clusterScan"
12291172 // "envVars"
12301173 private static Step bringManagedServerUp (ServerStartupInfo ssi , Step next ) {
1231- return PodHelper .createManagedPodStep (next );
1174+ return PodHelper .createManagedPodStep (
1175+ ServiceHelper .createForServerStep (next ));
12321176 }
12331177
12341178 private static void deleteDomainPresence (Domain dom ) {
0 commit comments