From feb170d33e4728c36a22e6484fa3dd1884f887e2 Mon Sep 17 00:00:00 2001 From: avishagk Date: Thu, 19 Dec 2024 13:18:48 +0200 Subject: [PATCH 1/2] [src] - ocean gke - add scope field --- .../ocean/gke/paths/cluster-roll.yaml | 4 +- .../ocean/gke/paths/clusters-roll.yaml | 85 +++++++------------ .../{ => roll}/clusterRollGetAllResponse.yaml | 6 +- .../{ => roll}/initiate-clusterRoll.yaml | 4 + .../{ => roll}/update-clusterRoll.yaml | 4 + .../roll/roll-batchMinHealthyPercentage.yaml | 8 ++ .../roll/roll-batchSizePercentage.yaml | 7 ++ .../ocean/gke/schemas/roll/roll-comment.yaml | 7 ++ .../roll-disableLaunchSpecAutoScaling.yaml | 7 ++ .../gke/schemas/roll/roll-instanceIds.yaml | 11 +++ .../gke/schemas/roll/roll-launchSpecIds.yaml | 11 +++ .../gke/schemas/roll/roll-respectPdb.yaml | 8 ++ 12 files changed, 106 insertions(+), 56 deletions(-) rename api/services/ocean/gke/responses/{ => roll}/clusterRollGetAllResponse.yaml (93%) rename api/services/ocean/gke/responses/{ => roll}/initiate-clusterRoll.yaml (94%) rename api/services/ocean/gke/responses/{ => roll}/update-clusterRoll.yaml (93%) create mode 100644 api/services/ocean/gke/schemas/roll/roll-batchMinHealthyPercentage.yaml create mode 100644 api/services/ocean/gke/schemas/roll/roll-batchSizePercentage.yaml create mode 100644 api/services/ocean/gke/schemas/roll/roll-comment.yaml create mode 100644 api/services/ocean/gke/schemas/roll/roll-disableLaunchSpecAutoScaling.yaml create mode 100644 api/services/ocean/gke/schemas/roll/roll-instanceIds.yaml create mode 100644 api/services/ocean/gke/schemas/roll/roll-launchSpecIds.yaml create mode 100644 api/services/ocean/gke/schemas/roll/roll-respectPdb.yaml diff --git a/api/services/ocean/gke/paths/cluster-roll.yaml b/api/services/ocean/gke/paths/cluster-roll.yaml index d5d8717ef..1807a52fa 100644 --- a/api/services/ocean/gke/paths/cluster-roll.yaml +++ b/api/services/ocean/gke/paths/cluster-roll.yaml @@ -34,7 +34,7 @@ put: example: STOPPED responses: 200: - $ref: "../responses/update-clusterRoll.yaml" + $ref: "../responses/roll/update-clusterRoll.yaml" 400: description: "Bad Request" @@ -51,6 +51,6 @@ get: - $ref: "../parameters/clusterRollId.yaml" responses: 200: - $ref: "../responses/initiate-clusterRoll.yaml" + $ref: "../responses/roll/initiate-clusterRoll.yaml" 400: description: "Bad Request" diff --git a/api/services/ocean/gke/paths/clusters-roll.yaml b/api/services/ocean/gke/paths/clusters-roll.yaml index 21a4c72de..b4ca100d1 100644 --- a/api/services/ocean/gke/paths/clusters-roll.yaml +++ b/api/services/ocean/gke/paths/clusters-roll.yaml @@ -19,61 +19,40 @@ post: content: application/json: schema: - type: object - properties: - roll: - type: object - description: > - Settings for roll operation + oneOf: + - type: object + title: 'Roll' properties: - batchSizePercentage: - type: integer - description: > - Value in % to set the size of the batches in the roll. Valid values are 0-100 - example: 20 - comment: - description: > - Add a breif description or comment about the roll. The comment should be limited to 256 chars. - type: string - example: "This is why I deployed my cluster." - respectPdb: - type: boolean - example: true - default: false - description: > - During the roll, if the parameter is set to true we honor PDB during the instance replacement. - 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 - default: 50 - launchSpecIds: - type: array - description: > - List of virtual node group identifiers to be rolled. - Each identifier is a string. Can be null. - Cannot be used together with instanceName. - items: - type: string - example: - - ols-76694a7d - - ols-56694a76 - instanceNames: - type: array - description: > - List of instance names to be rolled. - Each name is a string. - instanceNames can be null. - Cannot be used together with launchSpecIds. - items: - type: string - example: - - i-0003a99ffb566f039 - - i-0567a99ffb566f765 + roll: + allOf: + - $ref: "../schemas/roll/roll-batchSizePercentage.yaml" + - $ref: "../schemas/roll/roll-comment.yaml" + - $ref: "../schemas/roll/roll-respectPdb.yaml" + - $ref: "../schemas/roll/roll-batchMinHealthyPercentage.yaml" + - type: object + title: 'Roll with instance ids' + properties: + roll: + allOf: + - $ref: "../schemas/roll/roll-batchSizePercentage.yaml" + - $ref: "../schemas/roll/roll-comment.yaml" + - $ref: "../schemas/roll/roll-respectPdb.yaml" + - $ref: "../schemas/roll/roll-batchMinHealthyPercentage.yaml" + - $ref: "../schemas/roll/roll-instanceIds.yaml" + - type: object + title: 'Roll with Virtual Node Group ids' + properties: + roll: + allOf: + - $ref: "../schemas/roll/roll-batchSizePercentage.yaml" + - $ref: "../schemas/roll/roll-comment.yaml" + - $ref: "../schemas/roll/roll-respectPdb.yaml" + - $ref: "../schemas/roll/roll-batchMinHealthyPercentage.yaml" + - $ref: "../schemas/roll/roll-launchSpecIds.yaml" + - $ref: "../schemas/roll/roll-disableLaunchSpecAutoScaling.yaml" responses: 200: - $ref: "../responses/initiate-clusterRoll.yaml" + $ref: "../responses/roll/initiate-clusterRoll.yaml" 400: description: "Bad Request" @@ -89,6 +68,6 @@ get: - $ref: "../parameters/oceanId.yaml" responses: 200: - $ref: "../responses/clusterRollGetAllResponse.yaml" + $ref: "../responses/roll/clusterRollGetAllResponse.yaml" 400: description: "Bad Request" diff --git a/api/services/ocean/gke/responses/clusterRollGetAllResponse.yaml b/api/services/ocean/gke/responses/roll/clusterRollGetAllResponse.yaml similarity index 93% rename from api/services/ocean/gke/responses/clusterRollGetAllResponse.yaml rename to api/services/ocean/gke/responses/roll/clusterRollGetAllResponse.yaml index 22087daf2..428c49006 100644 --- a/api/services/ocean/gke/responses/clusterRollGetAllResponse.yaml +++ b/api/services/ocean/gke/responses/roll/clusterRollGetAllResponse.yaml @@ -25,6 +25,10 @@ content: id: type: string example: scr-5aaf854e + scope: + type: string + enum: [ Cluster, Vngs, Vng, Instances, Instance ] + example: Cluster status: type: string example: IN_PROGRESS @@ -89,4 +93,4 @@ content: example: 2019-03-24T15:46:09.000Z updatedAt: type: string - example: 2019-03-24T15:46:09.000Z + example: 2019-03-24T15:46:09.000Z \ No newline at end of file diff --git a/api/services/ocean/gke/responses/initiate-clusterRoll.yaml b/api/services/ocean/gke/responses/roll/initiate-clusterRoll.yaml similarity index 94% rename from api/services/ocean/gke/responses/initiate-clusterRoll.yaml rename to api/services/ocean/gke/responses/roll/initiate-clusterRoll.yaml index 7250396c3..1a9df0d96 100644 --- a/api/services/ocean/gke/responses/initiate-clusterRoll.yaml +++ b/api/services/ocean/gke/responses/roll/initiate-clusterRoll.yaml @@ -10,6 +10,10 @@ content: oceanId: type: string example: o-12e31234 + scope: + type: string + enum: [ Cluster, Vngs, Vng, Instances, Instance ] + example: Cluster status: type: string example: IN_PROGRESS diff --git a/api/services/ocean/gke/responses/update-clusterRoll.yaml b/api/services/ocean/gke/responses/roll/update-clusterRoll.yaml similarity index 93% rename from api/services/ocean/gke/responses/update-clusterRoll.yaml rename to api/services/ocean/gke/responses/roll/update-clusterRoll.yaml index 998aee565..f68f2ae19 100644 --- a/api/services/ocean/gke/responses/update-clusterRoll.yaml +++ b/api/services/ocean/gke/responses/roll/update-clusterRoll.yaml @@ -17,6 +17,10 @@ content: numOfBatches: type: integer example: 5 + scope: + type: string + enum: [ Cluster, Vngs, Vng, Instances, Instance ] + example: Cluster progress: type: object properties: diff --git a/api/services/ocean/gke/schemas/roll/roll-batchMinHealthyPercentage.yaml b/api/services/ocean/gke/schemas/roll/roll-batchMinHealthyPercentage.yaml new file mode 100644 index 000000000..5edac0ff2 --- /dev/null +++ b/api/services/ocean/gke/schemas/roll/roll-batchMinHealthyPercentage.yaml @@ -0,0 +1,8 @@ +type: object +properties: + 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 + default: 50 diff --git a/api/services/ocean/gke/schemas/roll/roll-batchSizePercentage.yaml b/api/services/ocean/gke/schemas/roll/roll-batchSizePercentage.yaml new file mode 100644 index 000000000..55253dcd8 --- /dev/null +++ b/api/services/ocean/gke/schemas/roll/roll-batchSizePercentage.yaml @@ -0,0 +1,7 @@ +type: object +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 diff --git a/api/services/ocean/gke/schemas/roll/roll-comment.yaml b/api/services/ocean/gke/schemas/roll/roll-comment.yaml new file mode 100644 index 000000000..eb1183997 --- /dev/null +++ b/api/services/ocean/gke/schemas/roll/roll-comment.yaml @@ -0,0 +1,7 @@ +type: object +properties: + comment: + type: string + description: > + Add a comment description for the roll. The comment is limited to 256 chars. + example: "This is why I deployed my cluster." diff --git a/api/services/ocean/gke/schemas/roll/roll-disableLaunchSpecAutoScaling.yaml b/api/services/ocean/gke/schemas/roll/roll-disableLaunchSpecAutoScaling.yaml new file mode 100644 index 000000000..3e147d541 --- /dev/null +++ b/api/services/ocean/gke/schemas/roll/roll-disableLaunchSpecAutoScaling.yaml @@ -0,0 +1,7 @@ +type: object +properties: + disableLaunchSpecAutoScaling: + type: boolean + description: > + When set to True and virtual node group identifiers are defined to roll, the specified Virtual Node Group(s) will be blocked from scaling up. (Replacements will scale up in other Virtual Node Groups that match the displaced pods instead.) This is meant for different use cases of 'migrating' nodes from one Virtual Node Group to another. + example: true diff --git a/api/services/ocean/gke/schemas/roll/roll-instanceIds.yaml b/api/services/ocean/gke/schemas/roll/roll-instanceIds.yaml new file mode 100644 index 000000000..670c01199 --- /dev/null +++ b/api/services/ocean/gke/schemas/roll/roll-instanceIds.yaml @@ -0,0 +1,11 @@ +type: object +properties: + instanceIds: + type: array + description: > + List of instance identifiers to be rolled. Each identifier is a string. InstanceIds can be null, and cannot be used together with launchSpecIds. + items: + type: string + example: + - i-0003a99ffb566f039 + - i-0567a99ffb566f765 diff --git a/api/services/ocean/gke/schemas/roll/roll-launchSpecIds.yaml b/api/services/ocean/gke/schemas/roll/roll-launchSpecIds.yaml new file mode 100644 index 000000000..acbf131b0 --- /dev/null +++ b/api/services/ocean/gke/schemas/roll/roll-launchSpecIds.yaml @@ -0,0 +1,11 @@ +type: object +properties: + launchSpecIds: + type: array + description: > + List of virtual node group identifiers to be rolled. Each identifier is a string. LaunchSpecIds can be null, and cannot be used together with instanceIds. + items: + type: string + example: + - ols-76694a7d + - ols-56694a76 diff --git a/api/services/ocean/gke/schemas/roll/roll-respectPdb.yaml b/api/services/ocean/gke/schemas/roll/roll-respectPdb.yaml new file mode 100644 index 000000000..e8b825af8 --- /dev/null +++ b/api/services/ocean/gke/schemas/roll/roll-respectPdb.yaml @@ -0,0 +1,8 @@ +type: object +properties: + 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 From 0c8d9deb32df548a928327cca7be79b2263228f7 Mon Sep 17 00:00:00 2001 From: avishagk Date: Wed, 25 Dec 2024 11:16:08 +0200 Subject: [PATCH 2/2] [src] - fix cr --- .../ocean/gke/schemas/roll/roll-batchMinHealthyPercentage.yaml | 2 +- .../ocean/gke/schemas/roll/roll-batchSizePercentage.yaml | 2 +- .../gke/schemas/roll/roll-disableLaunchSpecAutoScaling.yaml | 2 +- api/services/ocean/gke/schemas/roll/roll-respectPdb.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/services/ocean/gke/schemas/roll/roll-batchMinHealthyPercentage.yaml b/api/services/ocean/gke/schemas/roll/roll-batchMinHealthyPercentage.yaml index 5edac0ff2..b37fae026 100644 --- a/api/services/ocean/gke/schemas/roll/roll-batchMinHealthyPercentage.yaml +++ b/api/services/ocean/gke/schemas/roll/roll-batchMinHealthyPercentage.yaml @@ -3,6 +3,6 @@ properties: 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. + Indicates the threshold percentage of minimum healthy instances in a single batch. If the number is below the threshold, the cluster roll will fail. The parameter value has a range of 1-100 (default = 50%). example: 100 default: 50 diff --git a/api/services/ocean/gke/schemas/roll/roll-batchSizePercentage.yaml b/api/services/ocean/gke/schemas/roll/roll-batchSizePercentage.yaml index 55253dcd8..d076334dd 100644 --- a/api/services/ocean/gke/schemas/roll/roll-batchSizePercentage.yaml +++ b/api/services/ocean/gke/schemas/roll/roll-batchSizePercentage.yaml @@ -3,5 +3,5 @@ properties: batchSizePercentage: type: integer description: > - Value as a percent to set the size of a batch in a roll. Valid values are 0-100. + Value is a percentage to set the size of a batch in a roll. Valid values are 0-100. example: 20 diff --git a/api/services/ocean/gke/schemas/roll/roll-disableLaunchSpecAutoScaling.yaml b/api/services/ocean/gke/schemas/roll/roll-disableLaunchSpecAutoScaling.yaml index 3e147d541..b8a27f455 100644 --- a/api/services/ocean/gke/schemas/roll/roll-disableLaunchSpecAutoScaling.yaml +++ b/api/services/ocean/gke/schemas/roll/roll-disableLaunchSpecAutoScaling.yaml @@ -3,5 +3,5 @@ properties: disableLaunchSpecAutoScaling: type: boolean description: > - When set to True and virtual node group identifiers are defined to roll, the specified Virtual Node Group(s) will be blocked from scaling up. (Replacements will scale up in other Virtual Node Groups that match the displaced pods instead.) This is meant for different use cases of 'migrating' nodes from one Virtual Node Group to another. + When set to 'true' and virtual node group identifiers are defined to roll, the specified virtual node group(s) will be blocked from scaling up. Replacements will scale up in other virtual node groups that match the displaced pods instead. This applies to migrating nodes from one virtual node group to another. example: true diff --git a/api/services/ocean/gke/schemas/roll/roll-respectPdb.yaml b/api/services/ocean/gke/schemas/roll/roll-respectPdb.yaml index e8b825af8..953276ea7 100644 --- a/api/services/ocean/gke/schemas/roll/roll-respectPdb.yaml +++ b/api/services/ocean/gke/schemas/roll/roll-respectPdb.yaml @@ -3,6 +3,6 @@ properties: respectPdb: type: boolean description: > - During the roll, if the parameter is set to true we honor PDB during the instance replacement. + During the roll, if the parameter is set to 'true', PDB is honored during the instance replacement. example: true default: false