From 557a3e06ccba10b76122298f349225682affda63 Mon Sep 17 00:00:00 2001 From: travisn Date: Mon, 19 Jun 2023 18:38:32 -0600 Subject: [PATCH] core: api updates for controller runtime v0.15 For the controller runtime v0.15 there are some breaking changes to the api that need to be updated. Signed-off-by: travisn --- .../charts/rook-ceph/templates/resources.yaml | 88 +++++++++---------- deploy/examples/crds.yaml | 88 +++++++++---------- pkg/apis/ceph.rook.io/v1/cluster.go | 23 ++--- pkg/apis/ceph.rook.io/v1/cluster_test.go | 12 +-- pkg/apis/ceph.rook.io/v1/nfs.go | 27 +++--- pkg/apis/ceph.rook.io/v1/nfs_test.go | 2 +- pkg/apis/ceph.rook.io/v1/notification.go | 17 ++-- pkg/apis/ceph.rook.io/v1/notification_test.go | 6 +- pkg/apis/ceph.rook.io/v1/object.go | 17 ++-- pkg/apis/ceph.rook.io/v1/pool.go | 23 ++--- pkg/apis/ceph.rook.io/v1/pool_test.go | 4 +- pkg/apis/ceph.rook.io/v1/radosnamespace.go | 15 ++-- .../ceph.rook.io/v1/radosnamespace_test.go | 4 +- pkg/apis/ceph.rook.io/v1/subvolumegroup.go | 15 ++-- .../ceph.rook.io/v1/subvolumegroup_test.go | 4 +- pkg/apis/ceph.rook.io/v1/topic.go | 17 ++-- pkg/apis/ceph.rook.io/v1/topic_test.go | 6 +- pkg/daemon/ceph/client/filesystem.go | 5 +- pkg/daemon/multus/resources.go | 2 +- pkg/operator/ceph/client/controller.go | 15 ++-- pkg/operator/ceph/cluster/controller.go | 55 ++++++------ pkg/operator/ceph/cluster/controller_test.go | 1 + pkg/operator/ceph/cluster/mon/mon.go | 2 +- pkg/operator/ceph/cluster/nodedaemon/add.go | 10 +-- pkg/operator/ceph/cluster/rbd/controller.go | 18 ++-- pkg/operator/ceph/controller.go | 12 ++- .../ceph/controller/controller_utils_test.go | 2 + pkg/operator/ceph/controller/handler.go | 2 +- pkg/operator/ceph/controller/handler_test.go | 2 +- pkg/operator/ceph/csi/controller.go | 11 ++- .../ceph/disruption/clusterdisruption/add.go | 19 ++-- pkg/operator/ceph/file/controller.go | 15 ++-- pkg/operator/ceph/file/mirror/controller.go | 12 +-- .../ceph/file/subvolumegroup/controller.go | 2 +- pkg/operator/ceph/nfs/controller.go | 15 ++-- pkg/operator/ceph/object/bucket/controller.go | 11 ++- pkg/operator/ceph/object/controller.go | 13 +-- pkg/operator/ceph/object/controller_test.go | 19 +++- .../ceph/object/notification/controller.go | 2 +- .../notification/obc_label_controller.go | 2 +- pkg/operator/ceph/object/realm/controller.go | 2 +- pkg/operator/ceph/object/topic/controller.go | 4 +- pkg/operator/ceph/object/user/controller.go | 14 +-- pkg/operator/ceph/object/zone/controller.go | 2 +- .../ceph/object/zonegroup/controller.go | 2 +- pkg/operator/ceph/pool/controller.go | 5 +- .../ceph/pool/radosnamespace/controller.go | 2 +- pkg/operator/k8sutil/job.go | 2 +- tests/framework/installer/ceph_installer.go | 5 +- tests/framework/utils/k8s_helper.go | 2 +- tests/integration/ceph_base_file_test.go | 6 +- tests/integration/ceph_base_object_test.go | 2 +- 52 files changed, 363 insertions(+), 300 deletions(-) diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml index e9070b79f..3f290047c 100644 --- a/deploy/charts/rook-ceph/templates/resources.yaml +++ b/deploy/charts/rook-ceph/templates/resources.yaml @@ -1085,7 +1085,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -1109,7 +1109,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1197,7 +1197,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -1221,7 +1221,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1481,7 +1481,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -1554,7 +1554,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -1700,7 +1700,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -1773,7 +1773,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -1825,7 +1825,7 @@ spec: description: The Hostname of this endpoint type: string ip: - description: 'The IP of this endpoint. May not be loopback (127.0.0.0/8), link-local (169.254.0.0/16), or link-local multicast ((224.0.0.0/24). IPv6 is also accepted but not fully supported on all platforms. Also, certain kubernetes components, like kube-proxy, are not IPv6 ready. TODO: This should allow hostname or IP, See #4447.' + description: The IP of this endpoint. May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), or link-local multicast (224.0.0.0/24 or ff02::/16). type: string nodeName: description: 'Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node.' @@ -2474,7 +2474,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -2555,7 +2555,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object description: Resources set resource requests and limits @@ -2704,7 +2704,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -2820,7 +2820,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -2893,7 +2893,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -3486,7 +3486,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -4054,7 +4054,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -4122,7 +4122,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -4245,7 +4245,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -4318,7 +4318,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -4474,7 +4474,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -4547,7 +4547,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -5324,7 +5324,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -5394,7 +5394,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object type: object @@ -5864,7 +5864,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -5888,7 +5888,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -6482,7 +6482,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -6553,7 +6553,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -6580,7 +6580,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -6604,7 +6604,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -7102,7 +7102,7 @@ spec: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object @@ -7366,7 +7366,7 @@ spec: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object @@ -7646,7 +7646,7 @@ spec: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object @@ -7903,7 +7903,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object sssdConfigFile: @@ -7957,7 +7957,7 @@ spec: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object @@ -8731,7 +8731,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -8802,7 +8802,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -9721,7 +9721,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -9796,7 +9796,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -9849,7 +9849,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -9873,7 +9873,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -9959,7 +9959,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -9983,7 +9983,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -11649,7 +11649,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -11720,7 +11720,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml index 954045e16..2fbca1617 100644 --- a/deploy/examples/crds.yaml +++ b/deploy/examples/crds.yaml @@ -1083,7 +1083,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -1107,7 +1107,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1195,7 +1195,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -1219,7 +1219,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1479,7 +1479,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -1552,7 +1552,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -1698,7 +1698,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -1771,7 +1771,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -1823,7 +1823,7 @@ spec: description: The Hostname of this endpoint type: string ip: - description: 'The IP of this endpoint. May not be loopback (127.0.0.0/8), link-local (169.254.0.0/16), or link-local multicast ((224.0.0.0/24). IPv6 is also accepted but not fully supported on all platforms. Also, certain kubernetes components, like kube-proxy, are not IPv6 ready. TODO: This should allow hostname or IP, See #4447.' + description: The IP of this endpoint. May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), or link-local multicast (224.0.0.0/24 or ff02::/16). type: string nodeName: description: 'Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node.' @@ -2472,7 +2472,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -2553,7 +2553,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object description: Resources set resource requests and limits @@ -2702,7 +2702,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -2818,7 +2818,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -2891,7 +2891,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -3484,7 +3484,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -4052,7 +4052,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -4120,7 +4120,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -4243,7 +4243,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -4316,7 +4316,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -4472,7 +4472,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object selector: @@ -4545,7 +4545,7 @@ spec: conditions: description: conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'. items: - description: PersistentVolumeClaimCondition contails details about state of pvc + description: PersistentVolumeClaimCondition contains details about state of pvc properties: lastProbeTime: description: lastProbeTime is the time we probed the condition. @@ -5321,7 +5321,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -5391,7 +5391,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object type: object @@ -5860,7 +5860,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -5884,7 +5884,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -6478,7 +6478,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -6549,7 +6549,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -6576,7 +6576,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -6600,7 +6600,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -7096,7 +7096,7 @@ spec: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object @@ -7360,7 +7360,7 @@ spec: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object @@ -7640,7 +7640,7 @@ spec: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object @@ -7897,7 +7897,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object sssdConfigFile: @@ -7951,7 +7951,7 @@ spec: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: 'sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object @@ -8725,7 +8725,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -8796,7 +8796,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -9713,7 +9713,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -9788,7 +9788,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true @@ -9841,7 +9841,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -9865,7 +9865,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -9951,7 +9951,7 @@ spec: format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. This is a beta field and requires enabling GRPCContainerProbe feature gate. + description: GRPC specifies an action involving a GRPC port. properties: port: description: Port number of the gRPC service. Number must be in the range 1 to 65535. @@ -9975,7 +9975,7 @@ spec: description: HTTPHeader describes a custom header to be used in HTTP probes properties: name: - description: The header field name + description: The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -11637,7 +11637,7 @@ spec: type: object x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + description: "MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default)." items: type: string type: array @@ -11708,7 +11708,7 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object x-kubernetes-preserve-unknown-fields: true diff --git a/pkg/apis/ceph.rook.io/v1/cluster.go b/pkg/apis/ceph.rook.io/v1/cluster.go index 985ebd75d..60866375b 100644 --- a/pkg/apis/ceph.rook.io/v1/cluster.go +++ b/pkg/apis/ceph.rook.io/v1/cluster.go @@ -22,6 +22,7 @@ import ( "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) // compile-time assertions ensures CephCluster implements webhook.Validator so a webhook builder @@ -49,48 +50,48 @@ func (c *ClusterSpec) IsStretchCluster() bool { return c.Mon.StretchCluster != nil && len(c.Mon.StretchCluster.Zones) > 0 } -func (c *CephCluster) ValidateCreate() error { +func (c *CephCluster) ValidateCreate() (admission.Warnings, error) { logger.Infof("validate create cephcluster %q", c.ObjectMeta.Name) //If external mode enabled, then check if other fields are empty if c.Spec.External.Enable { if c.Spec.Mon != (MonSpec{}) || c.Spec.Dashboard != (DashboardSpec{}) || !reflect.DeepEqual(c.Spec.Monitoring, (MonitoringSpec{})) || c.Spec.DisruptionManagement != (DisruptionManagementSpec{}) || len(c.Spec.Mgr.Modules) > 0 || len(c.Spec.Network.Provider) > 0 || len(c.Spec.Network.Selectors) > 0 { - return errors.New("invalid create : external mode enabled cannot have mon,dashboard,monitoring,network,disruptionManagement,storage fields in CR") + return nil, errors.New("invalid create : external mode enabled cannot have mon,dashboard,monitoring,network,disruptionManagement,storage fields in CR") } } - return nil + return nil, nil } -func (c *CephCluster) ValidateUpdate(old runtime.Object) error { +func (c *CephCluster) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { logger.Infof("validate update cephcluster %q", c.ObjectMeta.Name) occ := old.(*CephCluster) return validateUpdatedCephCluster(c, occ) } -func (c *CephCluster) ValidateDelete() error { - return nil +func (c *CephCluster) ValidateDelete() (admission.Warnings, error) { + return nil, nil } -func validateUpdatedCephCluster(updatedCephCluster *CephCluster, found *CephCluster) error { +func validateUpdatedCephCluster(updatedCephCluster *CephCluster, found *CephCluster) (admission.Warnings, error) { if updatedCephCluster.Spec.DataDirHostPath != found.Spec.DataDirHostPath { - return errors.Errorf("invalid update: DataDirHostPath change from %q to %q is not allowed", found.Spec.DataDirHostPath, updatedCephCluster.Spec.DataDirHostPath) + return nil, errors.Errorf("invalid update: DataDirHostPath change from %q to %q is not allowed", found.Spec.DataDirHostPath, updatedCephCluster.Spec.DataDirHostPath) } // Allow an attempt to enable or disable host networking, but not other provider changes oldProvider := updatedCephCluster.Spec.Network.Provider newProvider := found.Spec.Network.Provider if oldProvider != newProvider && oldProvider != "host" && newProvider != "host" { - return errors.Errorf("invalid update: Provider change from %q to %q is not allowed", found.Spec.Network.Provider, updatedCephCluster.Spec.Network.Provider) + return nil, errors.Errorf("invalid update: Provider change from %q to %q is not allowed", found.Spec.Network.Provider, updatedCephCluster.Spec.Network.Provider) } if len(updatedCephCluster.Spec.Storage.StorageClassDeviceSets) == len(found.Spec.Storage.StorageClassDeviceSets) { for i, storageClassDeviceSet := range found.Spec.Storage.StorageClassDeviceSets { if storageClassDeviceSet.Encrypted != updatedCephCluster.Spec.Storage.StorageClassDeviceSets[i].Encrypted { - return errors.Errorf("invalid update: StorageClassDeviceSet %q encryption change from %t to %t is not allowed", storageClassDeviceSet.Name, found.Spec.Storage.StorageClassDeviceSets[i].Encrypted, storageClassDeviceSet.Encrypted) + return nil, errors.Errorf("invalid update: StorageClassDeviceSet %q encryption change from %t to %t is not allowed", storageClassDeviceSet.Name, found.Spec.Storage.StorageClassDeviceSets[i].Encrypted, storageClassDeviceSet.Encrypted) } } } - return nil + return nil, nil } func (c *CephCluster) GetStatusConditions() *[]Condition { diff --git a/pkg/apis/ceph.rook.io/v1/cluster_test.go b/pkg/apis/ceph.rook.io/v1/cluster_test.go index f636b485d..7d434dd6b 100644 --- a/pkg/apis/ceph.rook.io/v1/cluster_test.go +++ b/pkg/apis/ceph.rook.io/v1/cluster_test.go @@ -43,7 +43,7 @@ func Test_validateUpdatedCephCluster(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if err := validateUpdatedCephCluster(tt.args.updatedCephCluster, tt.args.found); (err != nil) != tt.wantErr { + if _, err := validateUpdatedCephCluster(tt.args.updatedCephCluster, tt.args.found); (err != nil) != tt.wantErr { t.Errorf("validateUpdatedCephCluster() error = %v, wantErr %v", err, tt.wantErr) } }) @@ -59,13 +59,13 @@ func TestCephClusterValidateCreate(t *testing.T) { DataDirHostPath: "/var/lib/rook", }, } - err := c.ValidateCreate() + _, err := c.ValidateCreate() assert.NoError(t, err) c.Spec.External.Enable = true c.Spec.Monitoring = MonitoringSpec{ Enabled: true, } - err = c.ValidateCreate() + _, err = c.ValidateCreate() assert.Error(t, err) } @@ -86,14 +86,14 @@ func TestCephClusterValidateUpdate(t *testing.T) { }, }, } - err := c.ValidateCreate() + _, err := c.ValidateCreate() assert.NoError(t, err) // Updating the CRD specs with invalid values uc := c.DeepCopy() uc.Spec.DataDirHostPath = "var/rook" uc.Spec.Storage.StorageClassDeviceSets[0].Encrypted = false - err = uc.ValidateUpdate(c) + _, err = uc.ValidateUpdate(c) assert.Error(t, err) // reverting the to older hostPath @@ -108,6 +108,6 @@ func TestCephClusterValidateUpdate(t *testing.T) { }, } - err = uc.ValidateUpdate(c) + _, err = uc.ValidateUpdate(c) assert.NoError(t, err) } diff --git a/pkg/apis/ceph.rook.io/v1/nfs.go b/pkg/apis/ceph.rook.io/v1/nfs.go index 7560beedb..7fa93216b 100644 --- a/pkg/apis/ceph.rook.io/v1/nfs.go +++ b/pkg/apis/ceph.rook.io/v1/nfs.go @@ -22,6 +22,7 @@ import ( "github.com/pkg/errors" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) // KerberosEnabled returns true if Kerberos is enabled from the spec. @@ -50,11 +51,11 @@ func (n *CephNFS) IsHostNetwork(c *ClusterSpec) bool { return c.Network.IsHost() } -func (n *CephNFS) ValidateCreate() error { +func (n *CephNFS) ValidateCreate() (admission.Warnings, error) { return n.Spec.Security.Validate() } -func (n *CephNFS) ValidateUpdate(old runtime.Object) error { +func (n *CephNFS) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { return n.ValidateCreate() } @@ -62,38 +63,38 @@ func (n *CephNFS) ValidateDelete() error { return nil } -func (sec *NFSSecuritySpec) Validate() error { +func (sec *NFSSecuritySpec) Validate() (admission.Warnings, error) { if sec == nil { - return nil + return nil, nil } if sec.SSSD != nil { sidecar := sec.SSSD.Sidecar if sidecar == nil { - return errors.New("System Security Services Daemon (SSSD) is enabled, but no runtime option is specified; supported: [runInSidecar]") + return nil, errors.New("System Security Services Daemon (SSSD) is enabled, but no runtime option is specified; supported: [runInSidecar]") } if sidecar.Image == "" { - return errors.New("System Security Services Daemon (SSSD) sidecar is enabled, but no image is specified") + return nil, errors.New("System Security Services Daemon (SSSD) sidecar is enabled, but no image is specified") } if volSourceExistsAndIsEmpty(sidecar.SSSDConfigFile.VolumeSource.ToKubernetesVolumeSource()) { - return errors.New("System Security Services Daemon (SSSD) sidecar is enabled with config from a VolumeSource, but no source is specified") + return nil, errors.New("System Security Services Daemon (SSSD) sidecar is enabled with config from a VolumeSource, but no source is specified") } subDirs := map[string]bool{} for _, additionalFile := range sidecar.AdditionalFiles { subDir := additionalFile.SubPath if subDir == "" { - return errors.New("System Security Services Daemon (SSSD) sidecar is enabled with additional file having no subPath specified") + return nil, errors.New("System Security Services Daemon (SSSD) sidecar is enabled with additional file having no subPath specified") } if volSourceExistsAndIsEmpty(additionalFile.VolumeSource.ToKubernetesVolumeSource()) { - return errors.Errorf("System Security Services Daemon (SSSD) sidecar is enabled with additional file (subPath %q), but no source is specified", subDir) + return nil, errors.Errorf("System Security Services Daemon (SSSD) sidecar is enabled with additional file (subPath %q), but no source is specified", subDir) } if _, ok := subDirs[subDir]; ok { - return errors.Errorf("System Security Services Daemon (SSSD) sidecar is enabled with additional file containing duplicate subPath %q", subDir) + return nil, errors.Errorf("System Security Services Daemon (SSSD) sidecar is enabled with additional file containing duplicate subPath %q", subDir) } subDirs[subDir] = true } @@ -102,15 +103,15 @@ func (sec *NFSSecuritySpec) Validate() error { krb := sec.Kerberos if krb != nil { if volSourceExistsAndIsEmpty(krb.ConfigFiles.VolumeSource.ToKubernetesVolumeSource()) { - return errors.New("Kerberos is enabled with config from a VolumeSource, but no source is specified") + return nil, errors.New("Kerberos is enabled with config from a VolumeSource, but no source is specified") } if volSourceExistsAndIsEmpty(krb.KeytabFile.VolumeSource.ToKubernetesVolumeSource()) { - return errors.New("Kerberos is enabled with keytab from a VolumeSource, but no source is specified") + return nil, errors.New("Kerberos is enabled with keytab from a VolumeSource, but no source is specified") } } - return nil + return nil, nil } func volSourceExistsAndIsEmpty(v *v1.VolumeSource) bool { diff --git a/pkg/apis/ceph.rook.io/v1/nfs_test.go b/pkg/apis/ceph.rook.io/v1/nfs_test.go index b2ba10c8f..02232f7cb 100644 --- a/pkg/apis/ceph.rook.io/v1/nfs_test.go +++ b/pkg/apis/ceph.rook.io/v1/nfs_test.go @@ -147,7 +147,7 @@ func TestNFSSecuritySpec_Validate(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if err := tt.security.Validate(); (err != nil) != tt.wantErr { + if _, err := tt.security.Validate(); (err != nil) != tt.wantErr { t.Errorf("NFSSecuritySpec.Validate() error = %v, wantErr %v", err, tt.wantErr) } }) diff --git a/pkg/apis/ceph.rook.io/v1/notification.go b/pkg/apis/ceph.rook.io/v1/notification.go index 59d201708..511b303d2 100644 --- a/pkg/apis/ceph.rook.io/v1/notification.go +++ b/pkg/apis/ceph.rook.io/v1/notification.go @@ -19,6 +19,7 @@ package v1 import ( "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) // compile-time assertions ensures CephBucketNotification implements webhook.Validator so a webhook builder @@ -31,23 +32,23 @@ func ValidateNotificationSpec(n *CephBucketNotification) error { return nil } -func (n *CephBucketNotification) ValidateCreate() error { +func (n *CephBucketNotification) ValidateCreate() (admission.Warnings, error) { logger.Infof("validate create cephbucketnotification %v", n) if err := ValidateNotificationSpec(n); err != nil { - return err + return nil, err } - return nil + return nil, nil } -func (n *CephBucketNotification) ValidateUpdate(old runtime.Object) error { +func (n *CephBucketNotification) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { logger.Infof("validate update cephbucketnotification %v", n) if err := ValidateNotificationSpec(n); err != nil { - return err + return nil, err } - return nil + return nil, nil } -func (n *CephBucketNotification) ValidateDelete() error { +func (n *CephBucketNotification) ValidateDelete() (admission.Warnings, error) { logger.Infof("validate delete cephbucketnotification %v", n) - return nil + return nil, nil } diff --git a/pkg/apis/ceph.rook.io/v1/notification_test.go b/pkg/apis/ceph.rook.io/v1/notification_test.go index 128b7a1aa..6b7096fb7 100644 --- a/pkg/apis/ceph.rook.io/v1/notification_test.go +++ b/pkg/apis/ceph.rook.io/v1/notification_test.go @@ -69,17 +69,17 @@ func TestPublicNotificationValidation(t *testing.T) { } t.Run("create", func(t *testing.T) { - err := notification.ValidateCreate() + _, err := notification.ValidateCreate() assert.NoError(t, err) }) t.Run("update", func(t *testing.T) { - err := notification.ValidateUpdate(notification) + _, err := notification.ValidateUpdate(notification) assert.NoError(t, err) }) t.Run("delete", func(t *testing.T) { - err := notification.ValidateDelete() + _, err := notification.ValidateDelete() assert.NoError(t, err) }) } diff --git a/pkg/apis/ceph.rook.io/v1/object.go b/pkg/apis/ceph.rook.io/v1/object.go index a6ae0081d..22b0fb050 100644 --- a/pkg/apis/ceph.rook.io/v1/object.go +++ b/pkg/apis/ceph.rook.io/v1/object.go @@ -20,6 +20,7 @@ import ( "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) // compile-time assertions ensures CephObjectStore implements webhook.Validator so a webhook builder @@ -69,12 +70,12 @@ func (s *ObjectRealmSpec) IsPullRealm() bool { return s.Pull.Endpoint != "" } -func (o *CephObjectStore) ValidateCreate() error { +func (o *CephObjectStore) ValidateCreate() (admission.Warnings, error) { logger.Infof("validate create cephobjectstore %v", o) if err := ValidateObjectSpec(o); err != nil { - return err + return nil, err } - return nil + return nil, nil } // ValidateObjectSpec validate the object store arguments @@ -105,17 +106,17 @@ func ValidateObjectSpec(gs *CephObjectStore) error { return nil } -func (o *CephObjectStore) ValidateUpdate(old runtime.Object) error { +func (o *CephObjectStore) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { logger.Info("validate update cephobjectstore") err := ValidateObjectSpec(o) if err != nil { - return err + return nil, err } - return nil + return nil, nil } -func (o *CephObjectStore) ValidateDelete() error { - return nil +func (o *CephObjectStore) ValidateDelete() (admission.Warnings, error) { + return nil, nil } func (s *ObjectStoreSpec) GetServiceServingCert() string { diff --git a/pkg/apis/ceph.rook.io/v1/pool.go b/pkg/apis/ceph.rook.io/v1/pool.go index c14d74003..fc24f1d00 100644 --- a/pkg/apis/ceph.rook.io/v1/pool.go +++ b/pkg/apis/ceph.rook.io/v1/pool.go @@ -21,6 +21,7 @@ import ( "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) var ( @@ -50,14 +51,14 @@ func (p *ReplicatedSpec) IsTargetRatioEnabled() bool { return p.TargetSizeRatio != 0 } -func (p *CephBlockPool) ValidateCreate() error { +func (p *CephBlockPool) ValidateCreate() (admission.Warnings, error) { logger.Infof("validate create cephblockpool %v", p) err := ValidateCephBlockPool(p) if err != nil { - return err + return nil, err } - return nil + return nil, nil } // ValidateCephBlockPool validates specifically a CephBlockPool's spec (not just any NamedPoolSpec) @@ -111,32 +112,32 @@ func (p *CephBlockPool) ToNamedPoolSpec() NamedPoolSpec { } } -func (p *CephBlockPool) ValidateUpdate(old runtime.Object) error { +func (p *CephBlockPool) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { logger.Info("validate update cephblockpool") ocbp := old.(*CephBlockPool) err := ValidateCephBlockPool(p) if err != nil { - return err + return nil, err } if ocbp.Spec.Name != p.Spec.Name { - return errors.New("invalid update: pool name cannot be changed") + return nil, errors.New("invalid update: pool name cannot be changed") } if p.Spec.ErasureCoded.CodingChunks > 0 || p.Spec.ErasureCoded.DataChunks > 0 || p.Spec.ErasureCoded.Algorithm != "" { if ocbp.Spec.Replicated.Size > 0 || ocbp.Spec.Replicated.TargetSizeRatio > 0 { - return errors.New("invalid update: replicated field is set already in previous object. cannot be changed to use erasurecoded") + return nil, errors.New("invalid update: replicated field is set already in previous object. cannot be changed to use erasurecoded") } } if p.Spec.Replicated.Size > 0 || p.Spec.Replicated.TargetSizeRatio > 0 { if ocbp.Spec.ErasureCoded.CodingChunks > 0 || ocbp.Spec.ErasureCoded.DataChunks > 0 || ocbp.Spec.ErasureCoded.Algorithm != "" { - return errors.New("invalid update: erasurecoded field is set already in previous object. cannot be changed to use replicated") + return nil, errors.New("invalid update: erasurecoded field is set already in previous object. cannot be changed to use replicated") } } - return nil + return nil, nil } -func (p *CephBlockPool) ValidateDelete() error { - return nil +func (p *CephBlockPool) ValidateDelete() (admission.Warnings, error) { + return nil, nil } func (p *CephBlockPool) GetStatusConditions() *[]Condition { diff --git a/pkg/apis/ceph.rook.io/v1/pool_test.go b/pkg/apis/ceph.rook.io/v1/pool_test.go index 1b37403c1..e0c902178 100644 --- a/pkg/apis/ceph.rook.io/v1/pool_test.go +++ b/pkg/apis/ceph.rook.io/v1/pool_test.go @@ -59,13 +59,13 @@ func TestCephBlockPoolValidateUpdate(t *testing.T) { up := p.DeepCopy() up.Spec.ErasureCoded.DataChunks = 2 up.Spec.ErasureCoded.CodingChunks = 1 - err := up.ValidateUpdate(p) + _, err := up.ValidateUpdate(p) assert.Error(t, err) // validate with different name in Spec.Name ip := p.DeepCopy() ip.Spec.Name = "new-ec-pool" - err = ip.ValidateUpdate(p) + _, err = ip.ValidateUpdate(p) assert.Error(t, err) } diff --git a/pkg/apis/ceph.rook.io/v1/radosnamespace.go b/pkg/apis/ceph.rook.io/v1/radosnamespace.go index 000c14e7d..deece6b09 100644 --- a/pkg/apis/ceph.rook.io/v1/radosnamespace.go +++ b/pkg/apis/ceph.rook.io/v1/radosnamespace.go @@ -20,23 +20,24 @@ import ( "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) var _ webhook.Validator = &CephBlockPoolRadosNamespace{} -func (c *CephBlockPoolRadosNamespace) ValidateCreate() error { - return nil +func (c *CephBlockPoolRadosNamespace) ValidateCreate() (admission.Warnings, error) { + return nil, nil } -func (c *CephBlockPoolRadosNamespace) ValidateUpdate(old runtime.Object) error { +func (c *CephBlockPoolRadosNamespace) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { logger.Infof("validate update %s/%s CephBlockPoolRadosNamespace", c.Namespace, c.Name) oprs := old.(*CephBlockPoolRadosNamespace) if oprs.Spec.BlockPoolName != c.Spec.BlockPoolName { - return errors.New("invalid update: blockpool name cannot be changed") + return nil, errors.New("invalid update: blockpool name cannot be changed") } - return nil + return nil, nil } -func (c *CephBlockPoolRadosNamespace) ValidateDelete() error { - return nil +func (c *CephBlockPoolRadosNamespace) ValidateDelete() (admission.Warnings, error) { + return nil, nil } diff --git a/pkg/apis/ceph.rook.io/v1/radosnamespace_test.go b/pkg/apis/ceph.rook.io/v1/radosnamespace_test.go index ed344a772..3df9a01e4 100644 --- a/pkg/apis/ceph.rook.io/v1/radosnamespace_test.go +++ b/pkg/apis/ceph.rook.io/v1/radosnamespace_test.go @@ -34,10 +34,10 @@ func TestCephBlockPoolRadosNamespaceValidateUpdate(t *testing.T) { } ur := rn.DeepCopy() // validate with same pool name - err := ur.ValidateUpdate(rn) + _, err := ur.ValidateUpdate(rn) assert.NoError(t, err) // validate with different pool name ur.Spec.BlockPoolName = "new-pool-name" - err = ur.ValidateUpdate(rn) + _, err = ur.ValidateUpdate(rn) assert.Error(t, err) } diff --git a/pkg/apis/ceph.rook.io/v1/subvolumegroup.go b/pkg/apis/ceph.rook.io/v1/subvolumegroup.go index 9fc528927..5677d5f55 100644 --- a/pkg/apis/ceph.rook.io/v1/subvolumegroup.go +++ b/pkg/apis/ceph.rook.io/v1/subvolumegroup.go @@ -20,23 +20,24 @@ import ( "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) var _ webhook.Validator = &CephFilesystemSubVolumeGroup{} -func (c *CephFilesystemSubVolumeGroup) ValidateCreate() error { - return nil +func (c *CephFilesystemSubVolumeGroup) ValidateCreate() (admission.Warnings, error) { + return nil, nil } -func (c *CephFilesystemSubVolumeGroup) ValidateUpdate(old runtime.Object) error { +func (c *CephFilesystemSubVolumeGroup) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { logger.Infof("validate update %s/%s CephFilesystemSubVolumeGroup", c.Namespace, c.Name) sg := old.(*CephFilesystemSubVolumeGroup) if sg.Spec.FilesystemName != c.Spec.FilesystemName { - return errors.New("invalid update: filesystem name cannot be changed") + return nil, errors.New("invalid update: filesystem name cannot be changed") } - return nil + return nil, nil } -func (c *CephFilesystemSubVolumeGroup) ValidateDelete() error { - return nil +func (c *CephFilesystemSubVolumeGroup) ValidateDelete() (admission.Warnings, error) { + return nil, nil } diff --git a/pkg/apis/ceph.rook.io/v1/subvolumegroup_test.go b/pkg/apis/ceph.rook.io/v1/subvolumegroup_test.go index a01366038..80665f2ef 100644 --- a/pkg/apis/ceph.rook.io/v1/subvolumegroup_test.go +++ b/pkg/apis/ceph.rook.io/v1/subvolumegroup_test.go @@ -34,10 +34,10 @@ func TestCephFilesystemSubVolumeGroupValidateUpdate(t *testing.T) { } ur := rn.DeepCopy() // validate with same filesystem name - err := ur.ValidateUpdate(rn) + _, err := ur.ValidateUpdate(rn) assert.NoError(t, err) // validate with different filesystem name ur.Spec.FilesystemName = "new-filesystem-name" - err = ur.ValidateUpdate(rn) + _, err = ur.ValidateUpdate(rn) assert.Error(t, err) } diff --git a/pkg/apis/ceph.rook.io/v1/topic.go b/pkg/apis/ceph.rook.io/v1/topic.go index 58a9552e1..c6439f371 100644 --- a/pkg/apis/ceph.rook.io/v1/topic.go +++ b/pkg/apis/ceph.rook.io/v1/topic.go @@ -23,6 +23,7 @@ import ( "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) // compile-time assertions ensures CephBucketTopic implements webhook.Validator so a webhook builder @@ -89,23 +90,23 @@ func ValidateTopicSpec(t *CephBucketTopic) error { return nil } -func (t *CephBucketTopic) ValidateCreate() error { +func (t *CephBucketTopic) ValidateCreate() (admission.Warnings, error) { logger.Infof("validate create cephbuckettopic %v", t) if err := ValidateTopicSpec(t); err != nil { - return err + return nil, err } - return nil + return nil, nil } -func (t *CephBucketTopic) ValidateUpdate(old runtime.Object) error { +func (t *CephBucketTopic) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { logger.Info("validate update cephbuckettopic") if err := ValidateTopicSpec(t); err != nil { - return err + return nil, err } - return nil + return nil, nil } -func (t *CephBucketTopic) ValidateDelete() error { +func (t *CephBucketTopic) ValidateDelete() (admission.Warnings, error) { logger.Info("validate delete cephbuckettopic") - return nil + return nil, nil } diff --git a/pkg/apis/ceph.rook.io/v1/topic_test.go b/pkg/apis/ceph.rook.io/v1/topic_test.go index 8a5b3734a..e2b74a109 100644 --- a/pkg/apis/ceph.rook.io/v1/topic_test.go +++ b/pkg/apis/ceph.rook.io/v1/topic_test.go @@ -188,17 +188,17 @@ func TestPublicTopicValidation(t *testing.T) { } t.Run("create", func(t *testing.T) { - err := topic.ValidateCreate() + _, err := topic.ValidateCreate() assert.NoError(t, err) }) t.Run("update", func(t *testing.T) { - err := topic.ValidateUpdate(topic) + _, err := topic.ValidateUpdate(topic) assert.NoError(t, err) }) t.Run("delete", func(t *testing.T) { - err := topic.ValidateDelete() + _, err := topic.ValidateDelete() assert.NoError(t, err) }) } diff --git a/pkg/daemon/ceph/client/filesystem.go b/pkg/daemon/ceph/client/filesystem.go index 48176d779..4d2bd3621 100644 --- a/pkg/daemon/ceph/client/filesystem.go +++ b/pkg/daemon/ceph/client/filesystem.go @@ -17,6 +17,7 @@ limitations under the License. package client import ( + ctx "context" "encoding/json" "fmt" "strconv" @@ -231,7 +232,7 @@ func WaitForActiveRanks( } logger.Infof("waiting %.2f second(s) for number of active mds daemons for fs %s to become %s", float64(timeout/time.Second), fsName, countText) - err := wait.Poll(3*time.Second, timeout, func() (bool, error) { + err := wait.PollUntilContextTimeout(clusterInfo.Context, 3*time.Second, timeout, true, func(ctx ctx.Context) (bool, error) { fs, err := getFilesystem(context, clusterInfo, fsName) if err != nil { logger.Errorf( @@ -353,7 +354,7 @@ func deleteFSPool(context *clusterd.Context, clusterInfo *ClusterInfo, poolNames // WaitForNoStandbys waits for all standbys go away func WaitForNoStandbys(context *clusterd.Context, clusterInfo *ClusterInfo, timeout time.Duration) error { - err := wait.Poll(3*time.Second, timeout, func() (bool, error) { + err := wait.PollUntilContextTimeout(clusterInfo.Context, 3*time.Second, timeout, true, func(ctx ctx.Context) (bool, error) { mdsDump, err := GetMDSDump(context, clusterInfo) if err != nil { logger.Errorf("failed to get fs dump. %v", err) diff --git a/pkg/daemon/multus/resources.go b/pkg/daemon/multus/resources.go index 874b12cd4..4ef2b4b5c 100644 --- a/pkg/daemon/multus/resources.go +++ b/pkg/daemon/multus/resources.go @@ -307,7 +307,7 @@ func (vt *ValidationTest) cleanUpTestResources() (string, error) { ctx, cancel := context.WithTimeout(ctx, vt.ResourceTimeout) defer cancel() lastSuggestion := "" - err = wait.PollUntilWithContext(ctx, 2*time.Second, func(ctx context.Context) (done bool, err error) { + err = wait.PollUntilContextCancel(ctx, 2*time.Second, true, func(ctx context.Context) (done bool, err error) { _, getErr := vt.Clientset.CoreV1().ConfigMaps(vt.Namespace).Get(ctx, ownerConfigMapName, meta.GetOptions{}) if getErr != nil { if kerrors.IsNotFound(getErr) { diff --git a/pkg/operator/ceph/client/controller.go b/pkg/operator/ceph/client/controller.go index 5c24579f9..4a3235a46 100644 --- a/pkg/operator/ceph/client/controller.go +++ b/pkg/operator/ceph/client/controller.go @@ -98,16 +98,21 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the CephClient CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephClient{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephClient{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } // Watch secrets - err = c.Watch(&source.Kind{Type: &v1.Secret{TypeMeta: metav1.TypeMeta{Kind: "Secret", APIVersion: v1.SchemeGroupVersion.String()}}}, &handler.EnqueueRequestForOwner{ - IsController: true, - OwnerType: &cephv1.CephClient{}, - }, opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephClient{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) + secretSource := source.Kind( + mgr.GetCache(), + &v1.Secret{TypeMeta: metav1.TypeMeta{Kind: "Secret", APIVersion: v1.SchemeGroupVersion.String()}}) + ownerRequest := handler.EnqueueRequestForOwner( + mgr.GetScheme(), + mgr.GetRESTMapper(), + &cephv1.CephClient{}, + ) + err = c.Watch(secretSource, ownerRequest, opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephClient{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) if err != nil { return err } diff --git a/pkg/operator/ceph/cluster/controller.go b/pkg/operator/ceph/cluster/controller.go index cdfd141f2..7ad21dd1b 100644 --- a/pkg/operator/ceph/cluster/controller.go +++ b/pkg/operator/ceph/cluster/controller.go @@ -131,12 +131,12 @@ func add(opManagerContext context.Context, mgr manager.Manager, r reconcile.Reco logger.Info("successfully started") // Watch for changes on the CephCluster CR object + s := source.Kind(mgr.GetCache(), + &cephv1.CephCluster{ + TypeMeta: ControllerTypeMeta, + }) err = c.Watch( - &source.Kind{ - Type: &cephv1.CephCluster{ - TypeMeta: ControllerTypeMeta, - }, - }, + s, &handler.EnqueueRequestForObject{}, watchControllerPredicate(opManagerContext, mgr.GetClient())) if err != nil { @@ -146,13 +146,12 @@ func add(opManagerContext context.Context, mgr manager.Manager, r reconcile.Reco // Watch all other resources of the Ceph Cluster for _, t := range objectsToWatch { err = c.Watch( - &source.Kind{ - Type: t, - }, - &handler.EnqueueRequestForOwner{ - IsController: true, - OwnerType: &cephv1.CephCluster{}, - }, + source.Kind(mgr.GetCache(), t), + handler.EnqueueRequestForOwner( + mgr.GetScheme(), + mgr.GetRESTMapper(), + &cephv1.CephCluster{}, + ), opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephCluster{TypeMeta: ControllerTypeMeta}, mgr.GetScheme())) if err != nil { return err @@ -167,15 +166,15 @@ func add(opManagerContext context.Context, mgr manager.Manager, r reconcile.Reco } // Watch for nodes additions and updates - err = c.Watch( - &source.Kind{ - Type: &corev1.Node{ - TypeMeta: metav1.TypeMeta{ - Kind: "Node", - APIVersion: corev1.SchemeGroupVersion.String(), - }, + nodeKind := source.Kind(mgr.GetCache(), + &corev1.Node{ + TypeMeta: metav1.TypeMeta{ + Kind: "Node", + APIVersion: corev1.SchemeGroupVersion.String(), }, - }, + }) + err = c.Watch( + nodeKind, handler.EnqueueRequestsFromMapFunc(handlerFunc), predicateForNodeWatcher(opManagerContext, mgr.GetClient(), context)) if err != nil { @@ -187,15 +186,15 @@ func add(opManagerContext context.Context, mgr manager.Manager, r reconcile.Reco disableVal := os.Getenv(disableHotplugEnv) if disableVal != "true" { logger.Info("enabling hotplug orchestration") - err = c.Watch( - &source.Kind{ - Type: &corev1.ConfigMap{ - TypeMeta: metav1.TypeMeta{ - Kind: "ConfigMap", - APIVersion: corev1.SchemeGroupVersion.String(), - }, + s := source.Kind(mgr.GetCache(), + &corev1.ConfigMap{ + TypeMeta: metav1.TypeMeta{ + Kind: "ConfigMap", + APIVersion: corev1.SchemeGroupVersion.String(), }, - }, + }) + err = c.Watch( + s, handler.EnqueueRequestsFromMapFunc(handlerFunc), predicateForHotPlugCMWatcher(mgr.GetClient())) if err != nil { diff --git a/pkg/operator/ceph/cluster/controller_test.go b/pkg/operator/ceph/cluster/controller_test.go index 3ed51473d..a7adcefbe 100644 --- a/pkg/operator/ceph/cluster/controller_test.go +++ b/pkg/operator/ceph/cluster/controller_test.go @@ -53,6 +53,7 @@ func TestReconcileDeleteCephCluster(t *testing.T) { Name: clusterName, Namespace: cephNs, DeletionTimestamp: &metav1.Time{Time: time.Now()}, + Finalizers: []string{"cephcluster.ceph.rook.io"}, }, } diff --git a/pkg/operator/ceph/cluster/mon/mon.go b/pkg/operator/ceph/cluster/mon/mon.go index ddc8ca31c..8ea104d67 100644 --- a/pkg/operator/ceph/cluster/mon/mon.go +++ b/pkg/operator/ceph/cluster/mon/mon.go @@ -371,7 +371,7 @@ func (c *Cluster) ConfigureArbiter() error { logger.Infof("enabling stretch mode... waiting for two failure domains of type %q to be found in the CRUSH map after OSD initialization", failureDomain) pollInterval := 5 * time.Second totalWaitTime := 2 * time.Minute - err = wait.Poll(pollInterval, totalWaitTime, func() (bool, error) { + err = wait.PollUntilContextTimeout(c.ClusterInfo.Context, pollInterval, totalWaitTime, true, func(ctx context.Context) (bool, error) { return c.readyToConfigureArbiter(true) }) if err != nil { diff --git a/pkg/operator/ceph/cluster/nodedaemon/add.go b/pkg/operator/ceph/cluster/nodedaemon/add.go index f7838c09f..5fec0dab6 100644 --- a/pkg/operator/ceph/cluster/nodedaemon/add.go +++ b/pkg/operator/ceph/cluster/nodedaemon/add.go @@ -88,7 +88,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { }, } logger.Debugf("watch for changes to the nodes") - err = c.Watch(&source.Kind{Type: &corev1.Node{}}, &handler.EnqueueRequestForObject{}, specChangePredicate) + err = c.Watch(source.Kind(mgr.GetCache(), &corev1.Node{}), &handler.EnqueueRequestForObject{}, specChangePredicate) if err != nil { return errors.Wrap(err, "failed to watch for node changes") } @@ -96,8 +96,8 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { // Watch for changes to the ceph-crash deployments logger.Debugf("watch for changes to the ceph-crash deployments") err = c.Watch( - &source.Kind{Type: &appsv1.Deployment{}}, - handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(obj client.Object) []reconcile.Request { + source.Kind(mgr.GetCache(), &appsv1.Deployment{}), + handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(context context.Context, obj client.Object) []reconcile.Request { deployment, ok := obj.(*appsv1.Deployment) if !ok { return []reconcile.Request{} @@ -123,8 +123,8 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { // Watch for changes to the ceph pods and enqueue their nodes logger.Debugf("watch for changes to the ceph pods and enqueue their nodes") err = c.Watch( - &source.Kind{Type: &corev1.Pod{}}, - handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(obj client.Object) []reconcile.Request { + source.Kind(mgr.GetCache(), &corev1.Pod{}), + handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(context context.Context, obj client.Object) []reconcile.Request { pod, ok := obj.(*corev1.Pod) if !ok { return []reconcile.Request{} diff --git a/pkg/operator/ceph/cluster/rbd/controller.go b/pkg/operator/ceph/cluster/rbd/controller.go index 2e75b793f..2236f3ac7 100644 --- a/pkg/operator/ceph/cluster/rbd/controller.go +++ b/pkg/operator/ceph/cluster/rbd/controller.go @@ -116,17 +116,25 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the cephRBDMirror CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephRBDMirror{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + s := source.Kind( + mgr.GetCache(), + &cephv1.CephRBDMirror{TypeMeta: controllerTypeMeta}) + err = c.Watch(s, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } // Watch all other resources for _, t := range objectsToWatch { - err = c.Watch(&source.Kind{Type: t}, &handler.EnqueueRequestForOwner{ - IsController: true, - OwnerType: &cephv1.CephRBDMirror{}, - }, opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephRBDMirror{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) + ownerRequest := handler.EnqueueRequestForOwner( + mgr.GetScheme(), + mgr.GetRESTMapper(), + &cephv1.CephRBDMirror{}, + ) + err = c.Watch( + source.Kind(mgr.GetCache(), t), + ownerRequest, + opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephRBDMirror{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) if err != nil { return err } diff --git a/pkg/operator/ceph/controller.go b/pkg/operator/ceph/controller.go index 4fb20cea8..b18b68ff2 100644 --- a/pkg/operator/ceph/controller.go +++ b/pkg/operator/ceph/controller.go @@ -74,8 +74,10 @@ func add(ctx context.Context, context *clusterd.Context, mgr manager.Manager, r logger.Infof("%s successfully started", controllerName) // Watch for ConfigMap (operator config) - err = c.Watch(&source.Kind{ - Type: &v1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: v1.SchemeGroupVersion.String()}}}, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient())) + s := source.Kind( + mgr.GetCache(), + &v1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: v1.SchemeGroupVersion.String()}}) + err = c.Watch(s, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient())) if err != nil { return err } @@ -87,8 +89,10 @@ func add(ctx context.Context, context *clusterd.Context, mgr manager.Manager, r if value == "false" { // Watch for Secret (admission controller secret) - err = c.Watch(&source.Kind{ - Type: &v1.Secret{TypeMeta: metav1.TypeMeta{Kind: "Secret", APIVersion: v1.SchemeGroupVersion.String()}}}, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient())) + s := source.Kind( + mgr.GetCache(), + &v1.Secret{TypeMeta: metav1.TypeMeta{Kind: "Secret", APIVersion: v1.SchemeGroupVersion.String()}}) + err = c.Watch(s, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient())) if err != nil { return err } diff --git a/pkg/operator/ceph/controller/controller_utils_test.go b/pkg/operator/ceph/controller/controller_utils_test.go index 1b4e01a9b..eadcb2376 100644 --- a/pkg/operator/ceph/controller/controller_utils_test.go +++ b/pkg/operator/ceph/controller/controller_utils_test.go @@ -139,6 +139,7 @@ func TestIsReadyToReconcile(t *testing.T) { Name: clusterName.Name, Namespace: clusterName.Namespace, DeletionTimestamp: &metav1.Time{Time: time.Now()}, + Finalizers: []string{"test"}, }, } @@ -176,6 +177,7 @@ func TestIsReadyToReconcile(t *testing.T) { Name: clusterName.Name, Namespace: clusterName.Namespace, DeletionTimestamp: &metav1.Time{Time: time.Now()}, + Finalizers: []string{"test"}, }, Spec: cephv1.ClusterSpec{ CleanupPolicy: cephv1.CleanupPolicySpec{ diff --git a/pkg/operator/ceph/controller/handler.go b/pkg/operator/ceph/controller/handler.go index a457f7ac5..ad71a95a8 100644 --- a/pkg/operator/ceph/controller/handler.go +++ b/pkg/operator/ceph/controller/handler.go @@ -44,7 +44,7 @@ func ObjectToCRMapper(ctx context.Context, c client.Client, ro runtime.Object, s } // return handler.EnqueueRequestsFromMapFunc(func(o client.Object) []ctrl.Request { - return handler.MapFunc(func(o client.Object) []ctrl.Request { + return handler.MapFunc(func(ctx context.Context, o client.Object) []ctrl.Request { list := &unstructured.UnstructuredList{} list.SetGroupVersionKind(gvk) err := c.List(ctx, list) diff --git a/pkg/operator/ceph/controller/handler_test.go b/pkg/operator/ceph/controller/handler_test.go index 0fb0557c6..830201914 100644 --- a/pkg/operator/ceph/controller/handler_test.go +++ b/pkg/operator/ceph/controller/handler_test.go @@ -64,5 +64,5 @@ func TestObjectToCRMapper(t *testing.T) { handlerFunc, err := ObjectToCRMapper(context.TODO(), cl, objects[0], s) assert.NoError(t, err) - assert.ElementsMatch(t, fakeRequest, handlerFunc(fs)) + assert.ElementsMatch(t, fakeRequest, handlerFunc(context.TODO(), fs)) } diff --git a/pkg/operator/ceph/csi/controller.go b/pkg/operator/ceph/csi/controller.go index a99d1be1d..4af1e227e 100644 --- a/pkg/operator/ceph/csi/controller.go +++ b/pkg/operator/ceph/csi/controller.go @@ -87,15 +87,18 @@ func add(ctx context.Context, mgr manager.Manager, r reconcile.Reconciler, opCon logger.Infof("%s successfully started", controllerName) // Watch for ConfigMap (operator config) - err = c.Watch(&source.Kind{ - Type: &v1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: v1.SchemeGroupVersion.String()}}}, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient(), opConfig.OperatorNamespace)) + configmapKind := source.Kind(mgr.GetCache(), + &v1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: v1.SchemeGroupVersion.String()}}) + err = c.Watch(configmapKind, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient(), opConfig.OperatorNamespace)) if err != nil { return err } // Watch for CephCluster - err = c.Watch(&source.Kind{ - Type: &cephv1.CephCluster{TypeMeta: metav1.TypeMeta{Kind: "CephCluster", APIVersion: v1.SchemeGroupVersion.String()}}}, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient(), opConfig.OperatorNamespace)) + clusterKind := source.Kind( + mgr.GetCache(), + &cephv1.CephCluster{TypeMeta: metav1.TypeMeta{Kind: "CephCluster", APIVersion: v1.SchemeGroupVersion.String()}}) + err = c.Watch(clusterKind, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient(), opConfig.OperatorNamespace)) if err != nil { return err } diff --git a/pkg/operator/ceph/disruption/clusterdisruption/add.go b/pkg/operator/ceph/disruption/clusterdisruption/add.go index ea364d5fb..a069c7104 100644 --- a/pkg/operator/ceph/disruption/clusterdisruption/add.go +++ b/pkg/operator/ceph/disruption/clusterdisruption/add.go @@ -17,6 +17,7 @@ limitations under the License. package clusterdisruption import ( + ctx "context" "reflect" "github.com/rook/rook/pkg/operator/ceph/disruption/controllerconfig" @@ -77,7 +78,7 @@ func Add(mgr manager.Manager, context *controllerconfig.Context) error { } // Watch for CephClusters - err = c.Watch(&source.Kind{Type: &cephv1.CephCluster{}}, &handler.EnqueueRequestForObject{}, cephClusterPredicate) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephCluster{}), &handler.EnqueueRequestForObject{}, cephClusterPredicate) if err != nil { return err } @@ -117,8 +118,8 @@ func Add(mgr manager.Manager, context *controllerconfig.Context) error { // Watch for main PodDisruptionBudget and enqueue the CephCluster in the namespace if usePDBV1Beta1 { err = c.Watch( - &source.Kind{Type: &policyv1beta1.PodDisruptionBudget{}}, - handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(obj client.Object) []reconcile.Request { + source.Kind(mgr.GetCache(), &policyv1beta1.PodDisruptionBudget{}), + handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(context ctx.Context, obj client.Object) []reconcile.Request { pdb, ok := obj.(*policyv1beta1.PodDisruptionBudget) if !ok { // Not a pdb, returning empty @@ -137,8 +138,8 @@ func Add(mgr manager.Manager, context *controllerconfig.Context) error { } } else { err = c.Watch( - &source.Kind{Type: &policyv1.PodDisruptionBudget{}}, - handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(obj client.Object) []reconcile.Request { + source.Kind(mgr.GetCache(), &policyv1.PodDisruptionBudget{}), + handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(context ctx.Context, obj client.Object) []reconcile.Request { pdb, ok := obj.(*policyv1.PodDisruptionBudget) if !ok { // Not a pdb, returning empty @@ -159,7 +160,7 @@ func Add(mgr manager.Manager, context *controllerconfig.Context) error { // enqueues with an empty name that is populated by the reconciler. // There is a one-per-namespace limit on CephClusters - enqueueByNamespace := handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(obj client.Object) []reconcile.Request { + enqueueByNamespace := handler.EnqueueRequestsFromMapFunc(handler.MapFunc(func(context ctx.Context, obj client.Object) []reconcile.Request { // The name will be populated in the reconcile namespace := obj.GetNamespace() if len(namespace) == 0 { @@ -172,19 +173,19 @@ func Add(mgr manager.Manager, context *controllerconfig.Context) error { ) // Watch for CephBlockPools and enqueue the CephCluster in the namespace - err = c.Watch(&source.Kind{Type: &cephv1.CephBlockPool{}}, enqueueByNamespace) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephBlockPool{}), enqueueByNamespace) if err != nil { return err } // Watch for CephFileSystems and enqueue the CephCluster in the namespace - err = c.Watch(&source.Kind{Type: &cephv1.CephFilesystem{}}, enqueueByNamespace) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephFilesystem{}), enqueueByNamespace) if err != nil { return err } // Watch for CephObjectStores and enqueue the CephCluster in the namespace - err = c.Watch(&source.Kind{Type: &cephv1.CephObjectStore{}}, enqueueByNamespace) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephObjectStore{}), enqueueByNamespace) if err != nil { return err } diff --git a/pkg/operator/ceph/file/controller.go b/pkg/operator/ceph/file/controller.go index 49d9e84b7..cea7f00c8 100644 --- a/pkg/operator/ceph/file/controller.go +++ b/pkg/operator/ceph/file/controller.go @@ -118,17 +118,20 @@ func add(opManagerContext context.Context, mgr manager.Manager, r reconcile.Reco logger.Info("successfully started") // Watch for changes on the CephFilesystem CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephFilesystem{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephFilesystem{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } // Watch all other resources for _, t := range objectsToWatch { - err = c.Watch(&source.Kind{Type: t}, &handler.EnqueueRequestForOwner{ - IsController: true, - OwnerType: &cephv1.CephFilesystem{}, - }, opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephFilesystem{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) + ownerRequest := handler.EnqueueRequestForOwner( + mgr.GetScheme(), + mgr.GetRESTMapper(), + &cephv1.CephFilesystem{}, + ) + err = c.Watch(source.Kind(mgr.GetCache(), t), ownerRequest, + opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephFilesystem{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) if err != nil { return err } @@ -142,7 +145,7 @@ func add(opManagerContext context.Context, mgr manager.Manager, r reconcile.Reco } // Watch for ConfigMap "rook-ceph-mon-endpoints" update and reconcile, which will reconcile update the bootstrap peer token - err = c.Watch(&source.Kind{Type: &corev1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: corev1.SchemeGroupVersion.String()}}}, handler.EnqueueRequestsFromMapFunc(handlerFunc), mon.PredicateMonEndpointChanges()) + err = c.Watch(source.Kind(mgr.GetCache(), &corev1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: corev1.SchemeGroupVersion.String()}}), handler.EnqueueRequestsFromMapFunc(handlerFunc), mon.PredicateMonEndpointChanges()) if err != nil { return err } diff --git a/pkg/operator/ceph/file/mirror/controller.go b/pkg/operator/ceph/file/mirror/controller.go index ebe54c4c2..1cbb377c8 100644 --- a/pkg/operator/ceph/file/mirror/controller.go +++ b/pkg/operator/ceph/file/mirror/controller.go @@ -107,17 +107,19 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the CephFilesystemMirror CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephFilesystemMirror{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephFilesystemMirror{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } // Watch all other resources for _, t := range objectsToWatch { - err = c.Watch(&source.Kind{Type: t}, &handler.EnqueueRequestForOwner{ - IsController: true, - OwnerType: &cephv1.CephFilesystemMirror{}, - }, opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephFilesystemMirror{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) + ownerRequest := handler.EnqueueRequestForOwner( + mgr.GetScheme(), + mgr.GetRESTMapper(), + &cephv1.CephFilesystemMirror{}, + ) + err = c.Watch(source.Kind(mgr.GetCache(), t), ownerRequest, opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephFilesystemMirror{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) if err != nil { return err } diff --git a/pkg/operator/ceph/file/subvolumegroup/controller.go b/pkg/operator/ceph/file/subvolumegroup/controller.go index 7a0875dae..2cfd10f3e 100644 --- a/pkg/operator/ceph/file/subvolumegroup/controller.go +++ b/pkg/operator/ceph/file/subvolumegroup/controller.go @@ -98,7 +98,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the CephFilesystemSubVolumeGroup CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephFilesystemSubVolumeGroup{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephFilesystemSubVolumeGroup{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } diff --git a/pkg/operator/ceph/nfs/controller.go b/pkg/operator/ceph/nfs/controller.go index e43df988e..1d91cab7d 100644 --- a/pkg/operator/ceph/nfs/controller.go +++ b/pkg/operator/ceph/nfs/controller.go @@ -113,17 +113,20 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the cephNFS CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephNFS{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephNFS{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } // Watch all other resources for _, t := range objectsToWatch { - err = c.Watch(&source.Kind{Type: t}, &handler.EnqueueRequestForOwner{ - IsController: true, - OwnerType: &cephv1.CephNFS{}, - }, opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephNFS{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) + ownerRequest := handler.EnqueueRequestForOwner( + mgr.GetScheme(), + mgr.GetRESTMapper(), + &cephv1.CephNFS{}, + ) + err = c.Watch(source.Kind(mgr.GetCache(), t), ownerRequest, + opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephNFS{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) if err != nil { return err } @@ -171,7 +174,7 @@ func (r *ReconcileCephNFS) reconcile(request reconcile.Request) (reconcile.Resul updateStatus(k8sutil.ObservedGenerationNotAvailable, r.client, request.NamespacedName, k8sutil.EmptyStatus) } - if err := cephNFS.Spec.Security.Validate(); err != nil { + if _, err := cephNFS.Spec.Security.Validate(); err != nil { return reconcile.Result{Requeue: true, RequeueAfter: 15 * time.Second}, *cephNFS, errors.Wrapf(err, "failed to validate security spec for CephNFS %q", types.NamespacedName{Namespace: cephNFS.Namespace, Name: cephNFS.Name}) diff --git a/pkg/operator/ceph/object/bucket/controller.go b/pkg/operator/ceph/object/bucket/controller.go index 2045d4dfc..f3accba69 100644 --- a/pkg/operator/ceph/object/bucket/controller.go +++ b/pkg/operator/ceph/object/bucket/controller.go @@ -81,15 +81,18 @@ func add(ctx context.Context, mgr manager.Manager, r reconcile.Reconciler) error logger.Infof("%s successfully started", controllerName) // Watch for ConfigMap (operator config) - err = c.Watch(&source.Kind{ - Type: &v1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: v1.SchemeGroupVersion.String()}}}, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient())) + cmKind := source.Kind( + mgr.GetCache(), + &v1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: v1.SchemeGroupVersion.String()}}) + err = c.Watch(cmKind, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient())) if err != nil { return err } // Watch for CephCluster - err = c.Watch(&source.Kind{ - Type: &cephv1.CephCluster{TypeMeta: metav1.TypeMeta{Kind: "CephCluster", APIVersion: v1.SchemeGroupVersion.String()}}}, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient())) + clusterKind := source.Kind(mgr.GetCache(), + &cephv1.CephCluster{TypeMeta: metav1.TypeMeta{Kind: "CephCluster", APIVersion: v1.SchemeGroupVersion.String()}}) + err = c.Watch(clusterKind, &handler.EnqueueRequestForObject{}, predicateController(ctx, mgr.GetClient())) if err != nil { return err } diff --git a/pkg/operator/ceph/object/controller.go b/pkg/operator/ceph/object/controller.go index bf66cf0f4..a9c94ba8d 100644 --- a/pkg/operator/ceph/object/controller.go +++ b/pkg/operator/ceph/object/controller.go @@ -124,17 +124,20 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the cephObjectStore CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephObjectStore{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephObjectStore{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } // Watch all other resources for _, t := range objectsToWatch { - err = c.Watch(&source.Kind{Type: t}, &handler.EnqueueRequestForOwner{ - IsController: true, - OwnerType: &cephv1.CephObjectStore{}, - }, opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephObjectStore{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) + ownerRequest := handler.EnqueueRequestForOwner( + mgr.GetScheme(), + mgr.GetRESTMapper(), + &cephv1.CephObjectStore{}, + ) + err = c.Watch(source.Kind(mgr.GetCache(), t), ownerRequest, + opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephObjectStore{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) if err != nil { return err } diff --git a/pkg/operator/ceph/object/controller_test.go b/pkg/operator/ceph/object/controller_test.go index e0217adce..f2bd11ae8 100644 --- a/pkg/operator/ceph/object/controller_test.go +++ b/pkg/operator/ceph/object/controller_test.go @@ -36,10 +36,12 @@ import ( "github.com/rook/rook/pkg/daemon/ceph/client" cephver "github.com/rook/rook/pkg/operator/ceph/version" "github.com/rook/rook/pkg/operator/k8sutil" + testopk8s "github.com/rook/rook/pkg/operator/k8sutil/test" "github.com/rook/rook/pkg/operator/test" "github.com/rook/rook/pkg/util/dependents" exectest "github.com/rook/rook/pkg/util/exec/test" "github.com/stretchr/testify/assert" + apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -561,6 +563,9 @@ func TestCephObjectStoreControllerMultisite(t *testing.T) { ctx := context.TODO() capnslog.SetGlobalLogLevel(capnslog.DEBUG) os.Setenv("ROOK_LOG_LEVEL", "DEBUG") + var deploymentsUpdated *[]*apps.Deployment + updateDeploymentAndWait, deploymentsUpdated = testopk8s.UpdateDeploymentAndWaitStub() + testopk8s.ClearDeploymentsUpdated(deploymentsUpdated) zoneName := "zone-a" zoneGroupName := "zonegroup-a" @@ -778,7 +783,15 @@ func TestCephObjectStoreControllerMultisite(t *testing.T) { objectStore.DeletionTimestamp = &metav1.Time{ Time: time.Now(), } - err = r.client.Update(ctx, objectStore) + objectStore.Finalizers = []string{"cephobjectstore.ceph.rook.io"} + cl := fake.NewClientBuilder().WithScheme(s).WithRuntimeObjects(object...).Build() + r := &ReconcileCephObjectStore{ + client: cl, + scheme: s, + context: c, + recorder: record.NewFakeRecorder(5), + opManagerContext: ctx, + } // have to also track the same objects in the rook clientset r.context.RookClientset = rookfake.NewSimpleClientset( @@ -951,8 +964,8 @@ func TestCephObjectExternalStoreController(t *testing.T) { externalObjectStore.DeletionTimestamp = &metav1.Time{ Time: time.Now(), } - err = r.client.Update(ctx, externalObjectStore) - assert.NoError(t, err) + externalObjectStore.Finalizers = []string{"cephobjectstore.ceph.rook.io"} + r := getReconciler(objects) // have to also track the same objects in the rook clientset r.context.RookClientset = rookfake.NewSimpleClientset(externalObjectStore) diff --git a/pkg/operator/ceph/object/notification/controller.go b/pkg/operator/ceph/object/notification/controller.go index c226175b3..f4f0d8bcf 100644 --- a/pkg/operator/ceph/object/notification/controller.go +++ b/pkg/operator/ceph/object/notification/controller.go @@ -100,7 +100,7 @@ func addNotificationReconciler(mgr manager.Manager, r reconcile.Reconciler) erro logger.Info("successfully started") // Watch for changes on the OBC CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephBucketNotification{}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephBucketNotification{}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } diff --git a/pkg/operator/ceph/object/notification/obc_label_controller.go b/pkg/operator/ceph/object/notification/obc_label_controller.go index 4aa07ca33..78a004435 100644 --- a/pkg/operator/ceph/object/notification/obc_label_controller.go +++ b/pkg/operator/ceph/object/notification/obc_label_controller.go @@ -66,7 +66,7 @@ func addOBCLabelReconciler(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the OBC CRD object - err = c.Watch(&source.Kind{Type: &bktv1alpha1.ObjectBucketClaim{}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &bktv1alpha1.ObjectBucketClaim{}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } diff --git a/pkg/operator/ceph/object/realm/controller.go b/pkg/operator/ceph/object/realm/controller.go index feaeaec69..fefd92382 100644 --- a/pkg/operator/ceph/object/realm/controller.go +++ b/pkg/operator/ceph/object/realm/controller.go @@ -106,7 +106,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the CephObjectRealm CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephObjectRealm{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephObjectRealm{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } diff --git a/pkg/operator/ceph/object/topic/controller.go b/pkg/operator/ceph/object/topic/controller.go index 18d02bfaa..6fc55b1c1 100644 --- a/pkg/operator/ceph/object/topic/controller.go +++ b/pkg/operator/ceph/object/topic/controller.go @@ -73,7 +73,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the CephBucketTopic CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephBucketTopic{}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephBucketTopic{}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } @@ -170,7 +170,7 @@ func (r *ReconcileBucketTopic) reconcile(request reconcile.Request) (reconcile.R } // validate the topic settings - err = cephBucketTopic.ValidateCreate() + _, err = cephBucketTopic.ValidateCreate() if err != nil { r.updateStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, k8sutil.ReconcileFailedStatus, nil) return reconcile.Result{}, errors.Wrapf(err, "invalid CephBucketTopic %q", request.NamespacedName) diff --git a/pkg/operator/ceph/object/user/controller.go b/pkg/operator/ceph/object/user/controller.go index 0fdf0c0af..e09881bd2 100644 --- a/pkg/operator/ceph/object/user/controller.go +++ b/pkg/operator/ceph/object/user/controller.go @@ -106,16 +106,20 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the CephObjectStoreUser CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephObjectStoreUser{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephObjectStoreUser{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } // Watch secrets - err = c.Watch(&source.Kind{Type: &corev1.Secret{TypeMeta: metav1.TypeMeta{Kind: "Secret", APIVersion: corev1.SchemeGroupVersion.String()}}}, &handler.EnqueueRequestForOwner{ - IsController: true, - OwnerType: &cephv1.CephObjectStoreUser{}, - }, opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephObjectStoreUser{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) + secretSource := source.Kind(mgr.GetCache(), &corev1.Secret{TypeMeta: metav1.TypeMeta{Kind: "Secret", APIVersion: corev1.SchemeGroupVersion.String()}}) + ownerRequest := handler.EnqueueRequestForOwner( + mgr.GetScheme(), + mgr.GetRESTMapper(), + &cephv1.CephObjectStoreUser{}, + ) + err = c.Watch(secretSource, ownerRequest, + opcontroller.WatchPredicateForNonCRDObject(&cephv1.CephObjectStoreUser{TypeMeta: controllerTypeMeta}, mgr.GetScheme())) if err != nil { return err } diff --git a/pkg/operator/ceph/object/zone/controller.go b/pkg/operator/ceph/object/zone/controller.go index deb25867f..36ff48144 100644 --- a/pkg/operator/ceph/object/zone/controller.go +++ b/pkg/operator/ceph/object/zone/controller.go @@ -108,7 +108,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the CephObjectZone CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephObjectZone{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephObjectZone{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } diff --git a/pkg/operator/ceph/object/zonegroup/controller.go b/pkg/operator/ceph/object/zonegroup/controller.go index 84e835ce6..804e316d4 100644 --- a/pkg/operator/ceph/object/zonegroup/controller.go +++ b/pkg/operator/ceph/object/zonegroup/controller.go @@ -97,7 +97,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the CephObjectZoneGroup CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephObjectZoneGroup{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephObjectZoneGroup{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } diff --git a/pkg/operator/ceph/pool/controller.go b/pkg/operator/ceph/pool/controller.go index 873c16805..5a8f5a365 100644 --- a/pkg/operator/ceph/pool/controller.go +++ b/pkg/operator/ceph/pool/controller.go @@ -111,7 +111,7 @@ func add(opManagerContext context.Context, mgr manager.Manager, r reconcile.Reco logger.Info("successfully started") // Watch for changes on the CephBlockPool CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephBlockPool{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephBlockPool{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } @@ -124,7 +124,8 @@ func add(opManagerContext context.Context, mgr manager.Manager, r reconcile.Reco } // Watch for ConfigMap "rook-ceph-mon-endpoints" update and reconcile, which will reconcile update the bootstrap peer token - err = c.Watch(&source.Kind{Type: &corev1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: corev1.SchemeGroupVersion.String()}}}, handler.EnqueueRequestsFromMapFunc(handlerFunc), mon.PredicateMonEndpointChanges()) + cmSource := source.Kind(mgr.GetCache(), &corev1.ConfigMap{TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: corev1.SchemeGroupVersion.String()}}) + err = c.Watch(cmSource, handler.EnqueueRequestsFromMapFunc(handlerFunc), mon.PredicateMonEndpointChanges()) if err != nil { return err } diff --git a/pkg/operator/ceph/pool/radosnamespace/controller.go b/pkg/operator/ceph/pool/radosnamespace/controller.go index 1ce89ef31..da8ca745a 100644 --- a/pkg/operator/ceph/pool/radosnamespace/controller.go +++ b/pkg/operator/ceph/pool/radosnamespace/controller.go @@ -97,7 +97,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { logger.Info("successfully started") // Watch for changes on the CephBlockPoolRadosNamespace CRD object - err = c.Watch(&source.Kind{Type: &cephv1.CephBlockPoolRadosNamespace{TypeMeta: controllerTypeMeta}}, &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) + err = c.Watch(source.Kind(mgr.GetCache(), &cephv1.CephBlockPoolRadosNamespace{TypeMeta: controllerTypeMeta}), &handler.EnqueueRequestForObject{}, opcontroller.WatchControllerPredicate()) if err != nil { return err } diff --git a/pkg/operator/k8sutil/job.go b/pkg/operator/k8sutil/job.go index 14d75eb29..615005289 100644 --- a/pkg/operator/k8sutil/job.go +++ b/pkg/operator/k8sutil/job.go @@ -62,7 +62,7 @@ func RunReplaceableJob(ctx context.Context, clientset kubernetes.Interface, job // Assumes that only one pod needs to complete. func WaitForJobCompletion(ctx context.Context, clientset kubernetes.Interface, job *batch.Job, timeout time.Duration) error { logger.Infof("waiting for job %s to complete...", job.Name) - return wait.Poll(5*time.Second, timeout, func() (bool, error) { + return wait.PollUntilContextTimeout(ctx, 5*time.Second, timeout, true, func(context context.Context) (bool, error) { job, err := clientset.BatchV1().Jobs(job.Namespace).Get(ctx, job.Name, metav1.GetOptions{}) if err != nil { return false, fmt.Errorf("failed to detect job %s. %+v", job.Name, err) diff --git a/tests/framework/installer/ceph_installer.go b/tests/framework/installer/ceph_installer.go index 3b00006b2..4a73668d9 100644 --- a/tests/framework/installer/ceph_installer.go +++ b/tests/framework/installer/ceph_installer.go @@ -1057,8 +1057,7 @@ func (h *CephInstaller) addCleanupPolicy(namespace, clusterName string) error { } func (h *CephInstaller) waitForCleanupJobs(namespace string) error { - ctx := context.TODO() - allRookCephCleanupJobs := func() (done bool, err error) { + allRookCephCleanupJobs := func(ctx context.Context) (done bool, err error) { appLabelSelector := fmt.Sprintf("app=%s", cluster.CleanupAppName) cleanupJobs, err := h.k8shelper.Clientset.BatchV1().Jobs(namespace).List(ctx, metav1.ListOptions{LabelSelector: appLabelSelector}) if err != nil { @@ -1091,7 +1090,7 @@ func (h *CephInstaller) waitForCleanupJobs(namespace string) error { } logger.Info("waiting for job(s) to cleanup the host...") - err := wait.Poll(5*time.Second, 90*time.Second, allRookCephCleanupJobs) + err := wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 90*time.Second, true, allRookCephCleanupJobs) if err != nil { return errors.Errorf("failed to wait for clean up jobs to complete. %+v", err) } diff --git a/tests/framework/utils/k8s_helper.go b/tests/framework/utils/k8s_helper.go index 0b41572e8..54bee49cc 100644 --- a/tests/framework/utils/k8s_helper.go +++ b/tests/framework/utils/k8s_helper.go @@ -347,7 +347,7 @@ func (k8sh *K8sHelper) WaitForPodCount(label, namespace string, count int) error func (k8sh *K8sHelper) WaitForStatusPhase(namespace, kind, name, desiredPhase string, timeout time.Duration) error { baseErr := fmt.Sprintf("waiting for resource %q %q in namespace %q to have status.phase %q", kind, name, namespace, desiredPhase) - err := wait.Poll(3*time.Second, timeout, func() (done bool, err error) { + err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, timeout, true, func(context context.Context) (done bool, err error) { phase, err := k8sh.GetResource("--namespace", namespace, kind, name, "--output", "jsonpath={.status.phase}") if err != nil { logger.Warningf("error %s. %v", baseErr, err) diff --git a/tests/integration/ceph_base_file_test.go b/tests/integration/ceph_base_file_test.go index d25a78c76..39e5f9098 100644 --- a/tests/integration/ceph_base_file_test.go +++ b/tests/integration/ceph_base_file_test.go @@ -296,7 +296,7 @@ func runFileE2ETest(helper *clients.TestClient, k8sh *utils.K8sHelper, s *suite. assert.NoError(t, err) var cond *cephv1.Condition - err = wait.Poll(2*time.Second, 45*time.Second, func() (done bool, err error) { + err = wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 45*time.Second, true, func(context context.Context) (done bool, err error) { logger.Infof("waiting for CephFilesystem %q in namespace %q to have condition %q", filesystemName, settings.Namespace, cephv1.ConditionDeletionIsBlocked) fs, err := k8sh.RookClientset.CephV1().CephFilesystems(settings.Namespace).Get( @@ -338,7 +338,7 @@ func runFileE2ETest(helper *clients.TestClient, k8sh *utils.K8sHelper, s *suite. assert.NoError(t, err) var cond *cephv1.Condition - err = wait.Poll(2*time.Second, 18*time.Second, func() (done bool, err error) { + err = wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 18*time.Second, true, func(context context.Context) (done bool, err error) { logger.Infof("waiting for CephFilesystem %q in namespace %q no longer be blocked by CephFilesystemSubVolumeGroups", filesystemName, settings.Namespace) fs, err := k8sh.RookClientset.CephV1().CephFilesystems(settings.Namespace).Get( @@ -379,7 +379,7 @@ func runFileE2ETest(helper *clients.TestClient, k8sh *utils.K8sHelper, s *suite. // Cleanup the filesystem and its clients cleanupFilesystemConsumer(helper, k8sh, s, settings.Namespace, filePodName) - err = wait.Poll(3*time.Second, 30*time.Second, func() (done bool, err error) { + err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, true, func(context context.Context) (done bool, err error) { logger.Infof("waiting for CephFilesystem %q in namespace %q to be deleted", filesystemName, settings.Namespace) _, err = k8sh.RookClientset.CephV1().CephFilesystems(settings.Namespace).Get( diff --git a/tests/integration/ceph_base_object_test.go b/tests/integration/ceph_base_object_test.go index a4d4d2a6d..aa0d7819a 100644 --- a/tests/integration/ceph_base_object_test.go +++ b/tests/integration/ceph_base_object_test.go @@ -145,7 +145,7 @@ func createCephObjectStore(t *testing.T, helper *clients.TestClient, k8sh *utils }) t.Run("verify RGW liveness probes show healthy", func(t *testing.T) { - err := wait.PollImmediate(2*time.Second, 90*time.Second, func() (done bool, err error) { + err := wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 90*time.Second, true, func(ctx context.Context) (done bool, err error) { deployName := "rook-ceph-rgw-" + storeName + "-a" d, err := k8sh.Clientset.AppsV1().Deployments(namespace).Get(ctx, deployName, metav1.GetOptions{}) if err != nil {