示例#1
0
def deserialize_property(value: typing.Any, data_type: tuple) -> typing.Any:
    """
    Converts the serialized configuration value into the given kuber data type.
    All Definition objects store data types internally to allow for easily
    mapping from serialized values during the loading of configuration file
    data.

    :param value:
        Serialized configuration value to be converted into the given data
        type.
    :param data_type:
        kuber data type to deserialize the given value into.
    :return:
        Deserialized form of the specified value.
    """
    if value is None:
        return None

    if data_type[0] == _types.integer_or_string:
        return _types.integer_or_string(value)

    if issubclass(data_type[0], _abstracts.Definition):
        return data_type[0]().from_dict(value)

    if data_type[0] == list:
        return [deserialize_property(v, (data_type[1], None)) for v in value]

    return data_type[0](value)
 def port(self, value: typing.Union[str, int, None]):
     """
     The port on the given protocol. This can either be a
     numerical or named port on a pod. If this field is not
     provided, this matches all port names and numbers.
     """
     self._properties["port"] = _types.integer_or_string(value)
示例#3
0
 def min_available(self, value: typing.Union[str, int, None]):
     """
     An eviction is allowed if at least "minAvailable" pods
     selected by "selector" will still be available after the
     eviction, i.e. even in the absence of the evicted pod.  So
     for example you can prevent all voluntary evictions by
     specifying "100%".
     """
     self._properties["minAvailable"] = _types.integer_or_string(value)
示例#4
0
 def max_unavailable(self, value: typing.Union[str, int, None]):
     """
     An eviction is allowed if at most "maxUnavailable" pods
     selected by "selector" are unavailable after the eviction,
     i.e. even in absence of the evicted pod. For example, one
     can prevent all voluntary evictions by specifying 0. This is
     a mutually exclusive setting with "minAvailable".
     """
     self._properties["maxUnavailable"] = _types.integer_or_string(value)
示例#5
0
    def capacity(self, value: typing.Union[str, int, None]):
        """
        Capacity is the value reported by the CSI driver in its
        GetCapacityResponse for a GetCapacityRequest with topology
        and parameters that match the previous fields.

        The semantic is currently (CSI spec 1.2) defined as: The
        available capacity, in bytes, of the storage that can be
        used to provision volumes. If not set, that information is
        currently unavailable and treated like zero capacity.
        """
        self._properties["capacity"] = _types.integer_or_string(value)
示例#6
0
    def maximum_volume_size(self, value: typing.Union[str, int, None]):
        """
        MaximumVolumeSize is the value reported by the CSI driver in
        its GetCapacityResponse for a GetCapacityRequest with
        topology and parameters that match the previous fields.

        This is defined since CSI spec 1.4.0 as the largest size
        that may be used in a
        CreateVolumeRequest.capacity_range.required_bytes field to
        create a volume with the same parameters as those in
        GetCapacityRequest. The corresponding value in the
        Kubernetes API is ResourceRequirements.Requests in a volume
        claim.
        """
        self._properties["maximumVolumeSize"] = _types.integer_or_string(value)
 def service_port(self, value: typing.Union[str, int, None]):
     """
     Specifies the port of the referenced service.
     """
     self._properties["servicePort"] = _types.integer_or_string(value)