Documentation ¶
Index ¶
- Variables
- func ClusterResourceQuota(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
- func CreateDefaultSNSLimitRange(snsObject *objectcontext.ObjectContext) error
- func CreateDefaultSNSResourceQuota(snsObject *objectcontext.ObjectContext) error
- func DoesSNSCRQExists(sns *objectcontext.ObjectContext) (bool, *objectcontext.ObjectContext, error)
- func DoesSNSRQExists(sns *objectcontext.ObjectContext) (bool, *objectcontext.ObjectContext, error)
- func DoesSubnamespaceObjectExist(sns *objectcontext.ObjectContext) (bool, *objectcontext.ObjectContext, error)
- func EnsureSubnamespaceObject(snsObject *objectcontext.ObjectContext, isRq bool) (ctrl.Result, error)
- func GetCrqPointer(subns client.Object) string
- func GetObservedResources(ctx context.Context, k8sClient client.Client) (corev1.ResourceQuotaSpec, error)
- func GetQuotaObjectSpec(QuotaObject client.Object) corev1.ResourceQuotaSpec
- func GetQuotaObjectsListResources(quotaObjs []*objectcontext.ObjectContext) corev1.ResourceList
- func GetQuotaUsed(QuotaObject client.Object) corev1.ResourceList
- func IsDefault(QuotaObject client.Object) bool
- func IsRQ(sns *objectcontext.ObjectContext, offset int) (bool, error)
- func IsZeroed(QuotaObject client.Object) bool
- func NamespaceObject(ns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
- func ResourceListEqual(resourceListA, resourceListB corev1.ResourceList) bool
- func ResourceQuota(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
- func ResourceQuotaSpecEqual(resourceQuotaSpecA, resourceQuotaSpecB corev1.ResourceQuotaSpec, ...) bool
- func RootNSObject(ns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
- func RootNSObjectFromName(obj *objectcontext.ObjectContext, rootNSName string) (*objectcontext.ObjectContext, error)
- func SubnamespaceChildrenObjects(sns *objectcontext.ObjectContext) []*objectcontext.ObjectContext
- func SubnamespaceObject(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
- func SubnamespaceObjectFromAnnotation(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
- func SubnamespaceParentObject(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
- func SubnamespaceSiblingObjects(sns *objectcontext.ObjectContext) []*objectcontext.ObjectContext
- func SubnamespaceSpec(sns client.Object) corev1.ResourceQuotaSpec
- func UpdateObject(quotaObject *objectcontext.ObjectContext, resources corev1.ResourceQuotaSpec, ...) error
- type ConfigMapData
Constants ¶
This section is empty.
Variables ¶
var ( Configmaps = resource.NewQuantity(100, resource.DecimalSI) Builds = resource.NewQuantity(100, resource.DecimalSI) Cronjobs = resource.NewQuantity(100, resource.DecimalSI) Daemonsets = resource.NewQuantity(100, resource.DecimalSI) Deployments = resource.NewQuantity(100, resource.DecimalSI) Replicasets = resource.NewQuantity(100, resource.DecimalSI) Routes = resource.NewQuantity(100, resource.DecimalSI) Secrets = resource.NewQuantity(100, resource.DecimalSI) ZeroDecimal = resource.NewQuantity(0, resource.DecimalSI) DefaultQuota = corev1.ResourceQuotaSpec{Hard: DefaultQuotaHard} DefaultQuotaHard = corev1.ResourceList{"configmaps": *Configmaps, "count/builds.build.openshift.io": *Builds, "count/cronjobs.batch": *Cronjobs, "count/daemonsets.apps": *Daemonsets, "count/deployments.apps": *Deployments, "count/jobs.batch": *Cronjobs, "count/replicasets.apps": *Replicasets, "count/routes.route.openshift.io": *Routes, "secrets": *Secrets, "count/deploymentconfigs.apps.openshift.io": *deploymentconfigs, "count/buildconfigs.build.openshift.io": *buildconfigs, "count/serviceaccounts": *serviceaccounts, "count/statefulsets.apps": *statefulsets, "count/templates.template.openshift.io": *templates, "openshift.io/imagestreams": *imagestreams} )
Functions ¶
func ClusterResourceQuota ¶
func ClusterResourceQuota(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
ClusterResourceQuota returns a ClusterResourceQuota object.
func CreateDefaultSNSLimitRange ¶
func CreateDefaultSNSLimitRange(snsObject *objectcontext.ObjectContext) error
CreateDefaultSNSLimitRange creates a limit range object with some default values that we would like to limit and are not set by the user.
func CreateDefaultSNSResourceQuota ¶
func CreateDefaultSNSResourceQuota(snsObject *objectcontext.ObjectContext) error
CreateDefaultSNSResourceQuota creates a ResourceQuota object with some default values that we would like to limit and are not set by the user. This is only created in subnamespaces that have a ClusterResourceQuota.
func DoesSNSCRQExists ¶
func DoesSNSCRQExists(sns *objectcontext.ObjectContext) (bool, *objectcontext.ObjectContext, error)
DoesSNSCRQExists returns true if a ClusterResourceQuota exists.
func DoesSNSRQExists ¶
func DoesSNSRQExists(sns *objectcontext.ObjectContext) (bool, *objectcontext.ObjectContext, error)
DoesSNSRQExists returns true if a ResourceQuota exists.
func DoesSubnamespaceObjectExist ¶
func DoesSubnamespaceObjectExist(sns *objectcontext.ObjectContext) (bool, *objectcontext.ObjectContext, error)
DoesSubnamespaceObjectExist returns true if an object quota exists.
func EnsureSubnamespaceObject ¶
func EnsureSubnamespaceObject(snsObject *objectcontext.ObjectContext, isRq bool) (ctrl.Result, error)
EnsureSubnamespaceObject ensures that a quota object exists for a subnamespace.
func GetCrqPointer ¶
GetCrqPointer gets a subnamespace and returns its crq-pointer. If it has a CRQ, which means it's a subnamesapce or an upper-rp, it returns its name. If it doesn't, it returns the upper resourcepool's name.
func GetObservedResources ¶ added in v1.5.0
func GetObservedResources(ctx context.Context, k8sClient client.Client) (corev1.ResourceQuotaSpec, error)
GetObservedResources returns default values for all observed resources inside a ResourceQuotaSpec object. The observed resources are read from a configMap.
func GetQuotaObjectSpec ¶
func GetQuotaObjectSpec(QuotaObject client.Object) corev1.ResourceQuotaSpec
GetQuotaObjectSpec returns the quota of a quota object.
func GetQuotaObjectsListResources ¶
func GetQuotaObjectsListResources(quotaObjs []*objectcontext.ObjectContext) corev1.ResourceList
GetQuotaObjectsListResources returns a ResourceList with all the resources of the given objects summed up.
func GetQuotaUsed ¶
func GetQuotaUsed(QuotaObject client.Object) corev1.ResourceList
GetQuotaUsed returns the used value from the status of a quota object (RQ or CRQ).
func IsRQ ¶
func IsRQ(sns *objectcontext.ObjectContext, offset int) (bool, error)
IsRQ returns true if the depth of the subnamespace is less or equal the pre-set rqDepth AND if the subnamespace is not a ResourcePool.
func NamespaceObject ¶
func NamespaceObject(ns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
NamespaceObject returns the quota object of a namespace.
func ResourceListEqual ¶
func ResourceListEqual(resourceListA, resourceListB corev1.ResourceList) bool
ResourceListEqual gets two ResourceLists and returns whether their specs are equal.
func ResourceQuota ¶
func ResourceQuota(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
ResourceQuota returns a ResourceQuota object.
func ResourceQuotaSpecEqual ¶
func ResourceQuotaSpecEqual(resourceQuotaSpecA, resourceQuotaSpecB corev1.ResourceQuotaSpec, observedResourcesSpec corev1.ResourceQuotaSpec) bool
ResourceQuotaSpecEqual gets two ResourceQuotaSpecs and returns whether their specs are equal.
func RootNSObject ¶
func RootNSObject(ns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
RootNSObject returns the quota object of a root namespace.
func RootNSObjectFromName ¶
func RootNSObjectFromName(obj *objectcontext.ObjectContext, rootNSName string) (*objectcontext.ObjectContext, error)
RootNSObjectFromName returns the quota object of a root namespace.
func SubnamespaceChildrenObjects ¶
func SubnamespaceChildrenObjects(sns *objectcontext.ObjectContext) []*objectcontext.ObjectContext
SubnamespaceChildrenObjects returns the quota objects of all the children of a subnamespace.
func SubnamespaceObject ¶
func SubnamespaceObject(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
SubnamespaceObject returns the quota object of a subnamesapce.
func SubnamespaceObjectFromAnnotation ¶
func SubnamespaceObjectFromAnnotation(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
SubnamespaceObjectFromAnnotation returns the quota object of a subnamesapce using annotations.
func SubnamespaceParentObject ¶
func SubnamespaceParentObject(sns *objectcontext.ObjectContext) (*objectcontext.ObjectContext, error)
SubnamespaceParentObject returns the quota object of a subnamespace. The quota object can be either a ResourceQuota object or a ClusterResourceQuota object depending on the depth in the hierarchy of the SNS.
func SubnamespaceSiblingObjects ¶
func SubnamespaceSiblingObjects(sns *objectcontext.ObjectContext) []*objectcontext.ObjectContext
SubnamespaceSiblingObjects returns a slice of the quota objects of all the siblings of a subnamespace.
func SubnamespaceSpec ¶
func SubnamespaceSpec(sns client.Object) corev1.ResourceQuotaSpec
SubnamespaceSpec returns the ResourceQuotaSpec of a subnamespace.
func UpdateObject ¶
func UpdateObject(quotaObject *objectcontext.ObjectContext, resources corev1.ResourceQuotaSpec, isRq bool) error
UpdateObject updates the spec of the quotaObject to be same as the given resources.
Types ¶
type ConfigMapData ¶ added in v1.5.0
type ConfigMapData struct { Minimum resourceQuantities `json:"minimum" yaml:"minimum"` DefaultRequest resourceQuantities `json:"defaultRequest" yaml:"defaultRequest"` DefaultLimit resourceQuantities `json:"defaultLimit" yaml:"defaultLimit"` Maximum resourceQuantities `json:"maximum" yaml:"maximum"` MinimumPVC resourceQuantities `json:"minimumPVC" yaml:"minimumPVC"` }