mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(eks): store the cluster upgrade policy and update it through UpdateClusterConfig (#9253)
CreateCluster dropped upgradePolicy, DescribeCluster never returned one, and UpdateClusterConfig refused the member, so Terraform's aws_eks_cluster with upgrade_policy showed a diff on every plan that no apply could fix. CreateCluster now stores upgradePolicy.supportType, EXTENDED when the request names none, as EKS gives new clusters extended support, and DescribeCluster returns it. A cluster stored before reports EXTENDED as well. UpdateClusterConfig takes upgradePolicy as an update type of its own and answers with a Successful UpgradePolicyUpdate whose UpgradePolicy parameter holds the policy as JSON, as AWS records it. A repeated clientRequestToken is matched against it like the other families, and an unknown support type is refused with InvalidParameterException. STANDARD is refused, in AWS's words, for a version past its end of standard support: on CreateCluster, and on UpdateClusterConfig, which turns extended support on at any time but off only in standard support. The end of standard support of each version Floci serves comes from the Amazon EKS Kubernetes release calendar. A cluster that named no version counts as in standard support, as the version AWS gives it is. AWS::EKS::Cluster creates the cluster with its UpgradePolicy and updates it in place. A dropped UpgradePolicy returns the cluster to EXTENDED, a stack rollback restores the policy, and a cluster a stack created before this gets the policy its template declares on the stack's next update. Closes #5640
This commit is contained in:
1 parent
8a9fa27575
commit
b521ee513c
17 files changed
+491
-30
No files matched your search
+48
-9
@@ -17,6 +17,7 @@ import io.floci.aws.services.eks.model.Logging;
|
||||
import io.floci.aws.services.eks.model.Nodegroup;
|
||||
import io.floci.aws.services.eks.model.ResourcesVpcConfig;
|
||||
import io.floci.aws.services.eks.model.UpdateClusterConfigRequest;
|
||||
import io.floci.aws.services.eks.model.UpgradePolicy;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import org.jboss.logging.Logger;
|
||||
@@ -55,7 +56,8 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
private static final List<String> NODEGROUP_ATTRIBUTES = List.of("Id", "ClusterName", "NodegroupName", "Arn");
|
||||
private static final String SNAPSHOT_ATTR = CfnRollback.EKS_CLUSTER_UPDATE_SNAPSHOT_ATTR;
|
||||
/** The cluster properties updateInPlace applies through UpdateClusterConfig, besides Tags. */
|
||||
private static final Set<String> CLUSTER_APPLIED = Set.of("ResourcesVpcConfig", "Logging", "AccessConfig");
|
||||
private static final Set<String> CLUSTER_APPLIED =
|
||||
Set.of("ResourcesVpcConfig", "Logging", "AccessConfig", "UpgradePolicy");
|
||||
private static final String NODEGROUP_SNAPSHOT_ATTR = CfnRollback.EKS_NODEGROUP_UPDATE_SNAPSHOT_ATTR;
|
||||
// The tag keys the last deployment resolved, reserved ones included, as Ec2Tags.recordKeys records
|
||||
// them, so an update removes only those and keeps a tag added outside the stack.
|
||||
@@ -134,6 +136,7 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
request.setResourcesVpcConfig(createSetting(props, "ResourcesVpcConfig", ctx, new TypeReference<>() { }));
|
||||
request.setAccessConfig(createSetting(props, "AccessConfig", ctx, new TypeReference<>() { }));
|
||||
request.setLogging(logging(props, ctx));
|
||||
request.setUpgradePolicy(createSetting(props, "UpgradePolicy", ctx, new TypeReference<>() { }));
|
||||
Cluster created = eksService.createCluster(request);
|
||||
// The cluster this resource named before is gone or replaced; publish writes only what the
|
||||
// new one has, so its endpoint and certificate must not outlive it.
|
||||
@@ -240,9 +243,9 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
|
||||
/**
|
||||
* The update AWS makes for the properties it does not replace on: the cluster keeps its name.
|
||||
* Tags, Logging, AccessConfig.AuthenticationMode and the endpoint access members of ResourcesVpcConfig
|
||||
* are applied, and only when the template's value differs from the live cluster's. EksService has no
|
||||
* UpdateClusterVersion, so a changed Version is accepted with a warning and not applied. AWS lets
|
||||
* Tags, Logging, AccessConfig.AuthenticationMode, UpgradePolicy and the endpoint access members of
|
||||
* ResourcesVpcConfig are applied, and only when the template's value differs from the live cluster's.
|
||||
* EksService has no UpdateClusterVersion, so a changed Version is accepted with a warning and not applied. AWS lets
|
||||
* UpdateClusterConfig choose different subnets and security groups, but floci does not apply that, so a
|
||||
* changed or dropped subnet or security group list fails the resource. The snapshot holds, and the
|
||||
* rollback restores, only the config families the update changes, taken from the same read the request is
|
||||
@@ -254,6 +257,7 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
// One read of the cluster: the request, the snapshot and the apply all start from it.
|
||||
Cluster current = currentOr(live);
|
||||
UpdateClusterConfigRequest configRequest = configRequest(props, ctx, changes, current);
|
||||
UpgradePolicy unstoredPolicy = unstoredPolicy(props, ctx, changes, current);
|
||||
updateTagsInPlace(r, props, ctx, live.getArn(), live.getTags(), live.getName(), TAG_KEYS_ATTR, SNAPSHOT_ATTR,
|
||||
() -> publish(r, live), true, snapshot -> {
|
||||
snapshot.put("name", live.getName());
|
||||
@@ -262,9 +266,28 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
if (configRequest != null) {
|
||||
eksService.updateClusterConfig(live.getName(), configRequest);
|
||||
}
|
||||
if (unstoredPolicy != null) {
|
||||
eksService.restoreClusterConfig(live.getName(), null, null, null, unstoredPolicy);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The policy an unchanged template declares for a cluster created before Floci kept the policy, whose create
|
||||
* therefore never stored it, or null. It is written as that create would have written it, without
|
||||
* UpdateClusterConfig's rules, and stays when the update rolls back. A changed policy goes through
|
||||
* UpdateClusterConfig instead, and a cluster that holds a policy keeps it, as one changed outside the stack does.
|
||||
*/
|
||||
private static UpgradePolicy unstoredPolicy(JsonNode props, ProvisionContext ctx, PropertyChanges changes,
|
||||
Cluster live) {
|
||||
if (live.hasStoredUpgradePolicy() || changed(changes, "UpgradePolicy")) {
|
||||
return null;
|
||||
}
|
||||
UpgradePolicy declared = createSetting(props, "UpgradePolicy", ctx, new TypeReference<>() { });
|
||||
return declared == null || !UpgradePolicy.SUPPORT_TYPES.contains(declared.supportType())
|
||||
|| declared.supportType().equals(live.getUpgradePolicy().supportType()) ? null : declared;
|
||||
}
|
||||
|
||||
/**
|
||||
* Nothing create-only changed on the in-place path, so every other property the engine reports
|
||||
* as added, changed or dropped is one EksService has no call to apply: it is accepted with a
|
||||
@@ -345,7 +368,8 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
/**
|
||||
* The UpdateClusterConfig request for the families whose changed template value differs from the live
|
||||
* cluster, or null when none does. A member the template dropped is read as its AWS default: public access
|
||||
* on, private access off, every address allowed and no log type exported; floci applies that default itself.
|
||||
* on, private access off, every address allowed, no log type exported and extended support; floci applies that
|
||||
* default itself.
|
||||
* A dropped AuthenticationMode asks for nothing, as a mode cannot be moved back. The subnet and security
|
||||
* group lists go along as the template has them, a dropped list counting as an empty one, so the service
|
||||
* refuses one that differs from the live cluster's.
|
||||
@@ -355,6 +379,7 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
ResourcesVpcConfig vpc = null;
|
||||
Logging logging = null;
|
||||
AccessConfig access = null;
|
||||
UpgradePolicy upgradePolicy = null;
|
||||
ResourcesVpcConfig current = live.getResourcesVpcConfig();
|
||||
if (changed(changes, "ResourcesVpcConfig") && current != null) {
|
||||
ResourcesVpcConfig desired = createSetting(props, "ResourcesVpcConfig", ctx, new TypeReference<>() { });
|
||||
@@ -404,8 +429,16 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
access = new AccessConfig(desired.authenticationMode(), null);
|
||||
}
|
||||
}
|
||||
return vpc == null && logging == null && access == null ? null
|
||||
: new UpdateClusterConfigRequest(vpc, logging, access, null);
|
||||
if (changed(changes, "UpgradePolicy")) {
|
||||
UpgradePolicy desired = createSetting(props, "UpgradePolicy", ctx, new TypeReference<>() { });
|
||||
String supportType = desired == null || desired.supportType() == null
|
||||
? UpgradePolicy.EXTENDED : desired.supportType();
|
||||
if (!supportType.equals(live.getUpgradePolicy().supportType())) {
|
||||
upgradePolicy = new UpgradePolicy(supportType);
|
||||
}
|
||||
}
|
||||
return vpc == null && logging == null && access == null && upgradePolicy == null ? null
|
||||
: new UpdateClusterConfigRequest(vpc, logging, access, upgradePolicy, null);
|
||||
}
|
||||
|
||||
private static boolean changed(PropertyChanges changes, String name) {
|
||||
@@ -442,6 +475,9 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
&& live.getAccessConfig().authenticationMode() != null) {
|
||||
snapshot.put("authenticationMode", live.getAccessConfig().authenticationMode());
|
||||
}
|
||||
if (request.upgradePolicy() != null) {
|
||||
snapshot.set("upgradePolicy", MAPPER.valueToTree(live.getUpgradePolicy()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,11 +499,14 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
|
||||
snapshot.path("touched").forEach(key -> touched.add(key.asText()));
|
||||
converge(CfnRollback.snapshotText(snapshot, "arn"), CfnRollback.snapshotTags(snapshot), touched);
|
||||
String name = CfnRollback.snapshotText(snapshot, "name");
|
||||
if (name != null && (snapshot.has("endpoint") || snapshot.has("logging") || snapshot.has("authenticationMode"))) {
|
||||
if (name != null && (snapshot.has("endpoint") || snapshot.has("logging") || snapshot.has("authenticationMode")
|
||||
|| snapshot.has("upgradePolicy"))) {
|
||||
eksService.restoreClusterConfig(name,
|
||||
snapshot.has("endpoint") ? MAPPER.convertValue(snapshot.get("endpoint"), ResourcesVpcConfig.class) : null,
|
||||
snapshot.has("logging") ? MAPPER.convertValue(snapshot.get("logging"), Logging.class) : null,
|
||||
snapshot.has("authenticationMode") ? snapshot.get("authenticationMode").asText() : null);
|
||||
snapshot.has("authenticationMode") ? snapshot.get("authenticationMode").asText() : null,
|
||||
snapshot.has("upgradePolicy")
|
||||
? MAPPER.convertValue(snapshot.get("upgradePolicy"), UpgradePolicy.class) : null);
|
||||
}
|
||||
Ec2Tags.restoreRecord(r, keysAttr, snapshot);
|
||||
}
|
||||
|
||||
@@ -61,9 +61,10 @@ public class EksController {
|
||||
+ "aws(?::|%3[aA])cluster-access-policy(?:/|%2[fF])[^/]+";
|
||||
|
||||
|
||||
private static final List<String> UPDATE_CONFIG_FAMILIES = List.of("resourcesVpcConfig", "logging", "accessConfig");
|
||||
private static final List<String> UPDATE_CONFIG_FAMILIES =
|
||||
List.of("resourcesVpcConfig", "logging", "accessConfig", "upgradePolicy");
|
||||
private static final Set<String> UPDATE_CONFIG_MEMBERS =
|
||||
Set.of("name", "clientRequestToken", "resourcesVpcConfig", "logging", "accessConfig");
|
||||
Set.of("name", "clientRequestToken", "resourcesVpcConfig", "logging", "accessConfig", "upgradePolicy");
|
||||
|
||||
private final EksService eksService;
|
||||
private final EksAccessEntryService accessEntries;
|
||||
|
||||
@@ -57,6 +57,7 @@ import io.floci.aws.services.eks.model.StorageConfig;
|
||||
import io.floci.aws.services.eks.model.Update;
|
||||
import io.floci.aws.services.eks.model.UpdateClusterConfigRequest;
|
||||
import io.floci.aws.services.eks.model.UpdateParam;
|
||||
import io.floci.aws.services.eks.model.UpgradePolicy;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.PreDestroy;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
@@ -808,6 +809,9 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
throw new AwsException("InvalidParameterException", "Invalid authenticationMode", 400);
|
||||
}
|
||||
validateAutoMode(request.getComputeConfig(), request.getStorageConfig(), request.getKubernetesNetworkConfig());
|
||||
UpgradePolicy requestedPolicy = request.getUpgradePolicy();
|
||||
UpgradePolicy upgradePolicy = requestedPolicy == null || requestedPolicy.supportType() == null
|
||||
? UpgradePolicy.DEFAULT : new UpgradePolicy(requireSupportType(requestedPolicy.supportType()));
|
||||
AccessConfig accessConfig = new AccessConfig(authenticationMode,
|
||||
requestedAccess == null || requestedAccess.bootstrapClusterCreatorAdminPermissions() == null
|
||||
|| requestedAccess.bootstrapClusterCreatorAdminPermissions());
|
||||
@@ -821,6 +825,7 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
cluster.setAccessConfig(accessConfig);
|
||||
cluster.setComputeConfig(request.getComputeConfig());
|
||||
cluster.setStorageConfig(request.getStorageConfig());
|
||||
cluster.setUpgradePolicy(upgradePolicy);
|
||||
cluster.setArn(arn);
|
||||
cluster.setAccountId(accountId);
|
||||
cluster.setCreatedAt(Instant.now());
|
||||
@@ -845,6 +850,11 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
cluster.setVersion(DEFAULT_K8S_VERSION);
|
||||
cluster.setExplicitVersion(false);
|
||||
}
|
||||
if (UpgradePolicy.STANDARD.equals(upgradePolicy.supportType()) && !inStandardSupport(cluster)) {
|
||||
throw new AwsException("InvalidParameterException", "The requested Kubernetes version \""
|
||||
+ cluster.getVersion() + "\" is only supported under extended support. Please change the "
|
||||
+ "supportType to extended support to create the cluster.", 400);
|
||||
}
|
||||
|
||||
cluster.setRoleArn(request.getRoleArn());
|
||||
|
||||
@@ -1042,9 +1052,10 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
Map.of("CONFIG_MAP", 0, "API_AND_CONFIG_MAP", 1, "API", 2);
|
||||
|
||||
/**
|
||||
* UpdateClusterConfig for {@code resourcesVpcConfig} endpoint access, {@code logging} and
|
||||
* {@code accessConfig.authenticationMode}. AWS accepts more members and lets the subnets and security
|
||||
* groups change; floci applies these three families and refuses a different subnet or security group list.
|
||||
* UpdateClusterConfig for {@code resourcesVpcConfig} endpoint access, {@code logging},
|
||||
* {@code accessConfig.authenticationMode} and {@code upgradePolicy}. AWS accepts more members and lets the subnets
|
||||
* and security groups change; floci applies these four families and refuses a different subnet or security group
|
||||
* list.
|
||||
* Each family the request names is stored as its own {@link Update} and all are returned in order. The
|
||||
* REST endpoint refuses a request naming more than one family, as EKS does, so it returns the only one. The
|
||||
* request is kept with the first update, and a repeat of its {@code clientRequestToken} returns that update.
|
||||
@@ -1054,9 +1065,9 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
Cluster cluster = requireClusterInRequestRegion(name);
|
||||
EksAddonService.requireActiveCluster(cluster);
|
||||
if (request == null || (request.resourcesVpcConfig() == null && request.logging() == null
|
||||
&& request.accessConfig() == null)) {
|
||||
&& request.accessConfig() == null && request.upgradePolicy() == null)) {
|
||||
throw new AwsException("InvalidParameterException",
|
||||
"UpdateClusterConfig supports resourcesVpcConfig, logging and accessConfig only", 400);
|
||||
"UpdateClusterConfig supports resourcesVpcConfig, logging, accessConfig and upgradePolicy only", 400);
|
||||
}
|
||||
String token = request.clientRequestToken();
|
||||
if (token != null && !token.isBlank()) {
|
||||
@@ -1104,6 +1115,14 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
if (requestedMode != null) {
|
||||
requireForwardAuthenticationMode(mode, requestedMode);
|
||||
}
|
||||
String requestedSupportType = request.upgradePolicy() == null || request.upgradePolicy().supportType() == null
|
||||
? null : requireSupportType(request.upgradePolicy().supportType());
|
||||
// Extended support can be turned on at any time, and off only while the version is in standard support.
|
||||
if (UpgradePolicy.STANDARD.equals(requestedSupportType) && !inStandardSupport(cluster)) {
|
||||
throw new AwsException("InvalidParameterException", "The Kubernetes version \"" + cluster.getVersion()
|
||||
+ "\" is not in standard support. Please update the cluster to a version in standard support to "
|
||||
+ "change the supportType", 400);
|
||||
}
|
||||
|
||||
Boolean finalPublicAccess = publicAccess;
|
||||
Boolean finalPrivateAccess = privateAccess;
|
||||
@@ -1139,13 +1158,20 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
List.of(new UpdateParam("AuthenticationMode", requestedMode)), null,
|
||||
updates.isEmpty() ? request : null));
|
||||
}
|
||||
if (requestedSupportType != null) {
|
||||
UpgradePolicy policy = new UpgradePolicy(requestedSupportType);
|
||||
current.setUpgradePolicy(policy);
|
||||
updates.add(addons.recordUpdate(current, "UpgradePolicyUpdate",
|
||||
List.of(new UpdateParam("UpgradePolicy", json(policy))), null,
|
||||
updates.isEmpty() ? request : null));
|
||||
}
|
||||
});
|
||||
if (!saved[0]) {
|
||||
throw new AwsException("ResourceNotFoundException", "No cluster found for name: " + name, 404);
|
||||
}
|
||||
if (updates.isEmpty()) {
|
||||
throw new AwsException("InvalidParameterException",
|
||||
"UpdateClusterConfig supports resourcesVpcConfig, logging and accessConfig.authenticationMode only", 400);
|
||||
throw new AwsException("InvalidParameterException", "UpdateClusterConfig supports resourcesVpcConfig, "
|
||||
+ "logging, accessConfig.authenticationMode and upgradePolicy.supportType only", 400);
|
||||
}
|
||||
LOG.infov("Updated the configuration of EKS cluster {0}: {1}", cluster.getName(),
|
||||
updates.stream().map(Update::type).toList());
|
||||
@@ -1165,7 +1191,8 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
&& Objects.equals(a.getEndpointPrivateAccess(), b.getEndpointPrivateAccess())
|
||||
&& Objects.equals(a.getPublicAccessCidrs(), b.getPublicAccessCidrs());
|
||||
return sameVpc && Objects.equals(existing.logging(), request.logging())
|
||||
&& Objects.equals(existing.accessConfig(), request.accessConfig());
|
||||
&& Objects.equals(existing.accessConfig(), request.accessConfig())
|
||||
&& Objects.equals(existing.upgradePolicy(), request.upgradePolicy());
|
||||
}
|
||||
|
||||
/** The cluster's current settings with the request applied on top, in the shape createCluster validates. */
|
||||
@@ -1191,7 +1218,7 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
* authentication mode backwards, which UpdateClusterConfig refuses.
|
||||
*/
|
||||
public synchronized void restoreClusterConfig(String name, ResourcesVpcConfig endpoint, Logging logging,
|
||||
String authenticationMode) {
|
||||
String authenticationMode, UpgradePolicy upgradePolicy) {
|
||||
Cluster cluster = requireClusterInRequestRegion(name);
|
||||
saveClusterIfNotDeleting(regionResolver.getAccountId(), clusterKey(cluster), current -> {
|
||||
if (endpoint != null && current.getResourcesVpcConfig() != null) {
|
||||
@@ -1206,6 +1233,9 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
current.setAccessConfig(new AccessConfig(authenticationMode,
|
||||
current.getAccessConfig().bootstrapClusterCreatorAdminPermissions()));
|
||||
}
|
||||
if (upgradePolicy != null) {
|
||||
current.setUpgradePolicy(upgradePolicy);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1246,6 +1276,22 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the cluster's Kubernetes version is in standard support now. A cluster that named no version is: AWS gives
|
||||
* it a version in standard support, while Floci reports {@link #DEFAULT_K8S_VERSION} for it.
|
||||
*/
|
||||
private static boolean inStandardSupport(Cluster cluster) {
|
||||
return !cluster.isExplicitVersion() || EksVersionCalendar.inStandardSupport(cluster.getVersion(), Instant.now());
|
||||
}
|
||||
|
||||
private static String requireSupportType(String supportType) {
|
||||
if (!UpgradePolicy.SUPPORT_TYPES.contains(supportType)) {
|
||||
throw new AwsException("InvalidParameterException",
|
||||
"Invalid supportType '" + supportType + "'. Valid values: STANDARD | EXTENDED", 400);
|
||||
}
|
||||
return supportType;
|
||||
}
|
||||
|
||||
private static void requireForwardAuthenticationMode(String current, String requested) {
|
||||
Integer to = AUTHENTICATION_MODE_RANK.get(requested);
|
||||
if (to == null) {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package io.floci.aws.services.eks;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When each Kubernetes version Floci serves leaves Amazon EKS standard support, from the Amazon EKS Kubernetes release
|
||||
* calendar, whose dates are UTC. 1.28 to 1.30 have left the calendar since; their dates are the ones it gave them.
|
||||
*/
|
||||
final class EksVersionCalendar {
|
||||
|
||||
private static final Map<String, LocalDate> END_OF_STANDARD_SUPPORT = Map.of(
|
||||
"1.28", LocalDate.of(2024, 11, 26),
|
||||
"1.29", LocalDate.of(2025, 3, 23),
|
||||
"1.30", LocalDate.of(2025, 7, 23),
|
||||
"1.31", LocalDate.of(2025, 11, 26),
|
||||
"1.32", LocalDate.of(2026, 3, 23),
|
||||
"1.33", LocalDate.of(2026, 7, 29),
|
||||
"1.34", LocalDate.of(2026, 12, 2),
|
||||
"1.35", LocalDate.of(2027, 3, 27),
|
||||
"1.36", LocalDate.of(2027, 8, 2),
|
||||
"1.37", LocalDate.of(2027, 12, 1));
|
||||
|
||||
private EksVersionCalendar() {
|
||||
}
|
||||
|
||||
/** Whether {@code version} is in standard support at {@code now}. A version the calendar does not list yet is. */
|
||||
static boolean inStandardSupport(String version, Instant now) {
|
||||
LocalDate end = END_OF_STANDARD_SUPPORT.get(version);
|
||||
return end == null || now.isBefore(end.atStartOfDay(ZoneOffset.UTC).toInstant());
|
||||
}
|
||||
}
|
||||
@@ -158,6 +158,17 @@ public class Cluster {
|
||||
@JsonProperty("storageConfig")
|
||||
private StorageConfig storageConfig;
|
||||
|
||||
@JsonProperty("upgradePolicy")
|
||||
private UpgradePolicy upgradePolicy;
|
||||
|
||||
/** A cluster stored before Floci kept the policy reports EKS's default, which existing clusters were given too. */
|
||||
public UpgradePolicy getUpgradePolicy() { return upgradePolicy == null ? UpgradePolicy.DEFAULT : upgradePolicy; }
|
||||
public void setUpgradePolicy(UpgradePolicy upgradePolicy) { this.upgradePolicy = upgradePolicy; }
|
||||
|
||||
/** Whether the cluster holds a policy of its own, which one stored before Floci kept the policy does not. */
|
||||
@JsonIgnore
|
||||
public boolean hasStoredUpgradePolicy() { return upgradePolicy != null; }
|
||||
|
||||
public AccessConfig getAccessConfig() { return accessConfig; }
|
||||
public void setAccessConfig(AccessConfig accessConfig) { this.accessConfig = accessConfig; }
|
||||
|
||||
@@ -305,6 +316,7 @@ public class Cluster {
|
||||
c.accessConfig = this.accessConfig;
|
||||
c.computeConfig = this.computeConfig;
|
||||
c.storageConfig = this.storageConfig;
|
||||
c.upgradePolicy = this.upgradePolicy;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,12 @@ public class CreateClusterRequest {
|
||||
@JsonProperty("storageConfig")
|
||||
private StorageConfig storageConfig;
|
||||
|
||||
@JsonProperty("upgradePolicy")
|
||||
private UpgradePolicy upgradePolicy;
|
||||
|
||||
public UpgradePolicy getUpgradePolicy() { return upgradePolicy; }
|
||||
public void setUpgradePolicy(UpgradePolicy upgradePolicy) { this.upgradePolicy = upgradePolicy; }
|
||||
|
||||
public AccessConfig getAccessConfig() { return accessConfig; }
|
||||
public void setAccessConfig(AccessConfig accessConfig) { this.accessConfig = accessConfig; }
|
||||
|
||||
|
||||
@@ -12,5 +12,6 @@ public record UpdateClusterConfigRequest(
|
||||
ResourcesVpcConfig resourcesVpcConfig,
|
||||
Logging logging,
|
||||
AccessConfig accessConfig,
|
||||
UpgradePolicy upgradePolicy,
|
||||
String clientRequestToken
|
||||
) {}
|
||||
@@ -0,0 +1,21 @@
|
||||
package io.floci.aws.services.eks.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A cluster's version support policy: with {@code EXTENDED} its Kubernetes version enters extended support at the end
|
||||
* of standard support, with {@code STANDARD} the cluster is upgraded then instead.
|
||||
*/
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record UpgradePolicy(String supportType) {
|
||||
|
||||
public static final String STANDARD = "STANDARD";
|
||||
public static final String EXTENDED = "EXTENDED";
|
||||
public static final Set<String> SUPPORT_TYPES = Set.of(STANDARD, EXTENDED);
|
||||
/** The policy EKS gives new and existing clusters. */
|
||||
public static final UpgradePolicy DEFAULT = new UpgradePolicy(EXTENDED);
|
||||
}
|
||||
Reference in new issue
Block a user