diff --git a/.gen/pipeline/README.md b/.gen/pipeline/README.md index c7ec60f1..b086d0ea 100644 --- a/.gen/pipeline/README.md +++ b/.gen/pipeline/README.md @@ -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) @@ -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) diff --git a/.gen/pipeline/api/openapi.yaml b/.gen/pipeline/api/openapi.yaml index 704eb4a7..d2f02eb6 100644 --- a/.gen/pipeline/api/openapi.yaml +++ b/.gen/pipeline/api/openapi.yaml @@ -17158,7 +17158,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/NodePool' + $ref: '#/components/schemas/CreateNodePoolRequest' required: true responses: "202": @@ -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: diff --git a/.gen/pipeline/api_clusters.go b/.gen/pipeline/api_clusters.go index a602f9ff..e62eb29b 100644 --- a/.gen/pipeline/api_clusters.go +++ b/.gen/pipeline/api_clusters.go @@ -277,9 +277,9 @@ Add new node pool to a cluster * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param orgId Organization identifier * @param id Cluster identifier - * @param nodePool + * @param createNodePoolRequest */ -func (a *ClustersApiService) CreateNodePool(ctx _context.Context, orgId int32, id int32, nodePool NodePool) (*_nethttp.Response, error) { +func (a *ClustersApiService) CreateNodePool(ctx _context.Context, orgId int32, id int32, createNodePoolRequest CreateNodePoolRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -316,7 +316,7 @@ func (a *ClustersApiService) CreateNodePool(ctx _context.Context, orgId int32, i localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &nodePool + localVarPostBody = &createNodePoolRequest r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err diff --git a/.gen/pipeline/docs/ClustersApi.md b/.gen/pipeline/docs/ClustersApi.md index cde5e442..998d97e7 100644 --- a/.gen/pipeline/docs/ClustersApi.md +++ b/.gen/pipeline/docs/ClustersApi.md @@ -148,7 +148,7 @@ Name | Type | Description | Notes ## CreateNodePool -> CreateNodePool(ctx, orgId, id, nodePool) +> CreateNodePool(ctx, orgId, id, createNodePoolRequest) Create new node pool @@ -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 diff --git a/.gen/pipeline/docs/CreateNodePoolRequest.md b/.gen/pipeline/docs/CreateNodePoolRequest.md new file mode 100644 index 00000000..1feefbe9 --- /dev/null +++ b/.gen/pipeline/docs/CreateNodePoolRequest.md @@ -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) + + diff --git a/.gen/pipeline/docs/NodePools.md b/.gen/pipeline/docs/NodePools.md new file mode 100644 index 00000000..9260d552 --- /dev/null +++ b/.gen/pipeline/docs/NodePools.md @@ -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) + + diff --git a/.gen/pipeline/model_create_node_pool_request.go b/.gen/pipeline/model_create_node_pool_request.go new file mode 100644 index 00000000..85d87362 --- /dev/null +++ b/.gen/pipeline/model_create_node_pool_request.go @@ -0,0 +1,39 @@ +/* + * Pipeline API + * + * Pipeline is a feature rich application platform, built for containers on top of Kubernetes to automate the DevOps experience, continuous application development and the lifecycle of deployments. + * + * API version: latest + * Contact: info@banzaicloud.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package pipeline +// CreateNodePoolRequest struct for CreateNodePoolRequest +type CreateNodePoolRequest struct { + // Node pool name. + Name string `json:"name"` + // Node pool size. + Size int32 `json:"size"` + // Node pool labels. + Labels map[string]string `json:"labels,omitempty"` + Autoscaling NodePoolAutoScaling `json:"autoscaling,omitempty"` + VolumeEncryption *EksNodePoolVolumeEncryption `json:"volumeEncryption,omitempty"` + // Size of the EBS volume in GBs of the nodes in the pool. + VolumeSize int32 `json:"volumeSize,omitempty"` + // Type of the EBS volume of the nodes in the pool (default gp3). + VolumeType string `json:"volumeType,omitempty"` + // Machine instance type. + InstanceType string `json:"instanceType"` + // Instance AMI. + Image string `json:"image,omitempty"` + // 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. + SpotPrice string `json:"spotPrice,omitempty"` + SubnetId string `json:"subnetId,omitempty"` + // List of additional custom security groups for all nodes in the pool. + SecurityGroups []string `json:"securityGroups,omitempty"` + // 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. + UseInstanceStore bool `json:"useInstanceStore,omitempty"` + NodePools map[string]NodePool `json:"nodePools,omitempty"` +} diff --git a/.gen/pipeline/model_node_pools.go b/.gen/pipeline/model_node_pools.go new file mode 100644 index 00000000..1302e60c --- /dev/null +++ b/.gen/pipeline/model_node_pools.go @@ -0,0 +1,16 @@ +/* + * Pipeline API + * + * Pipeline is a feature rich application platform, built for containers on top of Kubernetes to automate the DevOps experience, continuous application development and the lifecycle of deployments. + * + * API version: latest + * Contact: info@banzaicloud.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package pipeline +// NodePools An associative collection of node pool objects keyed by their name. +type NodePools struct { + NodePools map[string]NodePool `json:"nodePools,omitempty"` +} diff --git a/.gen/pipeline/version.go b/.gen/pipeline/version.go index a2c5816a..781a48e4 100644 --- a/.gen/pipeline/version.go +++ b/.gen/pipeline/version.go @@ -1,3 +1,3 @@ package pipeline -const PipelineVersion = "0.75.0" +const PipelineVersion = "0.76.0" diff --git a/Makefile b/Makefile index 6c2b1d8c..d40d0abc 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/internal/cli/command/cluster/nodepool/create.go b/internal/cli/command/cluster/nodepool/create.go index 922dad17..ca1fa95e 100644 --- a/internal/cli/command/cluster/nodepool/create.go +++ b/internal/cli/command/cluster/nodepool/create.go @@ -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)