-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(explicitRollback): Add configurable timeout for serverGroup looku…
…p from Clouddriver API (#4686) (#4690) * fix(explicitRollback): Add configurable timeout for serverGroup rollback from Clouddriver API * fix(explicitRollback): Fix tests * fix(explicitRollback): Add configurable timeout for serverGroup lookup from Clouddriver API * fix(explicitRollback): Add configurable timeout for serverGroup lookup from Clouddriver API * fix(explicitRollback): Add configurable timeout for serverGroup lookup from Clouddriver API --------- Co-authored-by: Jason <[email protected]> (cherry picked from commit 2b8af02) Co-authored-by: Christos Arvanitis <[email protected]>
- Loading branch information
1 parent
30454a2
commit ccdb662
Showing
5 changed files
with
107 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...n/java/com/netflix/spinnaker/orca/clouddriver/config/RollbackConfigurationProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2024 Harness, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.orca.clouddriver.config; | ||
|
||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; | ||
import org.springframework.boot.context.properties.NestedConfigurationProperty; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Data | ||
@Configuration | ||
@ConfigurationProperties(prefix = "rollback") | ||
public class RollbackConfigurationProperties { | ||
|
||
private static final Logger logger = | ||
LoggerFactory.getLogger(RollbackConfigurationProperties.class); | ||
|
||
@Value("${rollback.timeout.enabled:false}") | ||
private boolean dynamicRollbackEnabled; | ||
|
||
@Deprecated | ||
@DeprecatedConfigurationProperty(replacement = "rollback.dynamicRollback.enabled") | ||
public boolean getDynamicRollbackEnabled() { | ||
return dynamicRollbackEnabled; | ||
} | ||
|
||
@NestedConfigurationProperty private ExplicitRollback explicitRollback = new ExplicitRollback(); | ||
|
||
@NestedConfigurationProperty private DynamicRollback dynamicRollback = new DynamicRollback(); | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public static class ExplicitRollback { | ||
private int timeout = 5; | ||
} | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public static class DynamicRollback { | ||
private boolean enabled = false; | ||
} | ||
|
||
public boolean isDynamicRollbackEnabled() { | ||
if (getDynamicRollbackEnabled()) { | ||
logger.warn( | ||
"The rollback.timeout.enabled property is deprecated and will be removed in a future release. Please use rollback.dynamicRollback.enabled instead."); | ||
} | ||
return dynamicRollback.isEnabled() || getDynamicRollbackEnabled(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters