Skip to content

Commit

Permalink
merge(#350): added batch CNP
Browse files Browse the repository at this point in the history
regenerate Pipeline client, validate create node pool request
#350
  • Loading branch information
pregnor committed Jul 9, 2021
2 parents 5a2a624 + e44cfed commit 4e78498
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gen/pipeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ Class | Method | HTTP request | Description
- [CreateGkePropertiesGke](docs/CreateGkePropertiesGke.md)
- [CreateGkePropertiesGkeMaster](docs/CreateGkePropertiesGkeMaster.md)
- [CreateGoogleObjectStoreBucketProperties](docs/CreateGoogleObjectStoreBucketProperties.md)
- [CreateNodePoolRequest](docs/CreateNodePoolRequest.md)
- [CreateObjectStoreBucketProperties](docs/CreateObjectStoreBucketProperties.md)
- [CreateObjectStoreBucketRequest](docs/CreateObjectStoreBucketRequest.md)
- [CreateObjectStoreBucketResponse](docs/CreateObjectStoreBucketResponse.md)
Expand Down Expand Up @@ -330,6 +331,7 @@ Class | Method | HTTP request | Description
- [NodePoolStatusInformation](docs/NodePoolStatusInformation.md)
- [NodePoolStatusVSphere](docs/NodePoolStatusVSphere.md)
- [NodePoolSummary](docs/NodePoolSummary.md)
- [NodePools](docs/NodePools.md)
- [NodePoolsAzure](docs/NodePoolsAzure.md)
- [NodePoolsGoogle](docs/NodePoolsGoogle.md)
- [NodePoolsPke](docs/NodePoolsPke.md)
Expand Down
14 changes: 13 additions & 1 deletion .gen/pipeline/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17158,7 +17158,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/NodePool'
$ref: '#/components/schemas/CreateNodePoolRequest'
required: true
responses:
"202":
Expand Down Expand Up @@ -18741,10 +18741,22 @@ components:
allOf:
- $ref: '#/components/schemas/CreateClusterRequestBase'
- $ref: '#/components/schemas/CreateClusterRequestBase'
CreateNodePoolRequest:
oneOf:
- $ref: '#/components/schemas/NodePool'
- $ref: '#/components/schemas/NodePools'
NodePool:
oneOf:
- $ref: '#/components/schemas/EksNodePool'
- $ref: '#/components/schemas/EksNodePool'
NodePools:
description: An associative collection of node pool objects keyed by their name.
properties:
nodePools:
additionalProperties:
$ref: '#/components/schemas/NodePool'
type: object
type: object
GenericNodePool:
description: Generic node pool object for all cluster distributions.
properties:
Expand Down
6 changes: 3 additions & 3 deletions .gen/pipeline/api_clusters.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .gen/pipeline/docs/ClustersApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Name | Type | Description | Notes

## CreateNodePool

> CreateNodePool(ctx, orgId, id, nodePool)
> CreateNodePool(ctx, orgId, id, createNodePoolRequest)
Create new node pool

Expand All @@ -162,7 +162,7 @@ Name | Type | Description | Notes
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**orgId** | **int32**| Organization identifier |
**id** | **int32**| Cluster identifier |
**nodePool** | [**NodePool**](NodePool.md)| |
**createNodePoolRequest** | [**CreateNodePoolRequest**](CreateNodePoolRequest.md)| |

### Return type

Expand Down
24 changes: 24 additions & 0 deletions .gen/pipeline/docs/CreateNodePoolRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# CreateNodePoolRequest

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | Node pool name. |
**Size** | **int32** | Node pool size. |
**Labels** | **map[string]string** | Node pool labels. | [optional]
**Autoscaling** | [**NodePoolAutoScaling**](NodePoolAutoScaling.md) | | [optional]
**VolumeEncryption** | Pointer to [**EksNodePoolVolumeEncryption**](EKSNodePoolVolumeEncryption.md) | | [optional]
**VolumeSize** | **int32** | Size of the EBS volume in GBs of the nodes in the pool. | [optional]
**VolumeType** | **string** | Type of the EBS volume of the nodes in the pool (default gp3). | [optional]
**InstanceType** | **string** | Machine instance type. |
**Image** | **string** | Instance AMI. | [optional]
**SpotPrice** | **string** | The upper limit price for the requested spot instance. If this field is left empty or 0 passed in on-demand instances used instead of spot instances. | [optional]
**SubnetId** | **string** | | [optional]
**SecurityGroups** | **[]string** | List of additional custom security groups for all nodes in the pool. | [optional]
**UseInstanceStore** | **bool** | Setup available instance stores (NVMe disks) to use for Kubelet root if available. As a result emptyDir volumes will be provisioned on local instance storage disks. You can check out available instance storages here https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#instance-store-volumes. | [optional]
**NodePools** | [**map[string]NodePool**](NodePool.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


11 changes: 11 additions & 0 deletions .gen/pipeline/docs/NodePools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# NodePools

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**NodePools** | [**map[string]NodePool**](NodePool.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


39 changes: 39 additions & 0 deletions .gen/pipeline/model_create_node_pool_request.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .gen/pipeline/model_node_pools.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .gen/pipeline/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package pipeline

const PipelineVersion = "0.75.0"
const PipelineVersion = "0.76.0"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif
TEST_FORMAT = short-verbose
endif

PIPELINE_VERSION = 0.75.0
PIPELINE_VERSION = 0.76.0

CLOUDINFO_VERSION = 0.13.0
TELESCOPES_VERSION = 0.5.3
Expand Down
18 changes: 13 additions & 5 deletions internal/cli/command/cluster/nodepool/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,26 @@ func createNodePool(banzaiCli cli.Cli, options createOptions) error {

log.Debugf("%d bytes read", len(raw))

var request pipeline.NodePool

var request pipeline.CreateNodePoolRequest
if err := utils.Unmarshal(raw, &request); err != nil {
return errors.WrapIf(err, "failed to unmarshal create node pool request")
}

if options.name != "" {
request.Name = options.name
switch len(request.NodePools) {
case 0: // Note: single node pool, overwrite name with option.
request.Name = options.name
case 1: // Note: single node pool in a map, overwrite name with option.
for nodePoolName, nodePool := range request.NodePools {
nodePool.Name = options.name
request.NodePools[options.name] = nodePool
delete(request.NodePools, nodePoolName)
}
default: // Note: >=2, multiple node pools, single name option doesn't make sense.
return errors.WrapIf(err, "invalid option name specified for multiple node pool creation")
}
}

// TODO: validate request

log.Debugf("create request: %#v", request)

resp, err := client.ClustersApi.CreateNodePool(context.Background(), orgID, clusterID, request)
Expand Down

0 comments on commit 4e78498

Please sign in to comment.