Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAndInstallCRD(crdconfig *rest.Config, pathname string) error
- func CompareDeployable(olddpl *appv1alpha1.Deployable, newdpl *appv1alpha1.Deployable) bool
- func ContainsName(a []types.NamespacedName, x string) bool
- func ConvertLabels(labelSelector *metav1.LabelSelector) (labels.Selector, error)
- func EnterFnString() string
- func ExitFuString(s string)
- func GenerateOverrides(src, dst *appv1alpha1.Deployable) (covs []appv1alpha1.ClusterOverride)
- func GetClusterFromResourceObject(obj metav1.Object) *types.NamespacedName
- func GetFnName() string
- func GetHostDeployableFromObject(obj metav1.Object) *types.NamespacedName
- func GetPauseLabel(instance *appv1alpha1.Deployable) bool
- func GetUnstructuredTemplateFromDeployable(instance *appv1alpha1.Deployable) (*unstructured.Unstructured, error)
- func InstanceDeepCopy(a, b interface{}) error
- func IsDependencyDeployable(instance *appv1alpha1.Deployable) bool
- func OverrideTemplate(template *unstructured.Unstructured, overrides []appv1alpha1.ClusterOverride) (*unstructured.Unstructured, error)
- func PrepareInstance(instance *appv1alpha1.Deployable) bool
- func PrepareOverrides(cluster types.NamespacedName, instance *appv1alpha1.Deployable) ([]appv1alpha1.ClusterOverride, error)
- func PrintPropagatedStatus(r map[string]*appv1alpha1.ResourceUnitStatus, msg string)
- func SetPauseLabelDplSubTpl(instance, targetdpl *appv1alpha1.Deployable) error
- func UpdateDeployableStatus(statusClient client.Client, templateerr error, tplunit metav1.Object, ...) error
- type EventRecorder
Constants ¶
const NoiseLogLel = 5
NoiseLogLel - information inside "important functions"
const QuiteLogLel = 4
QuiteLogLel - "important" information
const VeryNoisy = 10
VeryNoisy = show call stack, routine and everything
Variables ¶
var DeployablePredicateFunc = predicate.Funcs{ UpdateFunc: func(e event.UpdateEvent) bool { newdpl := e.ObjectNew.(*appv1alpha1.Deployable) olddpl := e.ObjectOld.(*appv1alpha1.Deployable) if len(newdpl.GetFinalizers()) > 0 { return true } hosting := GetHostDeployableFromObject(newdpl) if hosting != nil { return true } if !reflect.DeepEqual(newdpl.GetAnnotations(), olddpl.GetAnnotations()) { return true } if !reflect.DeepEqual(newdpl.GetLabels(), olddpl.GetLabels()) { return true } oldtmpl := &unstructured.Unstructured{} newtmpl := &unstructured.Unstructured{} if olddpl.Spec.Template == nil || olddpl.Spec.Template.Raw == nil { return true } err := json.Unmarshal(olddpl.Spec.Template.Raw, oldtmpl) if err != nil { return true } if newdpl.Spec.Template.Raw == nil { return true } err = json.Unmarshal(newdpl.Spec.Template.Raw, newtmpl) if err != nil { return true } if !reflect.DeepEqual(newtmpl, oldtmpl) { return true } olddpl.Spec.Template = newdpl.Spec.Template.DeepCopy() return !reflect.DeepEqual(olddpl.Spec, newdpl.Spec) }, }
DeployablePredicateFunc defines predicate function for deployable watch in deployable controller
Functions ¶
func CheckAndInstallCRD ¶
CheckAndInstallCRD checks if deployable belongs to this cluster managed cluster annotation matches or no managed cluster annotation (local)
func CompareDeployable ¶
func CompareDeployable(olddpl *appv1alpha1.Deployable, newdpl *appv1alpha1.Deployable) bool
CompareDeployable compare two deployables and return true if they are equal.
func ContainsName ¶
func ContainsName(a []types.NamespacedName, x string) bool
ContainsName check whether the namespacedName array a contains string x
func ConvertLabels ¶
func ConvertLabels(labelSelector *metav1.LabelSelector) (labels.Selector, error)
ConvertLabels coverts label selector to lables.Selector
func GenerateOverrides ¶
func GenerateOverrides(src, dst *appv1alpha1.Deployable) (covs []appv1alpha1.ClusterOverride)
GenerateOverrides compare 2 deployable and generate array for overrides
func GetClusterFromResourceObject ¶
func GetClusterFromResourceObject(obj metav1.Object) *types.NamespacedName
GetClusterFromResourceObject return nil if no host is found
func GetHostDeployableFromObject ¶
func GetHostDeployableFromObject(obj metav1.Object) *types.NamespacedName
GetHostDeployableFromObject return nil if no host is found
func GetPauseLabel ¶
func GetPauseLabel(instance *appv1alpha1.Deployable) bool
GetPauseLabel check if the subscription-pause label exists
func GetUnstructuredTemplateFromDeployable ¶
func GetUnstructuredTemplateFromDeployable(instance *appv1alpha1.Deployable) (*unstructured.Unstructured, error)
GetUnstructuredTemplateFromDeployable return error if needed
func InstanceDeepCopy ¶
func InstanceDeepCopy(a, b interface{}) error
func IsDependencyDeployable ¶
func IsDependencyDeployable(instance *appv1alpha1.Deployable) bool
IsDependencyDeployable return true the deploable is dependent depolyable
func OverrideTemplate ¶
func OverrideTemplate(template *unstructured.Unstructured, overrides []appv1alpha1.ClusterOverride) (*unstructured.Unstructured, error)
OverrideTemplate alter the given template with overrides
func PrepareInstance ¶
func PrepareInstance(instance *appv1alpha1.Deployable) bool
PrepareInstance prepares the deployable instane for later actions
func PrepareOverrides ¶
func PrepareOverrides(cluster types.NamespacedName, instance *appv1alpha1.Deployable) ([]appv1alpha1.ClusterOverride, error)
PrepareOverrides returns the overridemap for given deployable instance
func PrintPropagatedStatus ¶
func PrintPropagatedStatus(r map[string]*appv1alpha1.ResourceUnitStatus, msg string)
PrintPropagatedStatus output Propagated Status for each cluster
func SetPauseLabelDplSubTpl ¶
func SetPauseLabelDplSubTpl(instance, targetdpl *appv1alpha1.Deployable) error
SetPauseLabelDplSubTpl set the subscription-pause label to a deployable containing a subscription template
Types ¶
type EventRecorder ¶
type EventRecorder struct {
record.EventRecorder
}
EventRecorder - record kubernetes event
func NewEventRecorder ¶
func NewEventRecorder(cfg *rest.Config, scheme *apiruntime.Scheme) (*EventRecorder, error)
NewEventRecorder - create new event recorder from rect config
func (*EventRecorder) RecordEvent ¶
func (rec *EventRecorder) RecordEvent(obj apiruntime.Object, reason, msg string, err error)
RecordEvent - record kuberentes event