@@ -903,7 +903,7 @@ else if (StartupControlConstants.AUTO_STARTUPCONTROL.equals(sc)) {
903
903
info .setServerStartupInfo (ssic );
904
904
LOGGER .exiting ();
905
905
return doNext (scaleDownIfNecessary (info , servers ,
906
- checkServerServices (info , new ManagedServerUpIteratorStep (ssic , next ))),
906
+ new ClusterServicesStep (info , new ManagedServerUpIteratorStep (ssic , next ))),
907
907
packet );
908
908
case StartupControlConstants .ADMIN_STARTUPCONTROL :
909
909
case StartupControlConstants .NONE_STARTUPCONTROL :
@@ -912,7 +912,7 @@ else if (StartupControlConstants.AUTO_STARTUPCONTROL.equals(sc)) {
912
912
info .setServerStartupInfo (null );
913
913
LOGGER .exiting ();
914
914
return doNext (scaleDownIfNecessary (info , servers ,
915
- checkServerServices (info , next )),
915
+ new ClusterServicesStep (info , next )),
916
916
packet );
917
917
}
918
918
}
@@ -949,84 +949,18 @@ private static List<V1EnvVar> startInAdminMode(List<V1EnvVar> env) {
949
949
return env ;
950
950
}
951
951
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 {
980
953
private final DomainPresenceInfo info ;
981
- private final Collection <ServerStartupInfo > ssic ;
982
954
983
- public ManagedServerServicesStep (DomainPresenceInfo info , Collection < ServerStartupInfo > ssic , Step next ) {
955
+ public ClusterServicesStep (DomainPresenceInfo info , Step next ) {
984
956
super (next );
985
957
this .info = info ;
986
- this .ssic = ssic ;
987
958
}
988
959
989
960
@ Override
990
961
public NextAction apply (Packet packet ) {
991
962
Collection <StepAndPacket > startDetails = new ArrayList <>();
992
963
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
-
1030
964
// Add cluster services
1031
965
WlsDomainConfig scan = info .getScan ();
1032
966
if (scan != null ) {
@@ -1100,6 +1034,11 @@ public NextAction apply(Packet packet) {
1100
1034
p .put (ProcessingConstants .CLUSTER_SCAN , ssi .clusterConfig );
1101
1035
p .put (ProcessingConstants .ENVVARS , ssi .envVars );
1102
1036
1037
+ p .put (ProcessingConstants .SERVER_NAME , ssi .serverConfig .getName ());
1038
+ p .put (ProcessingConstants .PORT , ssi .serverConfig .getListenPort ());
1039
+ ServerStartup ss = ssi .serverStartup ;
1040
+ p .put (ProcessingConstants .NODE_PORT , ss != null ? ss .getNodePort () : null );
1041
+
1103
1042
startDetails .add (new StepAndPacket (bringManagedServerUp (ssi , null ), p ));
1104
1043
}
1105
1044
@@ -1202,7 +1141,9 @@ public ServerDownStep(String serverName, ServerKubernetesObjects sko, Step next)
1202
1141
1203
1142
@ Override
1204
1143
public NextAction apply (Packet packet ) {
1205
- return doNext (PodHelper .deletePodStep (sko , new ServerDownFinalizeStep (serverName , next )), packet );
1144
+ return doNext (PodHelper .deletePodStep (sko ,
1145
+ ServiceHelper .deleteServiceStep (sko ,
1146
+ new ServerDownFinalizeStep (serverName , next ))), packet );
1206
1147
}
1207
1148
}
1208
1149
@@ -1228,7 +1169,8 @@ public NextAction apply(Packet packet) {
1228
1169
// "clusterScan"
1229
1170
// "envVars"
1230
1171
private static Step bringManagedServerUp (ServerStartupInfo ssi , Step next ) {
1231
- return PodHelper .createManagedPodStep (next );
1172
+ return PodHelper .createManagedPodStep (
1173
+ ServiceHelper .createForServerStep (next ));
1232
1174
}
1233
1175
1234
1176
private static void deleteDomainPresence (Domain dom ) {
0 commit comments