From 284e9d05bf7b6db5620d2b4c9da797128bf326f4 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Thu, 25 Jan 2018 15:22:26 -0800 Subject: [PATCH] Api change v1beta2 adding required controller spec selector fields --- CHANGELOG.md | 3 +++ .../client/models/v1beta2_daemon_set_spec.py | 9 +++++---- .../client/models/v1beta2_deployment_spec.py | 9 +++++---- .../client/models/v1beta2_replica_set_spec.py | 9 +++++---- .../client/models/v1beta2_stateful_set_spec.py | 9 +++++---- kubernetes/docs/V1beta2DaemonSetSpec.md | 2 +- kubernetes/docs/V1beta2DeploymentSpec.md | 2 +- kubernetes/docs/V1beta2ReplicaSetSpec.md | 2 +- kubernetes/docs/V1beta2StatefulSetSpec.md | 2 +- scripts/swagger.json | 16 +++++++++++----- 10 files changed, 38 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7f9dace8a..0228f8f2a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# v5.0.0b1 +- Label selector for pods is now required and must match the pod template's labels for v1beta2 StatefulSetSpec, ReplicaSetSpec, DaemonSetSpec and DeploymentSpec kubernetes/kubernetes#55357 + # v4.0.0 - api change V1PersistentVolumeSpec to V1ScaleIOPersistentVolumeSource #397. diff --git a/kubernetes/client/models/v1beta2_daemon_set_spec.py b/kubernetes/client/models/v1beta2_daemon_set_spec.py index 9f82035ef1..55a912cf50 100644 --- a/kubernetes/client/models/v1beta2_daemon_set_spec.py +++ b/kubernetes/client/models/v1beta2_daemon_set_spec.py @@ -62,8 +62,7 @@ def __init__(self, min_ready_seconds=None, revision_history_limit=None, selector self.min_ready_seconds = min_ready_seconds if revision_history_limit is not None: self.revision_history_limit = revision_history_limit - if selector is not None: - self.selector = selector + self.selector = selector self.template = template if update_strategy is not None: self.update_strategy = update_strategy @@ -118,7 +117,7 @@ def revision_history_limit(self, revision_history_limit): def selector(self): """ Gets the selector of this V1beta2DaemonSetSpec. - A label query over pods that are managed by the daemon set. Must match in order to be controlled. If empty, defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + A label query over pods that are managed by the daemon set. Must match in order to be controlled. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors :return: The selector of this V1beta2DaemonSetSpec. :rtype: V1LabelSelector @@ -129,11 +128,13 @@ def selector(self): def selector(self, selector): """ Sets the selector of this V1beta2DaemonSetSpec. - A label query over pods that are managed by the daemon set. Must match in order to be controlled. If empty, defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + A label query over pods that are managed by the daemon set. Must match in order to be controlled. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors :param selector: The selector of this V1beta2DaemonSetSpec. :type: V1LabelSelector """ + if selector is None: + raise ValueError("Invalid value for `selector`, must not be `None`") self._selector = selector diff --git a/kubernetes/client/models/v1beta2_deployment_spec.py b/kubernetes/client/models/v1beta2_deployment_spec.py index f4e02f0edd..5004006988 100644 --- a/kubernetes/client/models/v1beta2_deployment_spec.py +++ b/kubernetes/client/models/v1beta2_deployment_spec.py @@ -77,8 +77,7 @@ def __init__(self, min_ready_seconds=None, paused=None, progress_deadline_second self.replicas = replicas if revision_history_limit is not None: self.revision_history_limit = revision_history_limit - if selector is not None: - self.selector = selector + self.selector = selector if strategy is not None: self.strategy = strategy self.template = template @@ -202,7 +201,7 @@ def revision_history_limit(self, revision_history_limit): def selector(self): """ Gets the selector of this V1beta2DeploymentSpec. - Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. + Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels. :return: The selector of this V1beta2DeploymentSpec. :rtype: V1LabelSelector @@ -213,11 +212,13 @@ def selector(self): def selector(self, selector): """ Sets the selector of this V1beta2DeploymentSpec. - Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. + Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels. :param selector: The selector of this V1beta2DeploymentSpec. :type: V1LabelSelector """ + if selector is None: + raise ValueError("Invalid value for `selector`, must not be `None`") self._selector = selector diff --git a/kubernetes/client/models/v1beta2_replica_set_spec.py b/kubernetes/client/models/v1beta2_replica_set_spec.py index 92a72bc39a..2a95bf1847 100644 --- a/kubernetes/client/models/v1beta2_replica_set_spec.py +++ b/kubernetes/client/models/v1beta2_replica_set_spec.py @@ -59,8 +59,7 @@ def __init__(self, min_ready_seconds=None, replicas=None, selector=None, templat self.min_ready_seconds = min_ready_seconds if replicas is not None: self.replicas = replicas - if selector is not None: - self.selector = selector + self.selector = selector if template is not None: self.template = template @@ -114,7 +113,7 @@ def replicas(self, replicas): def selector(self): """ Gets the selector of this V1beta2ReplicaSetSpec. - Selector is a label query over pods that should match the replica count. If the selector is empty, it is defaulted to the labels present on the pod template. Label keys and values that must match in order to be controlled by this replica set. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector is a label query over pods that should match the replica count. Label keys and values that must match in order to be controlled by this replica set. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors :return: The selector of this V1beta2ReplicaSetSpec. :rtype: V1LabelSelector @@ -125,11 +124,13 @@ def selector(self): def selector(self, selector): """ Sets the selector of this V1beta2ReplicaSetSpec. - Selector is a label query over pods that should match the replica count. If the selector is empty, it is defaulted to the labels present on the pod template. Label keys and values that must match in order to be controlled by this replica set. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector is a label query over pods that should match the replica count. Label keys and values that must match in order to be controlled by this replica set. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors :param selector: The selector of this V1beta2ReplicaSetSpec. :type: V1LabelSelector """ + if selector is None: + raise ValueError("Invalid value for `selector`, must not be `None`") self._selector = selector diff --git a/kubernetes/client/models/v1beta2_stateful_set_spec.py b/kubernetes/client/models/v1beta2_stateful_set_spec.py index f9a2db5262..2f956f68ec 100644 --- a/kubernetes/client/models/v1beta2_stateful_set_spec.py +++ b/kubernetes/client/models/v1beta2_stateful_set_spec.py @@ -73,8 +73,7 @@ def __init__(self, pod_management_policy=None, replicas=None, revision_history_l self.replicas = replicas if revision_history_limit is not None: self.revision_history_limit = revision_history_limit - if selector is not None: - self.selector = selector + self.selector = selector self.service_name = service_name self.template = template if update_strategy is not None: @@ -155,7 +154,7 @@ def revision_history_limit(self, revision_history_limit): def selector(self): """ Gets the selector of this V1beta2StatefulSetSpec. - selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + selector is a label query over pods that should match the replica count. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors :return: The selector of this V1beta2StatefulSetSpec. :rtype: V1LabelSelector @@ -166,11 +165,13 @@ def selector(self): def selector(self, selector): """ Sets the selector of this V1beta2StatefulSetSpec. - selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + selector is a label query over pods that should match the replica count. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors :param selector: The selector of this V1beta2StatefulSetSpec. :type: V1LabelSelector """ + if selector is None: + raise ValueError("Invalid value for `selector`, must not be `None`") self._selector = selector diff --git a/kubernetes/docs/V1beta2DaemonSetSpec.md b/kubernetes/docs/V1beta2DaemonSetSpec.md index 15800aaf07..babb8a0926 100644 --- a/kubernetes/docs/V1beta2DaemonSetSpec.md +++ b/kubernetes/docs/V1beta2DaemonSetSpec.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **min_ready_seconds** | **int** | The minimum number of seconds for which a newly created DaemonSet pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready). | [optional] **revision_history_limit** | **int** | The number of old history to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10. | [optional] -**selector** | [**V1LabelSelector**](V1LabelSelector.md) | A label query over pods that are managed by the daemon set. Must match in order to be controlled. If empty, defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors | [optional] +**selector** | [**V1LabelSelector**](V1LabelSelector.md) | A label query over pods that are managed by the daemon set. Must match in order to be controlled. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors | **template** | [**V1PodTemplateSpec**](V1PodTemplateSpec.md) | An object that describes the pod that will be created. The DaemonSet will create exactly one copy of this pod on every node that matches the template's node selector (or on every node if no node selector is specified). More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template | **update_strategy** | [**V1beta2DaemonSetUpdateStrategy**](V1beta2DaemonSetUpdateStrategy.md) | An update strategy to replace existing DaemonSet pods with new pods. | [optional] diff --git a/kubernetes/docs/V1beta2DeploymentSpec.md b/kubernetes/docs/V1beta2DeploymentSpec.md index 2287012806..1362babe19 100644 --- a/kubernetes/docs/V1beta2DeploymentSpec.md +++ b/kubernetes/docs/V1beta2DeploymentSpec.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **progress_deadline_seconds** | **int** | The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s. | [optional] **replicas** | **int** | Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1. | [optional] **revision_history_limit** | **int** | The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10. | [optional] -**selector** | [**V1LabelSelector**](V1LabelSelector.md) | Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. | [optional] +**selector** | [**V1LabelSelector**](V1LabelSelector.md) | Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels. | **strategy** | [**V1beta2DeploymentStrategy**](V1beta2DeploymentStrategy.md) | The deployment strategy to use to replace existing pods with new ones. | [optional] **template** | [**V1PodTemplateSpec**](V1PodTemplateSpec.md) | Template describes the pods that will be created. | diff --git a/kubernetes/docs/V1beta2ReplicaSetSpec.md b/kubernetes/docs/V1beta2ReplicaSetSpec.md index 96ad118c18..4f8ac363e3 100644 --- a/kubernetes/docs/V1beta2ReplicaSetSpec.md +++ b/kubernetes/docs/V1beta2ReplicaSetSpec.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **min_ready_seconds** | **int** | Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready) | [optional] **replicas** | **int** | Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller | [optional] -**selector** | [**V1LabelSelector**](V1LabelSelector.md) | Selector is a label query over pods that should match the replica count. If the selector is empty, it is defaulted to the labels present on the pod template. Label keys and values that must match in order to be controlled by this replica set. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors | [optional] +**selector** | [**V1LabelSelector**](V1LabelSelector.md) | Selector is a label query over pods that should match the replica count. Label keys and values that must match in order to be controlled by this replica set. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors | **template** | [**V1PodTemplateSpec**](V1PodTemplateSpec.md) | Template is the object that describes the pod that will be created if insufficient replicas are detected. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template | [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/kubernetes/docs/V1beta2StatefulSetSpec.md b/kubernetes/docs/V1beta2StatefulSetSpec.md index 33d524c43c..1703de2f7c 100644 --- a/kubernetes/docs/V1beta2StatefulSetSpec.md +++ b/kubernetes/docs/V1beta2StatefulSetSpec.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **pod_management_policy** | **str** | podManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. The default policy is `OrderedReady`, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is `Parallel` which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once. | [optional] **replicas** | **int** | replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1. | [optional] **revision_history_limit** | **int** | revisionHistoryLimit is the maximum number of revisions that will be maintained in the StatefulSet's revision history. The revision history consists of all revisions not represented by a currently applied StatefulSetSpec version. The default value is 10. | [optional] -**selector** | [**V1LabelSelector**](V1LabelSelector.md) | selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors | [optional] +**selector** | [**V1LabelSelector**](V1LabelSelector.md) | selector is a label query over pods that should match the replica count. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors | **service_name** | **str** | serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller. | **template** | [**V1PodTemplateSpec**](V1PodTemplateSpec.md) | template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet. | **update_strategy** | [**V1beta2StatefulSetUpdateStrategy**](V1beta2StatefulSetUpdateStrategy.md) | updateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template. | [optional] diff --git a/scripts/swagger.json b/scripts/swagger.json index a9dd537140..06d418fd72 100644 --- a/scripts/swagger.json +++ b/scripts/swagger.json @@ -56869,6 +56869,7 @@ "v1beta2.StatefulSetSpec": { "description": "A StatefulSetSpec is the specification of a StatefulSet.", "required": [ + "selector", "template", "serviceName" ], @@ -56888,7 +56889,7 @@ "format": "int32" }, "selector": { - "description": "selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", + "description": "selector is a label query over pods that should match the replica count. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", "$ref": "#/definitions/v1.LabelSelector" }, "serviceName": { @@ -57206,6 +57207,9 @@ }, "v1beta2.ReplicaSetSpec": { "description": "ReplicaSetSpec is the specification of a ReplicaSet.", + "required": [ + "selector" + ], "properties": { "minReadySeconds": { "description": "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)", @@ -57218,7 +57222,7 @@ "format": "int32" }, "selector": { - "description": "Selector is a label query over pods that should match the replica count. If the selector is empty, it is defaulted to the labels present on the pod template. Label keys and values that must match in order to be controlled by this replica set. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", + "description": "Selector is a label query over pods that should match the replica count. Label keys and values that must match in order to be controlled by this replica set. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", "$ref": "#/definitions/v1.LabelSelector" }, "template": { @@ -59648,6 +59652,7 @@ "v1beta2.DaemonSetSpec": { "description": "DaemonSetSpec is the specification of a daemon set.", "required": [ + "selector", "template" ], "properties": { @@ -59662,7 +59667,7 @@ "format": "int32" }, "selector": { - "description": "A label query over pods that are managed by the daemon set. Must match in order to be controlled. If empty, defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", + "description": "A label query over pods that are managed by the daemon set. Must match in order to be controlled. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", "$ref": "#/definitions/v1.LabelSelector" }, "template": { @@ -66620,6 +66625,7 @@ "v1beta2.DeploymentSpec": { "description": "DeploymentSpec is the specification of the desired behavior of the Deployment.", "required": [ + "selector", "template" ], "properties": { @@ -66648,7 +66654,7 @@ "format": "int32" }, "selector": { - "description": "Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment.", + "description": "Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels.", "$ref": "#/definitions/v1.LabelSelector" }, "strategy": { @@ -67564,4 +67570,4 @@ "BearerToken": [] } ] -} +} \ No newline at end of file