Documentation ¶
Index ¶
- Constants
- Variables
- func AppendClusterDplMap(statusdpl dplv1alpha1.Deployable, dpl dplv1alpha1.Deployable, ...)
- func CheckAndInstallCRD(crdconfig *rest.Config, pathname string) error
- func ConvertLabels(labelSelector *metav1.LabelSelector) (labels.Selector, error)
- func EnterFnString() string
- func ExitFuString(s string)
- func GetFnName() string
- func GetUniqueDeployables(allDpls []*dplv1alpha1.Deployable) []*dplv1alpha1.Deployable
- func GetUniqueSubscriptions(allSubs []*subv1alpha1.Subscription) []*subv1alpha1.Subscription
- func PrintAllClusterDplMap(allClusterDplMap map[string]*DplMap)
- func UpdateAppInstance(oldApp, newApp *appv1beta1.Application) bool
- type DplMap
- type EventRecorder
Constants ¶
const NoiseLogLel = 5
NoiseLogLel - information inside "important functions"
const QuiteLogLel = 4
QuiteLogLel - "important" information
const (
ResourceLabelName = "name"
)
const VeryNoisy = 10
VeryNoisy = show call stack, routine and everything
Variables ¶
var DeployablePredicateFunc = predicate.Funcs{ UpdateFunc: func(e event.UpdateEvent) bool { newdpl := e.ObjectNew.(*dplv1.Deployable) olddpl := e.ObjectOld.(*dplv1.Deployable) if len(newdpl.GetFinalizers()) > 0 { 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
var SubscriptionPredicateFunc = predicate.Funcs{ UpdateFunc: func(e event.UpdateEvent) bool { subOld := e.ObjectOld.(*subv1.Subscription) subNew := e.ObjectNew.(*subv1.Subscription) if len(subNew.GetFinalizers()) > 0 { return true } if !reflect.DeepEqual(subOld.GetLabels(), subNew.GetLabels()) { return true } if !reflect.DeepEqual(subOld.GetAnnotations(), subNew.GetAnnotations()) { return true } if !reflect.DeepEqual(subOld.Spec, subNew.Spec) { return true } if subNew.Status.Phase == "" || subNew.Status.Phase != subOld.Status.Phase { klog.V(5).Info("We care phase..", subNew.Status.Phase, " vs ", subOld.Status.Phase) return true } klog.V(1).Info("Something we don't care changed") return false }, }
SubscriptionPredicateFunc filters status update
Functions ¶
func AppendClusterDplMap ¶
func AppendClusterDplMap(statusdpl dplv1alpha1.Deployable, dpl dplv1alpha1.Deployable, allClusterDplMap map[string]*DplMap)
AppendClusterDplMap append dpl and its deployed cluster to allClusterDplMap
func CheckAndInstallCRD ¶
CheckAndInstallCRD checks if deployable belongs to this cluster managed cluster annotation matches or no managed cluster annotation (local)
func ConvertLabels ¶
func ConvertLabels(labelSelector *metav1.LabelSelector) (labels.Selector, error)
ConvertLabels coverts label selector to lables.Selector
func GetUniqueDeployables ¶
func GetUniqueDeployables(allDpls []*dplv1alpha1.Deployable) []*dplv1alpha1.Deployable
GetUniqueDeployables get unique deployable array
func GetUniqueSubscriptions ¶
func GetUniqueSubscriptions(allSubs []*subv1alpha1.Subscription) []*subv1alpha1.Subscription
GetUniqueSubscriptions get unique subscription array
func PrintAllClusterDplMap ¶
PrintAllClusterDplMap print all cluster deployable map
func UpdateAppInstance ¶
func UpdateAppInstance(oldApp, newApp *appv1beta1.Application) bool
Types ¶
type DplMap ¶
type DplMap struct {
DplResourceMap map[string]*dplv1alpha1.Deployable
}
DplMap store all dpl names for a cluster [dplName]
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