From 067d36a87ac89db117c6acc784cfe4665275f763 Mon Sep 17 00:00:00 2001 From: Anurag Sharma Date: Tue, 12 Dec 2023 04:00:11 +0530 Subject: [PATCH 1/2] Initial changes --- api/services/ocean/gke/paths/cluster.yaml | 2 +- api/services/ocean/gke/paths/clusters.yaml | 2 +- api/services/ocean/gke/responses/ocean.yaml | 2 +- .../ocean/gke/responses/oceanGkeGet.yaml | 2 +- .../ocean/gke/responses/oceanGkeList.yaml | 2 +- .../gke/responses/oceanGkeUpdateResponse.yaml | 2 +- .../gke/schemas/oceanCluster-create.yaml | 72 +++++++++++++++++++ .../gke/schemas/oceanCluster-update.yaml | 65 +++++++++++++++++ .../ocean/gke/schemas/oceanCluster.yaml | 67 ----------------- .../gke/schemas/oceanClusterWrapper.yaml | 6 -- .../gke/schemas/oceanGkeImportRequest.yaml | 1 - 11 files changed, 143 insertions(+), 80 deletions(-) create mode 100644 api/services/ocean/gke/schemas/oceanCluster-create.yaml create mode 100644 api/services/ocean/gke/schemas/oceanCluster-update.yaml delete mode 100644 api/services/ocean/gke/schemas/oceanCluster.yaml delete mode 100644 api/services/ocean/gke/schemas/oceanClusterWrapper.yaml diff --git a/api/services/ocean/gke/paths/cluster.yaml b/api/services/ocean/gke/paths/cluster.yaml index c476ef8eb..a9c99ac08 100644 --- a/api/services/ocean/gke/paths/cluster.yaml +++ b/api/services/ocean/gke/paths/cluster.yaml @@ -48,7 +48,7 @@ put: application/json: schema: allOf: - - $ref: "../schemas/oceanClusterWrapper.yaml" + - $ref: "../schemas/oceanCluster-update.yaml" responses: 200: $ref: "../responses/oceanGkeUpdateResponse.yaml" diff --git a/api/services/ocean/gke/paths/clusters.yaml b/api/services/ocean/gke/paths/clusters.yaml index 953d330a1..44fe02935 100644 --- a/api/services/ocean/gke/paths/clusters.yaml +++ b/api/services/ocean/gke/paths/clusters.yaml @@ -35,7 +35,7 @@ post: application/json: schema: allOf: - - $ref: "../schemas/oceanClusterWrapper.yaml" + - $ref: "../schemas/oceanCluster-create.yaml" - type: "object" properties: cluster: diff --git a/api/services/ocean/gke/responses/ocean.yaml b/api/services/ocean/gke/responses/ocean.yaml index 0fa5b9b60..8685e5fd0 100644 --- a/api/services/ocean/gke/responses/ocean.yaml +++ b/api/services/ocean/gke/responses/ocean.yaml @@ -19,6 +19,6 @@ content: items: type: array items: - $ref: "../schemas/oceanCluster.yaml" + $ref: "../schemas/oceanCluster-create.yaml" kind: example: "spotinst:ocean:gcp:k8s" \ No newline at end of file diff --git a/api/services/ocean/gke/responses/oceanGkeGet.yaml b/api/services/ocean/gke/responses/oceanGkeGet.yaml index 0ba678d9b..51f4bd6d7 100644 --- a/api/services/ocean/gke/responses/oceanGkeGet.yaml +++ b/api/services/ocean/gke/responses/oceanGkeGet.yaml @@ -19,6 +19,6 @@ content: items: type: array items: - $ref: "../schemas/oceanCluster.yaml" + $ref: "../schemas/oceanCluster-create.yaml" kind: example: "spotinst:ocean:gcp:k8s" \ No newline at end of file diff --git a/api/services/ocean/gke/responses/oceanGkeList.yaml b/api/services/ocean/gke/responses/oceanGkeList.yaml index 5c6c35ea4..6bdaf56dc 100644 --- a/api/services/ocean/gke/responses/oceanGkeList.yaml +++ b/api/services/ocean/gke/responses/oceanGkeList.yaml @@ -19,6 +19,6 @@ content: items: type: array items: - $ref: "../schemas/oceanCluster.yaml" + $ref: "../schemas/oceanCluster-create.yaml" kind: example: "spotinst:ocean:gcp:k8s" \ No newline at end of file diff --git a/api/services/ocean/gke/responses/oceanGkeUpdateResponse.yaml b/api/services/ocean/gke/responses/oceanGkeUpdateResponse.yaml index ff139359e..96b6ad1ad 100644 --- a/api/services/ocean/gke/responses/oceanGkeUpdateResponse.yaml +++ b/api/services/ocean/gke/responses/oceanGkeUpdateResponse.yaml @@ -19,6 +19,6 @@ content: items: type: array items: - $ref: "../schemas/oceanCluster.yaml" + $ref: "../schemas/oceanCluster-create.yaml" kind: example: "spotinst:ocean:gcp:k8s" \ No newline at end of file diff --git a/api/services/ocean/gke/schemas/oceanCluster-create.yaml b/api/services/ocean/gke/schemas/oceanCluster-create.yaml new file mode 100644 index 000000000..8a6bc2ad1 --- /dev/null +++ b/api/services/ocean/gke/schemas/oceanCluster-create.yaml @@ -0,0 +1,72 @@ +type: object +required: + - cluster +properties: + cluster: + type: object + description: The specification of the Ocean cluster. + required: + - name + - controllerClusterId + - compute + properties: + id: + type: string + readOnly: true + example: o-abcd1234 + description: | + Ocean cluster identifier. + name: + type: string + example: "test" + description: > + Add a name for the Ocean cluster. + controllerClusterId: + type: string + example: "test-123124" + description: > + Enter the Ocean cluster identifier. + gke: + type: object + required: + - clusterName + - masterLocation + description: > + Use existing GKE cluster. + properties: + clusterName: + type: string + description: > + Required for the cluster.gke object. + example: test-cluster + masterLocation: + type: string + description: > + Required for the cluster.gke object. + example: us-central1-a + autoScaler: + $ref: "../schemas/ocean-autoScaler.yaml" + capacity: + $ref: "../schemas/ocean-capacity.yaml" + strategy: + $ref: "../schemas/ocean-strategy.yaml" + scheduling: + $ref: "../schemas/ocean-scheduling.yaml" + security: + $ref: "../schemas/ocean-security.yaml" + compute: + $ref: "../schemas/ocean-compute.yaml" + createdAt: + type: string + readOnly: true + format: date-time + example: "2021-03-17T08:13:08.000Z" + description: | + A timestamp of the Ocean creation. + updatedAt: + type: string + readOnly: true + format: date-time + example: "2021-03-17T15:06:13.000Z" + description: | + A timestamp of the latest Ocean update. \ No newline at end of file diff --git a/api/services/ocean/gke/schemas/oceanCluster-update.yaml b/api/services/ocean/gke/schemas/oceanCluster-update.yaml new file mode 100644 index 000000000..68dc8707c --- /dev/null +++ b/api/services/ocean/gke/schemas/oceanCluster-update.yaml @@ -0,0 +1,65 @@ +type: object +required: + - cluster +properties: + cluster: + type: object + description: The specification of the Ocean cluster. + required: + - compute + properties: + id: + type: string + readOnly: true + example: o-abcd1234 + description: | + Ocean cluster identifier. + name: + type: string + example: "test" + description: > + Add a name for the Ocean cluster. + gke: + type: object + required: + - clusterName + - masterLocation + description: > + Use existing GKE cluster. + properties: + clusterName: + type: string + description: > + Required for the cluster.gke object. + example: test-cluster + masterLocation: + type: string + description: > + Required for the cluster.gke object. + example: us-central1-a + autoScaler: + $ref: "../schemas/ocean-autoScaler.yaml" + capacity: + $ref: "../schemas/ocean-capacity.yaml" + strategy: + $ref: "../schemas/ocean-strategy.yaml" + scheduling: + $ref: "../schemas/ocean-scheduling.yaml" + security: + $ref: "../schemas/ocean-security.yaml" + compute: + $ref: "../schemas/ocean-compute.yaml" + createdAt: + type: string + readOnly: true + format: date-time + example: "2021-03-17T08:13:08.000Z" + description: | + A timestamp of the Ocean creation. + updatedAt: + type: string + readOnly: true + format: date-time + example: "2021-03-17T15:06:13.000Z" + description: | + A timestamp of the latest Ocean update. \ No newline at end of file diff --git a/api/services/ocean/gke/schemas/oceanCluster.yaml b/api/services/ocean/gke/schemas/oceanCluster.yaml deleted file mode 100644 index 5657818b0..000000000 --- a/api/services/ocean/gke/schemas/oceanCluster.yaml +++ /dev/null @@ -1,67 +0,0 @@ -type: object -description: The specification of the Ocean cluster. -required: - - name - - controllerClusterId - - compute -properties: - id: - type: string - readOnly: true - example: o-abcd1234 - description: | - Ocean cluster identifier. - name: - type: string - example: "test" - description: > - Add a name for the Ocean cluster. - controllerClusterId: - type: string - example: "test-123124" - description: > - Enter the Ocean cluster identifier. - gke: - type: object - required: - - clusterName - - masterLocation - description: > - Use existing GKE cluster. - properties: - clusterName: - type: string - description: > - Required for the cluster.gke object. - example: test-cluster - masterLocation: - type: string - description: > - Required for the cluster.gke object. - example: us-central1-a - autoScaler: - $ref: "../schemas/ocean-autoScaler.yaml" - capacity: - $ref: "../schemas/ocean-capacity.yaml" - strategy: - $ref: "../schemas/ocean-strategy.yaml" - scheduling: - $ref: "../schemas/ocean-scheduling.yaml" - security: - $ref: "../schemas/ocean-security.yaml" - compute: - $ref: "../schemas/ocean-compute.yaml" - createdAt: - type: string - readOnly: true - format: date-time - example: "2021-03-17T08:13:08.000Z" - description: | - A timestamp of the Ocean creation. - updatedAt: - type: string - readOnly: true - format: date-time - example: "2021-03-17T15:06:13.000Z" - description: | - A timestamp of the latest Ocean update. \ No newline at end of file diff --git a/api/services/ocean/gke/schemas/oceanClusterWrapper.yaml b/api/services/ocean/gke/schemas/oceanClusterWrapper.yaml deleted file mode 100644 index 353620735..000000000 --- a/api/services/ocean/gke/schemas/oceanClusterWrapper.yaml +++ /dev/null @@ -1,6 +0,0 @@ -type: object -required: - - cluster -properties: - cluster: - $ref: "../schemas/oceanCluster.yaml" \ No newline at end of file diff --git a/api/services/ocean/gke/schemas/oceanGkeImportRequest.yaml b/api/services/ocean/gke/schemas/oceanGkeImportRequest.yaml index ad45719e1..6d9c655c3 100644 --- a/api/services/ocean/gke/schemas/oceanGkeImportRequest.yaml +++ b/api/services/ocean/gke/schemas/oceanGkeImportRequest.yaml @@ -6,7 +6,6 @@ properties: type: object description: The specification of the Ocean cluster. required: - - name - compute properties: name: From 3620d419b7ae148d7f69b79109604715ff9653f9 Mon Sep 17 00:00:00 2001 From: Anurag Sharma Date: Thu, 14 Dec 2023 02:48:51 +0530 Subject: [PATCH 2/2] Ocean GKE Doc Fixes --- .../ocean/gke/paths/cluster-roll.yaml | 4 ++ .../gke/responses/oceanGkeUpdateResponse.yaml | 2 +- .../manualHeadroomScheduledTaskCreate.yaml | 4 +- .../gke/schemas/oceanClusterLaunchSpec.yaml | 34 +++++---- .../schemas/oceanClusterLaunchSpecUpdate.yaml | 70 +++++++++++-------- 5 files changed, 69 insertions(+), 45 deletions(-) diff --git a/api/services/ocean/gke/paths/cluster-roll.yaml b/api/services/ocean/gke/paths/cluster-roll.yaml index ded3df193..664a6b486 100644 --- a/api/services/ocean/gke/paths/cluster-roll.yaml +++ b/api/services/ocean/gke/paths/cluster-roll.yaml @@ -18,9 +18,13 @@ put: application/json: schema: type: object + required: + - roll properties: roll: type: object + required: + - status description: > Object that specifies the parameters of a roll (also called a deployment). properties: diff --git a/api/services/ocean/gke/responses/oceanGkeUpdateResponse.yaml b/api/services/ocean/gke/responses/oceanGkeUpdateResponse.yaml index 96b6ad1ad..c761bdaff 100644 --- a/api/services/ocean/gke/responses/oceanGkeUpdateResponse.yaml +++ b/api/services/ocean/gke/responses/oceanGkeUpdateResponse.yaml @@ -19,6 +19,6 @@ content: items: type: array items: - $ref: "../schemas/oceanCluster-create.yaml" + $ref: "../schemas/oceanCluster-update.yaml" kind: example: "spotinst:ocean:gcp:k8s" \ No newline at end of file diff --git a/api/services/ocean/gke/schemas/manualHeadroomScheduledTaskCreate.yaml b/api/services/ocean/gke/schemas/manualHeadroomScheduledTaskCreate.yaml index f88ad061b..88a4146aa 100644 --- a/api/services/ocean/gke/schemas/manualHeadroomScheduledTaskCreate.yaml +++ b/api/services/ocean/gke/schemas/manualHeadroomScheduledTaskCreate.yaml @@ -1,7 +1,5 @@ type: object title: manualHeadroomUpdate -required: - - headrooms properties: headrooms: description: > @@ -9,6 +7,8 @@ properties: type: array items: type: object + required: + - numOfUnits properties: cpuPerUnit: description: > diff --git a/api/services/ocean/gke/schemas/oceanClusterLaunchSpec.yaml b/api/services/ocean/gke/schemas/oceanClusterLaunchSpec.yaml index 2df423ff8..bba2f8b1f 100644 --- a/api/services/ocean/gke/schemas/oceanClusterLaunchSpec.yaml +++ b/api/services/ocean/gke/schemas/oceanClusterLaunchSpec.yaml @@ -25,7 +25,7 @@ properties: example: 265168459660-compute@developer.gserviceaccount.com description: > The account used by applications running on the VM to call GCP APIs. - rootVolumeSize: + rootVolumeSizeInGb: type: integer description: Set root volume size (in GB). example: 8 @@ -36,13 +36,13 @@ properties: enum: [pd-standard, pd-ssd] metadata: type: array - required: - - key - - value description: > Add metadata to the cluster. items: type: object + required: + - key + - value properties: key: type: string @@ -83,6 +83,10 @@ properties: description: Add taints to the virtual node group. items: type: object + required: + - key + - value + - effect properties: key: type: string @@ -92,6 +96,7 @@ properties: description: Set taint value. effect: type: string + enum: [ NoSchedule, PreferNoSchedule, NoExecute ] description: Set taint effect. example: - key: taintKey @@ -102,6 +107,9 @@ properties: description: 'An array of labels to add to the virtual node group. Only custom user labels are allowed, and not Kubernetes built-in labels or Spot internal labels.' items: type: object + required: + - key + - value properties: key: type: string @@ -136,6 +144,8 @@ properties: Set custom headroom per virtual node group. Provide a list of launchSpec.autoScale.headroom objects. items: type: object + required: + - numOfUnits properties: cpuPerUnit: type: integer @@ -205,13 +215,12 @@ properties: example: "2019-06-10T15:06:13.000Z" networkInterfaces: type: array - required: - - accessConfigs - - network description: > Settings for network interfaces items: type: object + required: + - network properties: network: type: string @@ -228,10 +237,8 @@ properties: type: array description: > The network protocol of the VNG. - required: - - name - - type items: + type: object properties: name: type: string @@ -246,12 +253,13 @@ properties: example: "ONE_TO_ONE_NAT" aliasIpRanges: type: array - required: - - ipCidrRange - - subnetworkRangeName description: use the imported node pool’s associated aliasIpRange to assign secondary IP addresses to the nodes. Cannot be changed after VNG creation. items: + type: object + required: + - ipCidrRange + - subnetworkRangeName properties: ipCidrRange: type: string diff --git a/api/services/ocean/gke/schemas/oceanClusterLaunchSpecUpdate.yaml b/api/services/ocean/gke/schemas/oceanClusterLaunchSpecUpdate.yaml index 9dbf453f1..006410570 100644 --- a/api/services/ocean/gke/schemas/oceanClusterLaunchSpecUpdate.yaml +++ b/api/services/ocean/gke/schemas/oceanClusterLaunchSpecUpdate.yaml @@ -21,19 +21,19 @@ properties: example: "https://www.googleapis.com/compute/v1/projects/gke-node-images/global/images/container-v1-3-v20160517" description: > Set image URL. Can be null. - rootVolumeSize: + rootVolumeSizeInGb: type: integer description: Set root volume size (in GB). example: 8 metadata: type: array - required: - - key - - value description: > Add metadata to the cluster. items: type: object + required: + - key + - value properties: key: type: string @@ -74,6 +74,10 @@ properties: description: Add taints to virtual node group. items: type: object + required: + - key + - value + - effect properties: key: type: string @@ -83,6 +87,7 @@ properties: description: Set taint value. effect: type: string + enum: [ NoSchedule, PreferNoSchedule, NoExecute ] description: Set taint effect. example: - key: taintKey @@ -93,6 +98,9 @@ properties: description: 'An array of labels to add to the virtual node group. Only custom user labels are allowed, and not Kubernetes built-in labels or Spot internal labels.' items: type: object + required: + - key + - value properties: key: type: string @@ -121,36 +129,40 @@ properties: autoScale: type: object properties: - headroom: - type: object + headrooms: + type: array description: > Set custom headroom per virtual node group. Provide a list of launchSpec.autoScale.headroom objects. - properties: - cpuPerUnit: - type: integer - description: > - Configure the number of CPUs to allocate the headroom. - CPUs are denoted in millicores, where 1000 millicores = 1 vCPU. - example: 1000 - memoryPerUnit: - type: integer - description: > - Configure the amount of memory (MiB) to allocate the headroom. - example: 2048 - gpuPerUnit: - type: integer - description: > - The amount of GPU allocate per headroom unit. - example: 0 - numOfUnits: - type: integer - description: > - The number of units to retain as headroom, where each unit has the defined headroom CPU and memory. - example: 3 + items: + type: object + required: + - numOfUnits + properties: + cpuPerUnit: + type: integer + description: > + Configure the number of CPUs to allocate the headroom. + CPUs are denoted in millicores, where 1000 millicores = 1 vCPU. + example: 1000 + memoryPerUnit: + type: integer + description: > + Configure the amount of memory (MiB) to allocate the headroom. + example: 2048 + gpuPerUnit: + type: integer + description: > + The amount of GPU to allocate per headroom unit. + example: 0 + numOfUnits: + type: integer + description: > + The number of units to retain as headroom, where each unit has the defined headroom CPU and memory. + example: 3 autoHeadroomPercentage: type: integer description: > - Number between 0-200 to control the headroom % of the specific Virtual Node Group. Effective when cluster.autoScaler.isAutoConfig=true is set on the Ocean cluster. + Number between 0-200 to control the headroom % of the specific Virtual Node Group. Effective when cluster.autoScaler.isAutoConfig=true is set on the Ocean cluster example: 20 resourceLimits: type: object