File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
main/java/oracle/kubernetes/operator
test/java/oracle/kubernetes/operator Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -1009,14 +1009,21 @@ private String getNamespace() {
1009
1009
1010
1010
@ Override
1011
1011
public Step createSteps () {
1012
+ boolean deleteInProgress = deleting || domainHasDeletionTimestamp ();
1012
1013
Step strategy =
1013
- new StartPlanStep (liveInfo , deleting ? createDomainDownPlan (liveInfo ) : createDomainUpPlan (liveInfo ));
1014
- if (deleting || getDomain () == null ) {
1014
+ new StartPlanStep (liveInfo ,
1015
+ deleteInProgress ? createDomainDownPlan (liveInfo ) : createDomainUpPlan (liveInfo ));
1016
+ if (deleteInProgress || getDomain () == null ) {
1015
1017
return strategy ;
1016
1018
} else {
1017
1019
return DomainValidationSteps .createDomainValidationSteps (getNamespace (), strategy );
1018
1020
}
1019
1021
}
1022
+
1023
+ private boolean domainHasDeletionTimestamp () {
1024
+ return Optional .ofNullable (liveInfo .getDomain ()).map (Domain ::getMetadata )
1025
+ .map (V1ObjectMeta ::getDeletionTimestamp ).isPresent ();
1026
+ }
1020
1027
}
1021
1028
1022
1029
private static boolean isGenerationChanged (DomainPresenceInfo liveInfo , DomainPresenceInfo cachedInfo ) {
Original file line number Diff line number Diff line change @@ -340,6 +340,21 @@ void whenDomainShutDown_removeAllPodsServicesAndPodDisruptionBudgets() {
340
340
assertThat (getRunningPDBs (), empty ());
341
341
}
342
342
343
+ @ Test
344
+ void whenDomainMarkedForDeletion_removeAllPodsServicesAndPodDisruptionBudgets () {
345
+ defineServerResources (ADMIN_NAME );
346
+ Arrays .stream (MANAGED_SERVER_NAMES ).forEach (this ::defineServerResources );
347
+
348
+ domain .getMetadata ().setDeletionTimestamp (OffsetDateTime .now ());
349
+ DomainPresenceInfo info = new DomainPresenceInfo (domain );
350
+ // MakeRightOperation is created without forDeletion() similar to list or MODIFIED watch
351
+ processor .createMakeRightOperation (info ).interrupt ().withExplicitRecheck ().execute ();
352
+
353
+ assertThat (getRunningServices (), empty ());
354
+ assertThat (getRunningPods (), empty ());
355
+ assertThat (getRunningPDBs (), empty ());
356
+ }
357
+
343
358
@ Test
344
359
void whenDomainShutDown_ignoreNonOperatorServices () {
345
360
defineServerResources (ADMIN_NAME );
You can’t perform that action at this time.
0 commit comments