INNER CODE UNIT · Python

parse

weaveworks/kubediff · kubedifflib/_diff.py:56

    def parse(x):
        return int(x[:-1]) / 1000. if x.endswith('m') else float(x)

    return parse(a) == parse(b)

# Kubernetes outputs "creationTimestamp: null" in a blank object
# e.g. from kubectl create deploy foo --image=foo --output=yaml --dry-run
# so allow that to compare equal to any real value that comes back.


def creation_timestamp_equal(a, b):
    """Compares creation timestamps, allowing a source value of None to match any time"""
    if a is None:
        return True
    return a == b


# Tolerations specify a path (glob patterns accepted) and a check function.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…