Documentation
¶
Index ¶
- Constants
- Variables
- func AddPartOfLabel(s *appv1.Subscription, m map[string]string) map[string]string
- func AllowApplyTemplate(localClient client.Client, template *unstructured.Unstructured) bool
- func BuildKubeClient(kubeConfigPath string) (*kubernetes.Clientset, error)
- func CanPassPackageFilter(filter *appv1.PackageFilter, obj objAnno) bool
- func CheckAndInstallCRD(crdconfig *rest.Config, pathname string) error
- func CheckPackageOverride(ov *appv1.Overrides) error
- func CloneGitRepo(cloneOptions *GitCloneOption) (commitID string, err error)
- func ConvertLabels(labelSelector *metav1.LabelSelector) (labels.Selector, error)
- func CreateHelmCRDeployable(repoURL string, packageName string, chartVersions repo.ChartVersions, ...) (*dplv1.Deployable, error)
- func CreateOrUpdateHelmChart(packageName string, releaseCRName string, chartVersions repo.ChartVersions, ...) (helmRelease *releasev1.HelmRelease, err error)
- func DeleteDeployableCRD(runtimeClient client.Client, crdx *clientsetx.Clientset)
- func DeleteHelmReleaseCRD(runtimeClient client.Client, crdx *clientsetx.Clientset)
- func DeleteInClusterPackageStatus(substatus *appv1.SubscriptionStatus, pkgname string, pkgerr error, ...)
- func DeleteSubscriptionCRD(runtimeClient client.Client, crdx *clientsetx.Clientset)
- func DplArrayToDplPointers(dplList []dplv1alpha1.Deployable) []*dplv1alpha1.Deployable
- func EnterFnString() string
- func ExitFuString(s string)
- func FilterCharts(sub *appv1.Subscription, indexFile *repo.IndexFile) error
- func FilterOutTimeRelatedFields(in *appv1.Subscription) *appv1.Subscription
- func GenerateHelmIndexFile(sub *appv1.Subscription, repoRoot string, chartDirs map[string]string) (*repo.IndexFile, error)
- func GenerateServerCerts(dir string) error
- func GenerateVersionSet(dplPointers []*dplv1alpha1.Deployable, vsub string) map[string]VersionRep
- func GetChannelConfigMap(client client.Client, chn *chnv1.Channel) *corev1.ConfigMap
- func GetChannelSecret(client client.Client, chn *chnv1.Channel) (string, string, []byte, []byte, error)
- func GetClusterFromResourceObject(obj metav1.Object) *types.NamespacedName
- func GetComponentNamespace() (string, error)
- func GetFnName() string
- func GetHostDeployable(hostAnnotation string) *types.NamespacedName
- func GetHostDeployableFromObject(obj metav1.Object) *types.NamespacedName
- func GetHostSubscriptionFromObject(obj metav1.Object) *types.NamespacedName
- func GetKubeIgnore(resourcePath string) *gitignore.GitIgnore
- func GetLatestCommitID(url, branch string, clt ...*github.Client) (string, error)
- func GetLocalGitFolder(chn *chnv1.Channel, sub *appv1.Subscription) string
- func GetPackageAlias(sub *appv1.Subscription, packageName string) string
- func GetPauseLabel(instance *appv1.Subscription) bool
- func GetReconcileInterval(reconcileRate, chType string) (time.Duration, time.Duration, int)
- func GetReconcileRate(chnAnnotations, subAnnotations map[string]string) string
- func GetReleaseName(base string) (string, error)
- func GetSourceFromObject(obj metav1.Object) string
- func GetSubscriptionBranch(sub *appv1.Subscription) plumbing.ReferenceName
- func GetSubscriptionBranchRef(b string) plumbing.ReferenceName
- func IsClusterAdmin(client client.Client, sub *appv1.Subscription, eventRecorder *EventRecorder) bool
- func IsDeployableInVersionSet(vMap map[string]VersionRep, dpl *dplv1alpha1.Deployable) bool
- func IsEqualSubScriptionStatus(o, n *appv1.SubscriptionStatus) bool
- func IsGitChannel(chType string) bool
- func IsHub(config *rest.Config) bool
- func IsHubRelatedStatusChanged(old, nnew *appv1.SubscriptionStatus) bool
- func IsInWindow(tw *appv1alpha1.TimeWindow, t time.Time) bool
- func IsLocalDeployable(instance *dplv1.Deployable) bool
- func IsResourceOwnedByCluster(obj metav1.Object, cluster types.NamespacedName) bool
- func IsSubscriptionBasicChanged(o, n *appv1.Subscription) bool
- func IsSubscriptionBeDeleted(clt client.Client, subKey types.NamespacedName) bool
- func IsSubscriptionResourceChanged(oSub, nSub *appv1.Subscription) bool
- func IsURL(str string) bool
- func KeywordsChecker(labelSelector *metav1.LabelSelector, ks []string) bool
- func KubeResourceParser(file []byte, cond Kube) [][]byte
- func LabelChecker(ls *metav1.LabelSelector, dplls map[string]string) bool
- func LabelsChecker(labelSelector *metav1.LabelSelector, ls map[string]string) bool
- func MatchLabelForSubAndDpl(ls *metav1.LabelSelector, dplls map[string]string) bool
- func NamespacedNameFormat(str string) types.NamespacedName
- func NextStartPoint(tw *appv1alpha1.TimeWindow, t time.Time) time.Duration
- func NextStatusReconcile(tw *appv1alpha1.TimeWindow, t time.Time) time.Duration
- func Override(helmRelease *releasev1.HelmRelease, sub *appv1.Subscription) error
- func OverrideKustomize(pov appv1.PackageOverride, kustomizeDir string) error
- func OverrideResourceBySubscription(template *unstructured.Unstructured, pkgName string, ...) (*unstructured.Unstructured, error)
- func OverrideTemplate(template *unstructured.Unstructured, overrides []appv1alpha1.ClusterOverride) (*unstructured.Unstructured, error)
- func ParseChannelSecret(secret *corev1.Secret) (string, string, []byte, []byte, error)
- func ParseKubeResoures(file []byte) [][]byte
- func ParseYAML(fileContent []byte) []string
- func PkgToReleaseCRName(sub *appv1.Subscription, packageName string) (string, error)
- func PrepareOverrides(cluster types.NamespacedName, instance *appv1alpha1.Deployable) ([]appv1alpha1.ClusterOverride, error)
- func PrintSubscriptionStatus(a *subv1.SubscriptionStatus)
- func RemoveSubAnnotations(obj *unstructured.Unstructured) *unstructured.Unstructured
- func RemoveSubOwnerRef(obj *unstructured.Unstructured) *unstructured.Unstructured
- func RunKustomizeBuild(kustomizeDir string) ([]byte, error)
- func SemverCheck(vSubStr, vDplStr string) bool
- func SetInClusterPackageStatus(substatus *appv1.SubscriptionStatus, pkgname string, pkgerr error, ...) error
- func SetPartOfLabel(s *appv1.Subscription, rsc *unstructured.Unstructured)
- func SkipHooksOnManaged(resourcePath, curPath string) bool
- func SkipOrUpdateSubscriptionStatus(clt client.Client, oldSub *appv1.Subscription) error
- func SortResources(repoRoot, resourcePath string, skips ...SkipFunc) (map[string]string, map[string]string, []string, []string, []string, error)
- func UnifyTimeZone(tw *appv1alpha1.TimeWindow, t time.Time) time.Time
- func UpdateCRDs(p string, tRepo []string, logger logr.Logger) error
- func UpdateDeployableStatus(statusClient client.Client, templateerr error, tplunit metav1.Object, ...) error
- func UpdateSubscriptionStatus(statusClient client.Client, templateerr error, tplunit metav1.Object, ...) error
- func ValidateK8sLabel(s string) string
- func ValidatePackagesInSubscriptionStatus(statusClient client.StatusClient, sub *appv1.Subscription, ...) error
- func VerifyAndOverrideKustomize(packageOverrides []*appv1.Overrides, relativePath, kustomizeDir string)
- type EventRecorder
- type GitCloneOption
- type Kube
- type KubeResource
- type SkipFunc
- type VersionRep
Constants ¶
const ( // UserID is key of GitHub user ID in secret UserID = "user" // AccessToken is key of GitHub user password or personal token in secret AccessToken = "accessToken" // SSHKey is use to connect to the channel via SSH SSHKey = "sshKey" // Passphrase is used to open the SSH key Passphrase = "passphrase" )
const (
//MIDNIGHT define the midnight format
MIDNIGHT = "12:00AM"
)
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 ChannelPredicateFunctions = predicate.Funcs{ UpdateFunc: func(e event.UpdateEvent) bool { newChn := e.ObjectNew.(*chnv1.Channel) oldChn := e.ObjectOld.(*chnv1.Channel) oldAnnotations := oldChn.GetAnnotations() newAnnotations := newChn.GetAnnotations() if !reflect.DeepEqual(oldAnnotations, newAnnotations) { return true } return !reflect.DeepEqual(newChn.Spec, oldChn.Spec) }, CreateFunc: func(e event.CreateEvent) bool { return true }, DeleteFunc: func(e event.DeleteEvent) bool { return true }, }
ChannelPredicateFunctions filters channel spec update
var (
DefaultRepos = map[string]map[string]string{
"ansiblejob": {
"url": "https://raw.githubusercontent.com/open-cluster-management/ansiblejob-go-lib/master/config/crd/bases/tower.ansible.com_ansiblejobs.yaml",
"crdName": "tower.ansible.com_ansiblejobs_crd.yaml",
},
"channel": {
"url": "https://raw.githubusercontent.com/open-cluster-management/multicloud-operators-channel/master/deploy/crds/apps.open-cluster-management.io_channels_crd.yaml",
"crdName": "apps.open-cluster-management.io_channel_crd.yaml",
},
"subscription": {
"url": "https://raw.githubusercontent.com/open-cluster-management/multicloud-operators-subscription/master/deploy/crds/apps.open-cluster-management.io_subscriptions.yaml",
"crdName": "apps.open-cluster-management.io_subscriptions_crd.yaml",
},
"deployable": {
"url": "https://raw.githubusercontent.com/open-cluster-management/multicloud-operators-deployable/master/deploy/crds/apps.open-cluster-management.io_deployables_crd.yaml",
"crdName": "apps.open-cluster-management.io_deployable_crd.yaml",
},
"placementrule": {
"url": "https://raw.githubusercontent.com/open-cluster-management/multicloud-operators-placementrule/master/deploy/crds/apps.open-cluster-management.io_placementrules_crd.yaml",
"crdName": "apps.open-cluster-management.io_placementrules_crd.yaml",
},
"helmrelease": {
"url": "https://raw.githubusercontent.com/open-cluster-management/multicloud-operators-subscription-release/master/deploy/crds/apps.open-cluster-management.io_helmreleases_crd.yaml",
"crdName": "apps.open-cluster-management.io_helmrelease_crd.yaml",
},
"managedcluster": {
"url": "https://raw.githubusercontent.com/open-cluster-management/api/master/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml",
"crdName": "clusters.open-cluster-management.io_managedclusters.crd.yaml",
},
}
)
var DeployablePredicateFunctions = predicate.Funcs{ UpdateFunc: func(e event.UpdateEvent) bool { newdpl := e.ObjectNew.(*dplv1.Deployable) olddpl := e.ObjectOld.(*dplv1.Deployable) return !reflect.DeepEqual(newdpl.Status, olddpl.Status) }, CreateFunc: func(e event.CreateEvent) bool { newdpl := e.Object.(*dplv1.Deployable) labels := newdpl.GetLabels() if strings.EqualFold(labels[chnv1.KeyChannelType], chnv1.ChannelTypeGitHub) || strings.EqualFold(labels[chnv1.KeyChannelType], chnv1.ChannelTypeGit) { return false } return true }, DeleteFunc: func(e event.DeleteEvent) bool { dpl := e.Object.(*dplv1.Deployable) labels := dpl.GetLabels() if strings.EqualFold(labels[chnv1.KeyChannelType], chnv1.ChannelTypeGitHub) || strings.EqualFold(labels[chnv1.KeyChannelType], chnv1.ChannelTypeGit) { return false } return true }, }
DeployablePredicateFunctions filters status update
var PlacementRulePredicateFunctions = predicate.Funcs{ UpdateFunc: func(e event.UpdateEvent) bool { newPlr := e.ObjectNew.(*plrv1.PlacementRule) oldPlr := e.ObjectOld.(*plrv1.PlacementRule) return !reflect.DeepEqual(newPlr.Status.Decisions, oldPlr.Status.Decisions) }, CreateFunc: func(e event.CreateEvent) bool { return true }, DeleteFunc: func(e event.DeleteEvent) bool { return true }, }
PlacementRulePredicateFunctions filters PlacementRule status decisions update
var ServiceAccountPredicateFunctions = predicate.Funcs{ UpdateFunc: func(e event.UpdateEvent) bool { newSA := e.ObjectNew.(*corev1.ServiceAccount) if strings.EqualFold(newSA.Namespace, addonServiceAccountNamespace) && strings.EqualFold(newSA.Name, addonServiceAccountName) { return true } return false }, CreateFunc: func(e event.CreateEvent) bool { sa := e.Object.(*corev1.ServiceAccount) if strings.EqualFold(sa.Namespace, addonServiceAccountNamespace) && strings.EqualFold(sa.Name, addonServiceAccountName) { return true } return false }, DeleteFunc: func(e event.DeleteEvent) bool { sa := e.Object.(*corev1.ServiceAccount) if strings.EqualFold(sa.Namespace, addonServiceAccountNamespace) && strings.EqualFold(sa.Name, addonServiceAccountName) { return true } return false }, }
ServiceAccountPredicateFunctions watches for changes in klusterlet-addon-appmgr service account in open-cluster-management-agent-addon namespace
var SubscriptionPredicateFunctions = predicate.Funcs{ UpdateFunc: func(e event.UpdateEvent) bool { subOld := e.ObjectOld.(*appv1.Subscription) subNew := e.ObjectNew.(*appv1.Subscription) return IsSubscriptionResourceChanged(subOld, subNew) }, }
SubscriptionPredicateFunctions filters status update
Functions ¶
func AddPartOfLabel ¶
func AllowApplyTemplate ¶
func AllowApplyTemplate(localClient client.Client, template *unstructured.Unstructured) bool
AllowApplyTemplate check if the template is allowed to apply based on its hosting subscription pause label return false if the hosting subscription is paused.
func BuildKubeClient ¶
func BuildKubeClient(kubeConfigPath string) (*kubernetes.Clientset, error)
func CanPassPackageFilter ¶
func CanPassPackageFilter(filter *appv1.PackageFilter, obj objAnno) bool
FilterPackageOut process the package filter logic
func CheckAndInstallCRD ¶
CheckAndInstallCRD checks if deployable belongs to this cluster managed cluster annotation matches or no managed cluster annotation (local)
func CheckPackageOverride ¶
func CloneGitRepo ¶
func CloneGitRepo(cloneOptions *GitCloneOption) (commitID string, err error)
CloneGitRepo clones a GitHub repository
func ConvertLabels ¶
func ConvertLabels(labelSelector *metav1.LabelSelector) (labels.Selector, error)
ConvertLabels coverts label selector to lables.Selector
func CreateHelmCRDeployable ¶
func CreateHelmCRDeployable( repoURL string, packageName string, chartVersions repo.ChartVersions, client client.Client, channel *chnv1.Channel, sub *appv1.Subscription) (*dplv1.Deployable, error)
func CreateOrUpdateHelmChart ¶
func CreateOrUpdateHelmChart( packageName string, releaseCRName string, chartVersions repo.ChartVersions, client client.Client, channel *chnv1.Channel, sub *appv1.Subscription) (helmRelease *releasev1.HelmRelease, err error)
func DeleteDeployableCRD ¶
func DeleteDeployableCRD(runtimeClient client.Client, crdx *clientsetx.Clientset)
DeleteDeployableCRD deletes the Deployable CRD
func DeleteHelmReleaseCRD ¶
func DeleteHelmReleaseCRD(runtimeClient client.Client, crdx *clientsetx.Clientset)
DeleteHelmReleaseCRD deletes the HelmRelease CRD
func DeleteInClusterPackageStatus ¶
func DeleteInClusterPackageStatus(substatus *appv1.SubscriptionStatus, pkgname string, pkgerr error, status interface{})
DeleteInClusterPackageStatus deletes a package status
func DeleteSubscriptionCRD ¶
func DeleteSubscriptionCRD(runtimeClient client.Client, crdx *clientsetx.Clientset)
DeleteSubscriptionCRD deletes the Subscription CRD
func DplArrayToDplPointers ¶
func DplArrayToDplPointers(dplList []dplv1alpha1.Deployable) []*dplv1alpha1.Deployable
DplArrayToDplPointers covert the array to pointer array
func FilterCharts ¶
func FilterCharts(sub *appv1.Subscription, indexFile *repo.IndexFile) error
FilterCharts filters the indexFile by name, version, digest
func FilterOutTimeRelatedFields ¶
func FilterOutTimeRelatedFields(in *appv1.Subscription) *appv1.Subscription
the input object shouldn't be changed at all
func GenerateHelmIndexFile ¶
func GenerateHelmIndexFile(sub *appv1.Subscription, repoRoot string, chartDirs map[string]string) (*repo.IndexFile, error)
GenerateHelmIndexFile generate helm repo index file
func GenerateServerCerts ¶
func GenerateVersionSet ¶
func GenerateVersionSet(dplPointers []*dplv1alpha1.Deployable, vsub string) map[string]VersionRep
GenerateVersionSet produce a map, key: dpl.GetGenerateName(), value: dpl.NamespacedName.String() the value is the largest version which meet the subscription version requirement.
func GetChannelConfigMap ¶
GetDataFromChannelConfigMap returns username and password for channel
func GetChannelSecret ¶
func GetChannelSecret(client client.Client, chn *chnv1.Channel) (string, string, []byte, []byte, error)
GetChannelSecret returns username and password for channel
func GetClusterFromResourceObject ¶
func GetClusterFromResourceObject(obj metav1.Object) *types.NamespacedName
GetClusterFromResourceObject return nil if no host is found
func GetComponentNamespace ¶
func GetHostDeployable ¶
func GetHostDeployable(hostAnnotation string) *types.NamespacedName
func GetHostDeployableFromObject ¶
func GetHostDeployableFromObject(obj metav1.Object) *types.NamespacedName
GetHostDeployableFromObject return nil if no host is found
func GetHostSubscriptionFromObject ¶
func GetHostSubscriptionFromObject(obj metav1.Object) *types.NamespacedName
GetHostSubscriptionFromObject extract the namespacedname of subscription hosting the object resource
func GetKubeIgnore ¶
GetKubeIgnore get .kubernetesignore list
func GetLatestCommitID ¶
func GetLocalGitFolder ¶
func GetLocalGitFolder(chn *chnv1.Channel, sub *appv1.Subscription) string
GetLocalGitFolder returns the local Git repo clone directory
func GetPackageAlias ¶
func GetPackageAlias(sub *appv1.Subscription, packageName string) string
func GetPauseLabel ¶
func GetPauseLabel(instance *appv1.Subscription) bool
GetPauseLabel check if the subscription-pause label exists
func GetReconcileInterval ¶
GetReconcileInterval determines reconcile loop interval based on reconcileRate setting
func GetReconcileRate ¶
GetReconcileRate determines reconcile rate based on channel annotations
func GetReleaseName ¶
GetReleaseName alters the given name in a deterministic way if the length exceed the maximum character
func GetSourceFromObject ¶
GetSourceFromObject extract the namespacedname of subscription hosting the object resource
func GetSubscriptionBranch ¶
func GetSubscriptionBranch(sub *appv1.Subscription) plumbing.ReferenceName
GetSubscriptionBranch returns GitHub repo branch for a given subscription
func GetSubscriptionBranchRef ¶
func GetSubscriptionBranchRef(b string) plumbing.ReferenceName
func IsClusterAdmin ¶
func IsClusterAdmin(client client.Client, sub *appv1.Subscription, eventRecorder *EventRecorder) bool
func IsDeployableInVersionSet ¶
func IsDeployableInVersionSet(vMap map[string]VersionRep, dpl *dplv1alpha1.Deployable) bool
IsDeployableInVersionSet - check if deployable is in version
func IsEqualSubScriptionStatus ¶
func IsEqualSubScriptionStatus(o, n *appv1.SubscriptionStatus) bool
func IsGitChannel ¶
IsGitChannel returns true if channel type is github or git
func IsHubRelatedStatusChanged ¶
func IsHubRelatedStatusChanged(old, nnew *appv1.SubscriptionStatus) bool
func IsInWindow ¶
func IsInWindow(tw *appv1alpha1.TimeWindow, t time.Time) bool
IsInWindow returns true if the give time is within a timewindow
func IsLocalDeployable ¶
func IsLocalDeployable(instance *dplv1.Deployable) bool
IsLocalDeployable checks if the deployable meant to be deployed
func IsResourceOwnedByCluster ¶
func IsResourceOwnedByCluster(obj metav1.Object, cluster types.NamespacedName) bool
IsResourceOwnedByCluster checks if the deployable belongs to this controller by AnnotationManagedCluster only the managed cluster annotation matches
func IsSubscriptionBasicChanged ¶
func IsSubscriptionBasicChanged(o, n *appv1.Subscription) bool
func IsSubscriptionBeDeleted ¶
func IsSubscriptionBeDeleted(clt client.Client, subKey types.NamespacedName) bool
func IsSubscriptionResourceChanged ¶
func IsSubscriptionResourceChanged(oSub, nSub *appv1.Subscription) bool
func KeywordsChecker ¶
func KeywordsChecker(labelSelector *metav1.LabelSelector, ks []string) bool
KeywordsChecker Checks if the helm chart has at least 1 keyword from the packageFilter.Keywords array
func KubeResourceParser ¶
func LabelChecker ¶
func LabelChecker(ls *metav1.LabelSelector, dplls map[string]string) bool
func LabelsChecker ¶
func LabelsChecker(labelSelector *metav1.LabelSelector, ls map[string]string) bool
LabelsChecker checks labels against a labelSelector
func MatchLabelForSubAndDpl ¶
func MatchLabelForSubAndDpl(ls *metav1.LabelSelector, dplls map[string]string) bool
func NamespacedNameFormat ¶
func NamespacedNameFormat(str string) types.NamespacedName
func NextStartPoint ¶
func NextStartPoint(tw *appv1alpha1.TimeWindow, t time.Time) time.Duration
NextStartPoint will map the container's time to the location time specified by user then it will handle the window type as will the hour ange and daysofweek for hour range and daysofweek, it will handle as the following if hour range is empty and weekday is empty then retrun 0 if hour range is empty and weekday is not then return nextday durtion(here the window type will be considered again)
func NextStatusReconcile ¶
func NextStatusReconcile(tw *appv1alpha1.TimeWindow, t time.Time) time.Duration
NextStatusReconcile generate a duartion for the reconcile to requeue after
func Override ¶
func Override(helmRelease *releasev1.HelmRelease, sub *appv1.Subscription) error
func OverrideKustomize ¶
func OverrideKustomize(pov appv1.PackageOverride, kustomizeDir string) error
func OverrideResourceBySubscription ¶
func OverrideResourceBySubscription(template *unstructured.Unstructured, pkgName string, instance *appv1.Subscription) (*unstructured.Unstructured, error)
OverrideResourceBySubscription alter the given template with overrides
func OverrideTemplate ¶
func OverrideTemplate(template *unstructured.Unstructured, overrides []appv1alpha1.ClusterOverride) (*unstructured.Unstructured, error)
OverrideTemplate alter the given template with overrides
func ParseChannelSecret ¶
func ParseKubeResoures ¶
ParseKubeResoures parses a YAML content and returns kube resources in byte array from the file
func PkgToReleaseCRName ¶
func PkgToReleaseCRName(sub *appv1.Subscription, packageName string) (string, error)
func PrepareOverrides ¶
func PrepareOverrides(cluster types.NamespacedName, instance *appv1alpha1.Deployable) ([]appv1alpha1.ClusterOverride, error)
PrepareOverrides returns the overridemap for given deployable instance
func PrintSubscriptionStatus ¶
func PrintSubscriptionStatus(a *subv1.SubscriptionStatus)
func RemoveSubAnnotations ¶
func RemoveSubAnnotations(obj *unstructured.Unstructured) *unstructured.Unstructured
RemoveSubAnnotations removes RHACM specific annotations from subscription
func RemoveSubOwnerRef ¶
func RemoveSubOwnerRef(obj *unstructured.Unstructured) *unstructured.Unstructured
RemoveSubAnnotations removes RHACM specific owner reference from subscription
func RunKustomizeBuild ¶
RunKustomizeBuild runs kustomize build and returns the build output
func SemverCheck ¶
SemverCheck filter Deployable based on the version annotations from Subscription and Deployable. Assume the input version is a string which meets the Semver format(https://semver.org/) SemverCheck: if the subscription version is geater than deploayalbe, then return true, otherwise return false edge case: if the version of subscription or deployable is empty then return true
func SetInClusterPackageStatus ¶
func SetInClusterPackageStatus(substatus *appv1.SubscriptionStatus, pkgname string, pkgerr error, status interface{}) error
SetInClusterPackageStatus creates status strcuture and fill status
func SetPartOfLabel ¶
func SetPartOfLabel(s *appv1.Subscription, rsc *unstructured.Unstructured)
func SkipHooksOnManaged ¶
func SkipOrUpdateSubscriptionStatus ¶
func SkipOrUpdateSubscriptionStatus(clt client.Client, oldSub *appv1.Subscription) error
func SortResources ¶
func SortResources(repoRoot, resourcePath string, skips ...SkipFunc) (map[string]string, map[string]string, []string, []string, []string, error)
SortResources sorts kube resources into different arrays for processing them later.
func UnifyTimeZone ¶
func UnifyTimeZone(tw *appv1alpha1.TimeWindow, t time.Time) time.Time
UnifyTimeZone convert a given time to the timewindow time zone, if the time window doesn't sepcifiy a time zone, then the running machine's time zone will be used
func UpdateDeployableStatus ¶
func UpdateDeployableStatus(statusClient client.Client, templateerr error, tplunit metav1.Object, status interface{}) error
UpdateDeployableStatus based on error message, and propagate resource status - nil: success - others: failed, with error message in reason
func UpdateSubscriptionStatus ¶
func UpdateSubscriptionStatus(statusClient client.Client, templateerr error, tplunit metav1.Object, status interface{}, deletePkg bool) error
UpdateSubscriptionStatus based on error message, and propagate resource status status - current object status tplunit - new content of the current object - nil: success - others: failed, with error message in reason
func ValidateK8sLabel ¶
ValidateK8sLabel returns a valid k8s label string by enforcing k8s label values rules as below
- Must consist of alphanumeric characters, '-', '_' or '.' No need to check this as the input string is the host name of the k8s api url
- Must be no more than 63 characters
- Must start and end with an alphanumeric character
func ValidatePackagesInSubscriptionStatus ¶
func ValidatePackagesInSubscriptionStatus(statusClient client.StatusClient, sub *appv1.Subscription, pkgMap map[string]bool) error
ValidatePackagesInSubscriptionStatus validate the status struture for packages
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
type GitCloneOption ¶
type Kube ¶
type Kube func(KubeResource) bool
type KubeResource ¶
type KubeResource struct {
// contains filtered or unexported fields
}
KKubeResource export the kuKubeResource for other package
type VersionRep ¶
VersionRep represent version