Add APIs for computing status based on fetching resource info from a

cluster
This commit is contained in:
Morten Torkildsen
2019-11-15 18:51:56 -08:00
parent e5382c59a2
commit a489f30183
15 changed files with 1371 additions and 13 deletions

28
kstatus/wait/util.go Normal file
View File

@@ -0,0 +1,28 @@
package wait
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// keyFromResourceIdentifier creates a resourceKey from a ResourceIdentifier.
func keyFromResourceIdentifier(i ResourceIdentifier) resourceKey {
return resourceKey{
apiVersion: i.GetAPIVersion(),
kind: i.GetKind(),
name: i.GetName(),
namespace: i.GetNamespace(),
}
}
// keyFromObject creates a resourceKey from an Object.
func keyFromObject(obj runtime.Object) resourceKey {
gvk := obj.GetObjectKind().GroupVersionKind()
r := obj.(metav1.Object)
return resourceKey{
apiVersion: gvk.GroupVersion().String(),
kind: gvk.Kind,
name: r.GetName(),
namespace: r.GetNamespace(),
}
}