Documentation ¶
Index ¶
- Variables
- func Hash(objs []ObjMetadata) (string, error)
- func InfoToUnstructured(info *resource.Info) *unstructured.Unstructured
- func InfosToUnstructureds(infos []*resource.Info) []*unstructured.Unstructured
- func SetEquals(setA []ObjMetadata, setB []ObjMetadata) bool
- func UnstructuredToInfo(obj *unstructured.Unstructured) (*resource.Info, error)
- func UnstructuredsToInfos(objs []*unstructured.Unstructured) ([]*resource.Info, error)
- type ObjMetadata
- func CreateObjMetadata(namespace string, name string, gk schema.GroupKind) (ObjMetadata, error)
- func InfoToObjMeta(info *resource.Info) (ObjMetadata, error)
- func InfosToObjMetas(infos []*resource.Info) ([]ObjMetadata, error)
- func ParseObjMetadata(s string) (ObjMetadata, error)
- func RuntimeToObjMeta(obj runtime.Object) ObjMetadata
- func SetDiff(setA []ObjMetadata, setB []ObjMetadata) []ObjMetadata
- func Union(setA []ObjMetadata, setB []ObjMetadata) []ObjMetadata
- func UnstructuredToObjMeta(obj *unstructured.Unstructured) ObjMetadata
- func UnstructuredsToObjMetas(objs []*unstructured.Unstructured) []ObjMetadata
Constants ¶
This section is empty.
Variables ¶
var CoreV1Namespace = corev1.SchemeGroupVersion.WithKind("Namespace")
CoreV1Namespace is Namespace GVK.
var RBACGroupKind = map[schema.GroupKind]bool{ {Group: rbacv1.GroupName, Kind: "Role"}: true, {Group: rbacv1.GroupName, Kind: "ClusterRole"}: true, {Group: rbacv1.GroupName, Kind: "RoleBinding"}: true, {Group: rbacv1.GroupName, Kind: "ClusterRoleBinding"}: true, }
RBACGroupKind is a map of the RBAC resources. Needed since name validation is different than other k8s resources.
Functions ¶
func Hash ¶ added in v0.18.0
func Hash(objs []ObjMetadata) (string, error)
CalcHash returns a hash of the sorted strings from the object metadata, or an error if one occurred.
func InfoToUnstructured ¶ added in v0.21.0
func InfoToUnstructured(info *resource.Info) *unstructured.Unstructured
func InfosToUnstructureds ¶ added in v0.21.0
func InfosToUnstructureds(infos []*resource.Info) []*unstructured.Unstructured
func SetEquals ¶ added in v0.18.0
func SetEquals(setA []ObjMetadata, setB []ObjMetadata) bool
SetEquals returns true if the slice of objects in setA equals the slice of objects in setB.
func UnstructuredToInfo ¶ added in v0.21.0
func UnstructuredToInfo(obj *unstructured.Unstructured) (*resource.Info, error)
func UnstructuredsToInfos ¶ added in v0.21.0
func UnstructuredsToInfos(objs []*unstructured.Unstructured) ([]*resource.Info, error)
Types ¶
type ObjMetadata ¶
ObjMetadata organizes and stores the indentifying information for an object. This struct (as a string) is stored in a inventory object to keep track of sets of applied objects.
func CreateObjMetadata ¶
CreateObjMetadata returns a pointer to an ObjMetadata struct filled with the passed values. This function normalizes and validates the passed fields and returns an error for bad parameters.
func InfoToObjMeta ¶ added in v0.8.0
func InfoToObjMeta(info *resource.Info) (ObjMetadata, error)
InfoToObjMeta takes information from the provided info and returns an ObjMetadata that identifies the resource.
func InfosToObjMetas ¶ added in v0.8.0
func InfosToObjMetas(infos []*resource.Info) ([]ObjMetadata, error)
BuildObjectMetadata returns object metadata (ObjMetadata) for the passed objects (infos).
func ParseObjMetadata ¶
func ParseObjMetadata(s string) (ObjMetadata, error)
ParseObjMetadata takes a string, splits it into its four fields, and returns an ObjMetadata struct storing the four fields. Example inventory string:
test-namespace_test-name_apps_ReplicaSet
Returns an error if unable to parse and create the ObjMetadata struct.
NOTE: name field can contain double underscore (__), which represents a colon. RBAC resources can have this additional character (:) in their name.
func RuntimeToObjMeta ¶ added in v0.22.1
func RuntimeToObjMeta(obj runtime.Object) ObjMetadata
func SetDiff ¶ added in v0.18.0
func SetDiff(setA []ObjMetadata, setB []ObjMetadata) []ObjMetadata
SetDiff returns the slice of objects that exist in "a", but do not exist in "b" (A - B).
func Union ¶ added in v0.18.0
func Union(setA []ObjMetadata, setB []ObjMetadata) []ObjMetadata
Union returns the slice of objects that is the set of unique items of the merging of set A and set B.
func UnstructuredToObjMeta ¶ added in v0.21.0
func UnstructuredToObjMeta(obj *unstructured.Unstructured) ObjMetadata
func UnstructuredsToObjMetas ¶ added in v0.21.0
func UnstructuredsToObjMetas(objs []*unstructured.Unstructured) []ObjMetadata
func (*ObjMetadata) Equals ¶
func (o *ObjMetadata) Equals(other *ObjMetadata) bool
Equals compares two ObjMetadata and returns true if they are equal. This does not contain any special treatment for the extensions API group.
func (*ObjMetadata) String ¶
func (o *ObjMetadata) String() string
String create a string version of the ObjMetadata struct. For RBAC resources, the "name" field transcodes ":" into double underscore for valid storing as the label of a ConfigMap.