diff --git a/scaleway-async/scaleway_async/k8s/v1/api.py b/scaleway-async/scaleway_async/k8s/v1/api.py index 1873516f6..58418f70a 100644 --- a/scaleway-async/scaleway_async/k8s/v1/api.py +++ b/scaleway-async/scaleway_async/k8s/v1/api.py @@ -226,12 +226,12 @@ async def create_cluster( type_: str, description: str, version: str, + cni: CNI, region: Optional[ScwRegion] = None, organization_id: Optional[str] = None, project_id: Optional[str] = None, name: Optional[str] = None, tags: Optional[List[str]] = None, - cni: CNI, pools: Optional[List[CreateClusterRequestPoolConfig]] = None, autoscaler_config: Optional[CreateClusterRequestAutoscalerConfig] = None, auto_upgrade: Optional[CreateClusterRequestAutoUpgrade] = None, @@ -242,6 +242,9 @@ async def create_cluster( ] = None, apiserver_cert_sans: Optional[List[str]] = None, private_network_id: Optional[str] = None, + pod_cidr: Optional[str] = None, + service_cidr: Optional[str] = None, + service_dns_ip: Optional[str] = None, ) -> Cluster: """ Create a new Cluster. @@ -249,6 +252,7 @@ async def create_cluster( :param type_: Type of the cluster. See [list available cluster types](#list-available-cluster-types-for-a-cluster) for a list of valid types. :param description: Cluster description. :param version: Kubernetes version of the cluster. + :param cni: Container Network Interface (CNI) plugin running in the cluster. :param region: Region to target. If none is passed will use default region from the config. :param organization_id: Organization ID in which the cluster will be created. One-Of ('project_identifier'): at most one of 'project_id', 'organization_id' could be set. @@ -256,7 +260,6 @@ async def create_cluster( One-Of ('project_identifier'): at most one of 'project_id', 'organization_id' could be set. :param name: Cluster name. :param tags: Tags associated with the cluster. - :param cni: Container Network Interface (CNI) plugin running in the cluster. :param pools: Pools created along with the cluster. :param autoscaler_config: Autoscaler configuration for the cluster. It allows you to set (to an extent) your preferred autoscaler configuration, which is an implementation of the cluster-autoscaler (https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/). :param auto_upgrade: Auto upgrade configuration of the cluster. This configuration enables to set a specific 2-hour time window in which the cluster can be automatically updated to the latest patch version. @@ -265,6 +268,9 @@ async def create_cluster( :param open_id_connect_config: OpenID Connect configuration of the cluster. This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. :param apiserver_cert_sans: Additional Subject Alternative Names for the Kubernetes API server certificate. :param private_network_id: Private network ID for internal cluster communication (cannot be changed later). + :param pod_cidr: Subnet used for the Pod CIDR (cannot be changed later). + :param service_cidr: Subnet used for the Service CIDR (cannot be changed later). + :param service_dns_ip: IP used for the DNS Service (cannot be changes later). If unset, default to Service CIDR's network + 10. :return: :class:`Cluster ` Usage: @@ -290,10 +296,10 @@ async def create_cluster( type_=type_, description=description, version=version, + cni=cni, region=region, name=name or random_name(prefix="k8s"), tags=tags, - cni=cni, pools=pools, autoscaler_config=autoscaler_config, auto_upgrade=auto_upgrade, @@ -302,6 +308,9 @@ async def create_cluster( open_id_connect_config=open_id_connect_config, apiserver_cert_sans=apiserver_cert_sans, private_network_id=private_network_id, + pod_cidr=pod_cidr, + service_cidr=service_cidr, + service_dns_ip=service_dns_ip, project_id=project_id, organization_id=organization_id, ), diff --git a/scaleway-async/scaleway_async/k8s/v1/marshalling.py b/scaleway-async/scaleway_async/k8s/v1/marshalling.py index da45c3df3..cc86a46c1 100644 --- a/scaleway-async/scaleway_async/k8s/v1/marshalling.py +++ b/scaleway-async/scaleway_async/k8s/v1/marshalling.py @@ -447,6 +447,10 @@ def unmarshal_Cluster(data: Any) -> Cluster: if field is not None: args["feature_gates"] = field + field = data.get("admission_plugins", None) + if field is not None: + args["admission_plugins"] = field + field = data.get("created_at", None) if field is not None: args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -471,9 +475,11 @@ def unmarshal_Cluster(data: Any) -> Cluster: else: args["auto_upgrade"] = None - field = data.get("admission_plugins", None) + field = data.get("open_id_connect_config", None) if field is not None: - args["admission_plugins"] = field + args["open_id_connect_config"] = unmarshal_ClusterOpenIDConnectConfig(field) + else: + args["open_id_connect_config"] = None field = data.get("apiserver_cert_sans", None) if field is not None: @@ -483,11 +489,17 @@ def unmarshal_Cluster(data: Any) -> Cluster: if field is not None: args["iam_nodes_group_id"] = field - field = data.get("open_id_connect_config", None) + field = data.get("pod_cidr", None) if field is not None: - args["open_id_connect_config"] = unmarshal_ClusterOpenIDConnectConfig(field) - else: - args["open_id_connect_config"] = None + args["pod_cidr"] = field + + field = data.get("service_cidr", None) + if field is not None: + args["service_cidr"] = field + + field = data.get("service_dns_ip", None) + if field is not None: + args["service_dns_ip"] = field field = data.get("private_network_id", None) if field is not None: @@ -1106,8 +1118,12 @@ def marshal_ACLRuleRequest( output.update( resolve_one_of( [ - OneOfPossibility("ip", request.ip), - OneOfPossibility("scaleway_ranges", request.scaleway_ranges), + OneOfPossibility(param="ip", value=request.ip, marshal_func=None), + OneOfPossibility( + param="scaleway_ranges", + value=request.scaleway_ranges, + marshal_func=None, + ), ] ), ) @@ -1325,12 +1341,16 @@ def marshal_CreateClusterRequest( resolve_one_of( [ OneOfPossibility( - "project_id", request.project_id, defaults.default_project_id + param="project_id", + value=request.project_id, + default=defaults.default_project_id, + marshal_func=None, ), OneOfPossibility( - "organization_id", - request.organization_id, - defaults.default_organization_id, + param="organization_id", + value=request.organization_id, + default=defaults.default_organization_id, + marshal_func=None, ), ] ), @@ -1345,15 +1365,15 @@ def marshal_CreateClusterRequest( if request.version is not None: output["version"] = request.version + if request.cni is not None: + output["cni"] = str(request.cni) + if request.name is not None: output["name"] = request.name if request.tags is not None: output["tags"] = request.tags - if request.cni is not None: - output["cni"] = str(request.cni) - if request.pools is not None: output["pools"] = [ marshal_CreateClusterRequestPoolConfig(item, defaults) @@ -1389,6 +1409,15 @@ def marshal_CreateClusterRequest( if request.private_network_id is not None: output["private_network_id"] = request.private_network_id + if request.pod_cidr is not None: + output["pod_cidr"] = request.pod_cidr + + if request.service_cidr is not None: + output["service_cidr"] = request.service_cidr + + if request.service_dns_ip is not None: + output["service_dns_ip"] = request.service_dns_ip + return output diff --git a/scaleway-async/scaleway_async/k8s/v1/types.py b/scaleway-async/scaleway_async/k8s/v1/types.py index 3fd4adef2..ec4c047b2 100644 --- a/scaleway-async/scaleway_async/k8s/v1/types.py +++ b/scaleway-async/scaleway_async/k8s/v1/types.py @@ -877,6 +877,11 @@ class Cluster: List of enabled feature gates. """ + admission_plugins: List[str] + """ + List of enabled admission plugins. + """ + created_at: Optional[datetime] """ Date on which the cluster was created. @@ -897,9 +902,9 @@ class Cluster: Auto upgrade Kubernetes version of the cluster. """ - admission_plugins: List[str] + open_id_connect_config: Optional[ClusterOpenIDConnectConfig] """ - List of enabled admission plugins. + This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. """ apiserver_cert_sans: List[str] @@ -912,9 +917,19 @@ class Cluster: IAM group that nodes are members of (this field might be empty during early stage of cluster creation). """ - open_id_connect_config: Optional[ClusterOpenIDConnectConfig] + pod_cidr: str """ - This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. + Subnet used for the Pod CIDR. + """ + + service_cidr: str + """ + Subnet used for the Service CIDR. + """ + + service_dns_ip: str + """ + IP used for the DNS Service. """ private_network_id: Optional[str] @@ -1182,6 +1197,11 @@ class CreateClusterRequest: Kubernetes version of the cluster. """ + cni: CNI + """ + Container Network Interface (CNI) plugin running in the cluster. + """ + region: Optional[ScwRegion] """ Region to target. If none is passed will use default region from the config. @@ -1197,11 +1217,6 @@ class CreateClusterRequest: Tags associated with the cluster. """ - cni: CNI - """ - Container Network Interface (CNI) plugin running in the cluster. - """ - pools: Optional[List[CreateClusterRequestPoolConfig]] """ Pools created along with the cluster. @@ -1242,6 +1257,21 @@ class CreateClusterRequest: Private network ID for internal cluster communication (cannot be changed later). """ + pod_cidr: Optional[str] + """ + Subnet used for the Pod CIDR (cannot be changed later). + """ + + service_cidr: Optional[str] + """ + Subnet used for the Service CIDR (cannot be changed later). + """ + + service_dns_ip: Optional[str] + """ + IP used for the DNS Service (cannot be changes later). If unset, default to Service CIDR's network + 10. + """ + project_id: Optional[str] organization_id: Optional[str] diff --git a/scaleway/scaleway/k8s/v1/api.py b/scaleway/scaleway/k8s/v1/api.py index 60ad64f62..152371bbe 100644 --- a/scaleway/scaleway/k8s/v1/api.py +++ b/scaleway/scaleway/k8s/v1/api.py @@ -226,12 +226,12 @@ def create_cluster( type_: str, description: str, version: str, + cni: CNI, region: Optional[ScwRegion] = None, organization_id: Optional[str] = None, project_id: Optional[str] = None, name: Optional[str] = None, tags: Optional[List[str]] = None, - cni: CNI, pools: Optional[List[CreateClusterRequestPoolConfig]] = None, autoscaler_config: Optional[CreateClusterRequestAutoscalerConfig] = None, auto_upgrade: Optional[CreateClusterRequestAutoUpgrade] = None, @@ -242,6 +242,9 @@ def create_cluster( ] = None, apiserver_cert_sans: Optional[List[str]] = None, private_network_id: Optional[str] = None, + pod_cidr: Optional[str] = None, + service_cidr: Optional[str] = None, + service_dns_ip: Optional[str] = None, ) -> Cluster: """ Create a new Cluster. @@ -249,6 +252,7 @@ def create_cluster( :param type_: Type of the cluster. See [list available cluster types](#list-available-cluster-types-for-a-cluster) for a list of valid types. :param description: Cluster description. :param version: Kubernetes version of the cluster. + :param cni: Container Network Interface (CNI) plugin running in the cluster. :param region: Region to target. If none is passed will use default region from the config. :param organization_id: Organization ID in which the cluster will be created. One-Of ('project_identifier'): at most one of 'project_id', 'organization_id' could be set. @@ -256,7 +260,6 @@ def create_cluster( One-Of ('project_identifier'): at most one of 'project_id', 'organization_id' could be set. :param name: Cluster name. :param tags: Tags associated with the cluster. - :param cni: Container Network Interface (CNI) plugin running in the cluster. :param pools: Pools created along with the cluster. :param autoscaler_config: Autoscaler configuration for the cluster. It allows you to set (to an extent) your preferred autoscaler configuration, which is an implementation of the cluster-autoscaler (https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/). :param auto_upgrade: Auto upgrade configuration of the cluster. This configuration enables to set a specific 2-hour time window in which the cluster can be automatically updated to the latest patch version. @@ -265,6 +268,9 @@ def create_cluster( :param open_id_connect_config: OpenID Connect configuration of the cluster. This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. :param apiserver_cert_sans: Additional Subject Alternative Names for the Kubernetes API server certificate. :param private_network_id: Private network ID for internal cluster communication (cannot be changed later). + :param pod_cidr: Subnet used for the Pod CIDR (cannot be changed later). + :param service_cidr: Subnet used for the Service CIDR (cannot be changed later). + :param service_dns_ip: IP used for the DNS Service (cannot be changes later). If unset, default to Service CIDR's network + 10. :return: :class:`Cluster ` Usage: @@ -290,10 +296,10 @@ def create_cluster( type_=type_, description=description, version=version, + cni=cni, region=region, name=name or random_name(prefix="k8s"), tags=tags, - cni=cni, pools=pools, autoscaler_config=autoscaler_config, auto_upgrade=auto_upgrade, @@ -302,6 +308,9 @@ def create_cluster( open_id_connect_config=open_id_connect_config, apiserver_cert_sans=apiserver_cert_sans, private_network_id=private_network_id, + pod_cidr=pod_cidr, + service_cidr=service_cidr, + service_dns_ip=service_dns_ip, project_id=project_id, organization_id=organization_id, ), diff --git a/scaleway/scaleway/k8s/v1/marshalling.py b/scaleway/scaleway/k8s/v1/marshalling.py index da45c3df3..cc86a46c1 100644 --- a/scaleway/scaleway/k8s/v1/marshalling.py +++ b/scaleway/scaleway/k8s/v1/marshalling.py @@ -447,6 +447,10 @@ def unmarshal_Cluster(data: Any) -> Cluster: if field is not None: args["feature_gates"] = field + field = data.get("admission_plugins", None) + if field is not None: + args["admission_plugins"] = field + field = data.get("created_at", None) if field is not None: args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -471,9 +475,11 @@ def unmarshal_Cluster(data: Any) -> Cluster: else: args["auto_upgrade"] = None - field = data.get("admission_plugins", None) + field = data.get("open_id_connect_config", None) if field is not None: - args["admission_plugins"] = field + args["open_id_connect_config"] = unmarshal_ClusterOpenIDConnectConfig(field) + else: + args["open_id_connect_config"] = None field = data.get("apiserver_cert_sans", None) if field is not None: @@ -483,11 +489,17 @@ def unmarshal_Cluster(data: Any) -> Cluster: if field is not None: args["iam_nodes_group_id"] = field - field = data.get("open_id_connect_config", None) + field = data.get("pod_cidr", None) if field is not None: - args["open_id_connect_config"] = unmarshal_ClusterOpenIDConnectConfig(field) - else: - args["open_id_connect_config"] = None + args["pod_cidr"] = field + + field = data.get("service_cidr", None) + if field is not None: + args["service_cidr"] = field + + field = data.get("service_dns_ip", None) + if field is not None: + args["service_dns_ip"] = field field = data.get("private_network_id", None) if field is not None: @@ -1106,8 +1118,12 @@ def marshal_ACLRuleRequest( output.update( resolve_one_of( [ - OneOfPossibility("ip", request.ip), - OneOfPossibility("scaleway_ranges", request.scaleway_ranges), + OneOfPossibility(param="ip", value=request.ip, marshal_func=None), + OneOfPossibility( + param="scaleway_ranges", + value=request.scaleway_ranges, + marshal_func=None, + ), ] ), ) @@ -1325,12 +1341,16 @@ def marshal_CreateClusterRequest( resolve_one_of( [ OneOfPossibility( - "project_id", request.project_id, defaults.default_project_id + param="project_id", + value=request.project_id, + default=defaults.default_project_id, + marshal_func=None, ), OneOfPossibility( - "organization_id", - request.organization_id, - defaults.default_organization_id, + param="organization_id", + value=request.organization_id, + default=defaults.default_organization_id, + marshal_func=None, ), ] ), @@ -1345,15 +1365,15 @@ def marshal_CreateClusterRequest( if request.version is not None: output["version"] = request.version + if request.cni is not None: + output["cni"] = str(request.cni) + if request.name is not None: output["name"] = request.name if request.tags is not None: output["tags"] = request.tags - if request.cni is not None: - output["cni"] = str(request.cni) - if request.pools is not None: output["pools"] = [ marshal_CreateClusterRequestPoolConfig(item, defaults) @@ -1389,6 +1409,15 @@ def marshal_CreateClusterRequest( if request.private_network_id is not None: output["private_network_id"] = request.private_network_id + if request.pod_cidr is not None: + output["pod_cidr"] = request.pod_cidr + + if request.service_cidr is not None: + output["service_cidr"] = request.service_cidr + + if request.service_dns_ip is not None: + output["service_dns_ip"] = request.service_dns_ip + return output diff --git a/scaleway/scaleway/k8s/v1/types.py b/scaleway/scaleway/k8s/v1/types.py index 3fd4adef2..ec4c047b2 100644 --- a/scaleway/scaleway/k8s/v1/types.py +++ b/scaleway/scaleway/k8s/v1/types.py @@ -877,6 +877,11 @@ class Cluster: List of enabled feature gates. """ + admission_plugins: List[str] + """ + List of enabled admission plugins. + """ + created_at: Optional[datetime] """ Date on which the cluster was created. @@ -897,9 +902,9 @@ class Cluster: Auto upgrade Kubernetes version of the cluster. """ - admission_plugins: List[str] + open_id_connect_config: Optional[ClusterOpenIDConnectConfig] """ - List of enabled admission plugins. + This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. """ apiserver_cert_sans: List[str] @@ -912,9 +917,19 @@ class Cluster: IAM group that nodes are members of (this field might be empty during early stage of cluster creation). """ - open_id_connect_config: Optional[ClusterOpenIDConnectConfig] + pod_cidr: str """ - This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. + Subnet used for the Pod CIDR. + """ + + service_cidr: str + """ + Subnet used for the Service CIDR. + """ + + service_dns_ip: str + """ + IP used for the DNS Service. """ private_network_id: Optional[str] @@ -1182,6 +1197,11 @@ class CreateClusterRequest: Kubernetes version of the cluster. """ + cni: CNI + """ + Container Network Interface (CNI) plugin running in the cluster. + """ + region: Optional[ScwRegion] """ Region to target. If none is passed will use default region from the config. @@ -1197,11 +1217,6 @@ class CreateClusterRequest: Tags associated with the cluster. """ - cni: CNI - """ - Container Network Interface (CNI) plugin running in the cluster. - """ - pools: Optional[List[CreateClusterRequestPoolConfig]] """ Pools created along with the cluster. @@ -1242,6 +1257,21 @@ class CreateClusterRequest: Private network ID for internal cluster communication (cannot be changed later). """ + pod_cidr: Optional[str] + """ + Subnet used for the Pod CIDR (cannot be changed later). + """ + + service_cidr: Optional[str] + """ + Subnet used for the Service CIDR (cannot be changed later). + """ + + service_dns_ip: Optional[str] + """ + IP used for the DNS Service (cannot be changes later). If unset, default to Service CIDR's network + 10. + """ + project_id: Optional[str] organization_id: Optional[str]