Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/con 21466/ami auto update #564

Merged
merged 23 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions api/services/ocean/aws/paths/amiAutoUpdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
put:
summary: "Initiate EKS AMI Auto Update"
description: |
Update the Ocean EKS cluster's VNGs with the latest image or the image matching the control plane's version after upgrading, by specifying ‘patch' or 'minorVersion’.
Performing this request will update the VNGs with new AMI if available, and run a cluster roll if set.
If the response is successful, the old and new AMIs will be included in the response along with the updated VNGs.
If a cluster roll is set in the request, the first response for a successful request will indicate the start of a roll.
In order to check the status of the roll, you can use the GET Roll API.
operationId: "oceanAwsAmiAutoUpdate"
tags:
- "Ocean AWS"
parameters:
- $ref: "../../commons/parameters/oceanClusterId.yaml"
- $ref: "../../../../commons/parameters/accountId.yaml"
requestBody:
required: true
content:
application/json:
schema:
allOf:
- $ref: "../schemas/amiAutoUpdate.yaml"
responses:
200:
$ref: "../responses/amiAutoUpdate.yaml"
400:
description: "Bad Request"
24 changes: 24 additions & 0 deletions api/services/ocean/aws/responses/amiAutoUpdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
description: EKS AMI Auto Update Response
content:
application/json:
schema:
allOf:
- $ref: "../../../../commons/schemas/responseItemWrapper.yaml"
- type: object
properties:
request:
type: object
properties:
url:
example: "/ocean/aws/eks/cluster/o-abcd1234/amiAutoUpdate"
method:
example: "PUT"
response:
type: object
properties:
items:
type: array
items:
$ref: "../schemas/amiAutoUpdateSummery.yaml"
kind:
example: "ocean:k8s:cluster:amiAutoUpdate:summary"
50 changes: 50 additions & 0 deletions api/services/ocean/aws/schemas/amiAutoUpdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
type: object
description: >
The object specifying the request to trigger an AMI auto update operation
title: AMI Auto Update
properties:
patch:
type: boolean
description: >
When set to 'true', the auto-update process will update the VNGs’ images with the latest security patches. Either "patch" or "minorVersion" must be true.
example: "true"
default: false
minorVersion:
type: boolean
example: "true"
default: false
description: >
When set to 'true', the auto-update process will update the VNGs’ AMI with the AMI to match the Kubernetes control plane version. Either "patch" or "minorVersion" must be true.
applyRoll:
type: boolean
example: "true"
default: false
description: >
This parameter is optional. When the AMI is updated according to the configuration set, a cluster roll can be triggered.
clusterRoll:
type: object
description: Cluster roll configuration.
properties:
batchSizePercentage:
type: integer
description: Value as a percent to set the size of a batch in a roll. Valid values are 0-100.
example: 20
batchMinHealthyPercentage:
type: integer
description: Indicates the threshold of minimum healthy instances in single batch. If the amount of healthy instances in single batch is under the threshold, the cluster roll will fail. If exists, the parameter value will be in range of 1-100. In case of null as value, the default value in the backend will be 50%. Value of param should represent the number in percentage (%) of the batch.
example: 100
minimum: 1
maximum: 100
default: 50
comment:
type: string
description: >
Add a brief description for the roll. The comment is limited to 256 chars.
example: "This is why I rolled my cluster."
respectPdb:
type: boolean
description: >
During the roll, if the parameter is set to true we honor PDB during the instance replacement.
example: true
default: false

42 changes: 42 additions & 0 deletions api/services/ocean/aws/schemas/amiAutoUpdateData.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
type: object
description: >
Launch spec AMI auto update details
properties:
vngId:
type: string
readOnly: true
example: default
description: |
The Virtual Node Group Identifier.
vngName:
type: string
readOnly: true
example: default
description: |
The Virtual Node Group name.
status:
type: string
readOnly: true
example: UPDATE_SUCCEEDED
description: |
The AMI update result.
enum: [ NO_UPDATE_REQUIRED, UPDATE_SUCCEEDED, UPDATE_REQUIRED_BUT_FAILED, FAILED ]
updateType:
type: string
readOnly: true
example: MINOR
description: |
Virtual Node Group's AMI update type.
enum: [ MINOR, PATCH ]
oldAmiId:
type: string
readOnly: true
example: ami-00cd348996bfd7ba8
description: |
The ID of the old AMI that was replaced.
newAmiId:
type: string
readOnly: true
example: ami-019e5b81636e5a350
description: |
The ID of the new AMI that is being used for the VNG.
42 changes: 42 additions & 0 deletions api/services/ocean/aws/schemas/amiAutoUpdateSummery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
type: object
description: >
Response indicating AMI updated for each cluster's Virtual Node Groups
title: AMI Auto Update Response
properties:
oceanId:
type: string
readOnly: true
example: o-134abcd
description: |
Ocean cluster identifier.
status:
type: string
description: >
Ami update result.
enum: [ Success, Failed ]
data:
type: array
items:
$ref: "amiAutoUpdateData.yaml"
rollId:
type: string
readOnly: true
example: scr-752331b9
description: |
The ID of the triggered cluster roll.
createdAt:
type: string
readOnly: true
example: 2024-01-02T09:57:09.211Z
description: |
The AMI update method was triggered at this time.
updatedAt:
type: string
readOnly: true
example: 2024-01-02T09:57:09.211Z
description: |
The AMI update method was triggered at this time.




62 changes: 58 additions & 4 deletions api/services/ocean/aws/schemas/ocean-scheduling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ properties:
title: Task Definition
required:
- isEnabled
- cronExpression
- taskType
properties:
isEnabled:
Expand All @@ -25,15 +24,18 @@ properties:
A valid cron expression.
For example : " * * * * * ".
The cron job runs in UTC time and is in Unix cron format. (See the Cron Expression Validator Script.)
Only one of ‘frequency' or ‘cronExpression' can be used at a time.
Required field for taskType "clusterRoll", optional field for taskType "amiAutoUpdate".
taskType:
type: string
example: clusterRoll
enum: ["clusterRoll"]
enum: ["clusterRoll", "amiAutoUpdate"]
description: >
The activity that you are scheduling. Valid values: "clusterRoll". Required for cluster.scheduling.tasks.
The activity that you are scheduling. Valid values: "clusterRoll", "amiAutoUpdate". Required for cluster.scheduling.tasks.
parameters:
type: object
description: |
This field will be compatible to the task type field.
If taskType is defined as "clusterRoll", use cluster roll object in parameters.
properties:
clusterRoll:
type: object
Expand Down Expand Up @@ -64,6 +66,58 @@ properties:
During the roll, if the parameter is set to true we honor PDB during the instance replacement.
example: true
default: false
amiAutoUpdate:
type: object
properties:
patch:
type: boolean
description: >
When set to 'true', the auto-update process will update the VNGs’ images with the latest security patches.
either "patch" or "minorVersion" must be true.
example: "true"
default: false
minorVersion:
type: boolean
example: "true"
default: false
description: >
When set to 'true', the auto-update process will update the VNGs’ AMI with the AMI to match the Kubernetes control plane version.
either "patch" or "minorVersion" must be true.
applyRoll:
type: boolean
example: "true"
default: false
description: >
This parameter is optional. When the AMI is updated according to the configuration set, a cluster roll can be triggered.
clusterRoll:
type: object
properties:
batchSizePercentage:
type: integer
minimum: 0
maximum: 100
example: 20
description: >
Value as a percent to set the size of a batch in a roll. Valid values are 0-100.
comment:
type: string
example: This is why I deployed my cluster.
description: >
Add a comment description for the roll. The comment is limited to 256 chars
batchMinHealthyPercentage:
type: integer
minimum: 1
maximum: 100
default: 50
example: 100
description: >
Indicates the threshold of minimum healthy instances in single batch. If the amount of healthy instances in single batch is under the threshold, the cluster roll will fail. If exists, the parameter value will be in range of 1-100. In case of null as value, the default value in the backend will be 50%. Value of param should represent the number in percentage (%) of the batch.
respectPdb:
type: boolean
description: >
During the roll, if the parameter is set to true we honor PDB during the instance replacement.
example: true
default: false
shutdownHours:
type: object
description: >
Expand Down
2 changes: 2 additions & 0 deletions api/spot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ paths:
$ref: services/ocean/aws/paths/cluster-aggregated-costs.yaml
/ocean/aws/k8s/cluster/{oceanClusterId}/aggregatedCosts/summary:
$ref: services/ocean/aws/paths/cluster-aggregated-costs-summary.yaml
/ocean/aws/k8s/cluster/{oceanClusterId}/amiAutoUpdate:
$ref: services/ocean/aws/paths/amiAutoUpdate.yaml
/ocean/aws/k8s/launchSpec:
$ref: services/ocean/aws/paths/clusters-launchSpec.yaml
/ocean/aws/k8s/launchSpec/{oceanLaunchSpecId}:
Expand Down
Loading