Utility FunctionsΒΆ

These functions are useful when writing playbooks that deal with Kubernetes objects:

parse_kubernetes_datetime(k8s_datetime)[source]ΒΆ

Parse a date/time related field in a Kubernetes object and convert it from string to a python datetime object

Return type:ΒΆ

datetime

duplicate_without_fields(obj, omitted_fields)[source]ΒΆ

Duplicate a hikaru object, omitting the specified fields

This is useful when you want to compare two versions of an object and first "cleanup" fields that shouldn't be compared.

Parameters:ΒΆ
obj : HikaruBaseΒΆ

A kubernetes object

omitted_fields : List[str]ΒΆ

List of fields to be omitted. Field name format should be '.' separated For example: ["status", "metadata.generation"]