Documentation
¶
Index ¶
- Constants
- func AddCredentialsSecret(comp InfoGetter, svc *runtime.ServiceRuntime, fieldList []string, ...) (string, error)
- func AddGenericSecret(comp InfoGetter, svc *runtime.ServiceRuntime, suffix string, ...) (string, error)
- func AddLoadbalancerNetpolicy(svc *runtime.ServiceRuntime, comp InfoGetter) error
- func AddPDBSettings[T client.Object](_ context.Context, obj T, svc *runtime.ServiceRuntime) *fnproto.Result
- func AddSaWithRole(ctx context.Context, svc *runtime.ServiceRuntime, policies []rbacv1.PolicyRule, ...) error
- func AddUserAlerting[T client.Object](ctx context.Context, obj T, svc *runtime.ServiceRuntime) *fnproto.Result
- func BootstrapInstanceNs(ctx context.Context, comp Composite, serviceName, namespaceResName string, ...) error
- func CreateBillingRecord(ctx context.Context, svc *runtime.ServiceRuntime, comp InfoGetter, ...) *xfnproto.Result
- func CreateIngresses(comp InfoGetter, svc *runtime.ServiceRuntime, ingresses []*netv1.Ingress, ...) error
- func CreateNetworkPolicy(comp Composite, svc *runtime.ServiceRuntime) error
- func CreateOrUpdateBillingService(ctx context.Context, svc *runtime.ServiceRuntime, comp InfoGetter) *xfnproto.Result
- func CreateOrUpdateBillingServiceWithOptions(ctx context.Context, svc *runtime.ServiceRuntime, comp InfoGetter, ...) *xfnproto.Result
- func CreateTLSCerts(ctx context.Context, ns string, serviceName string, ...) (string, error)
- func CustomCreateNetworkPolicy(sourceNS []string, instanceNs, name, kubeName string, allowAll bool, ...) error
- func DisableBilling(instanceNamespace string, svc *runtime.ServiceRuntime) error
- func GenerateBundledIngresses(comp InfoGetter, svc *runtime.ServiceRuntime, ingressConfig IngressConfig) ([]*netv1.Ingress, error)
- func GenerateIngress(comp InfoGetter, svc *runtime.ServiceRuntime, ingressConfig IngressConfig) (*netv1.Ingress, error)
- func GetBitnamiNano() map[string]any
- func GetDesiredReleaseValues(svc *runtime.ServiceRuntime, releaseName string) (map[string]interface{}, error)
- func GetItemDescription(isAPPUiOCloud bool, cluster, namespace string) string
- func GetObservedReleaseValues(svc *runtime.ServiceRuntime, releaseName string) (map[string]interface{}, error)
- func GetOrg(instance string, svc *runtime.ServiceRuntime) (string, error)
- func GetReleaseValues(r *xhelmv1.Release) (map[string]interface{}, error)
- func IsSingleSubdomainOfRefDomain(fqdn string, reference string) bool
- func MailgunAlerting[T client.Object](ctx context.Context, obj T, svc *runtime.ServiceRuntime) *xfnproto.Result
- func MergeSidecarsIntoValues(values map[string]any, sidecars *utils.Sidecars)
- func NewRelease(ctx context.Context, svc *runtime.ServiceRuntime, comp InfoGetter, ...) (*xhelmv1.Release, error)
- func SetNestedObjectValue(values map[string]interface{}, path []string, val interface{}) error
- func SetRandomBackupSchedule(backup BackupScheduler, maintenanceTime *time.Time)
- func SetRandomMaintenanceSchedule(maintenance MaintenanceScheduler) time.Time
- func SetSELinuxSecurityContextDeployment(depl *appsv1.Deployment, comp InfoGetter, svc *runtime.ServiceRuntime) error
- func SetSELinuxSecurityContextStatefulset(sts *appsv1.StatefulSet, comp InfoGetter, svc *runtime.ServiceRuntime) error
- type Alerter
- type AllowedNamespaceGetter
- type BackupEnabledChecker
- type BackupScheduler
- type BillingServiceOptions
- type CertOptions
- type Composite
- type CredentialSecretOption
- type InfoGetter
- type IngressConfig
- type IngressRuleConfig
- type InstanceNamespaceGetter
- type InstanceNamespaceInfo
- type IssuerOption
- type MaintenanceScheduler
- type PostgreSQLDependencyBuilder
- func (a *PostgreSQLDependencyBuilder) AddPGBouncerConfig(pgBouncerConfig map[string]string) *PostgreSQLDependencyBuilder
- func (a *PostgreSQLDependencyBuilder) AddPGSettings(pgSettings map[string]string) *PostgreSQLDependencyBuilder
- func (a *PostgreSQLDependencyBuilder) AddParameters(psqlParams *vshnv1.VSHNPostgreSQLParameters) *PostgreSQLDependencyBuilder
- func (a *PostgreSQLDependencyBuilder) AddRestore(restore *vshnv1.VSHNPostgreSQLRestore, kind string) *PostgreSQLDependencyBuilder
- func (a *PostgreSQLDependencyBuilder) CreateDependency() (string, error)
- func (a *PostgreSQLDependencyBuilder) SetCustomMaintenanceSchedule(timeOfDayMaintenance vshnv1.TimeOfDay) *PostgreSQLDependencyBuilder
- func (a *PostgreSQLDependencyBuilder) SetDiskSize(size string) *PostgreSQLDependencyBuilder
- type Resources
- type ServiceAddOns
- type TLSOptions
Constants ¶
const ( // BillingNamespace is the namespace where BillingService CRs are created BillingNamespace = "syn-appcat" // DefaultKeepAfterDeletion is the default number of days to keep billing records after deletion // it is overwritten by the component value appcat.billing.customResourceDeletionAfter DefaultKeepAfterDeletion = 365 )
const ( AllowDeletion bool = true DisallowDeletion bool = false )
const ( PgInstanceNameSuffix = "-pg" PgSecretName = "pg-creds" )
Variables ¶
This section is empty.
Functions ¶
func AddCredentialsSecret ¶ added in v4.46.0
func AddCredentialsSecret(comp InfoGetter, svc *runtime.ServiceRuntime, fieldList []string, allowDeletion bool, opts ...CredentialSecretOption) (string, error)
AddCredentialsSecret creates secrets and passwords for use with helm based services. This is to avoid issues with re-generating passwords if helm internal password generators are used. The function accepts a list of fields that should be populated with passwords. It returns the name of the secret resource, so it can be referenced later. The name of the inner secret object is the same as the resource name. Additionally it exposes the generated passwords as connection details, for easier retrieval.
func AddGenericSecret ¶ added in v4.73.0
func AddGenericSecret(comp InfoGetter, svc *runtime.ServiceRuntime, suffix string, fieldList []string, allowDeletion bool, opts ...CredentialSecretOption) (string, error)
AddGenericSecret generates passwords the same way AddCredentialsSecret does. With the difference that the resource name can be chosen. This is helpful if multiple different random generated passwords are necessary.
func AddLoadbalancerNetpolicy ¶ added in v4.122.0
func AddLoadbalancerNetpolicy(svc *runtime.ServiceRuntime, comp InfoGetter) error
AddLoadbalancerNetpolicy will allow all traffic to the namespace, so that the loabalancer connection works as well.
func AddPDBSettings ¶ added in v4.86.0
func AddSaWithRole ¶
func AddSaWithRole(ctx context.Context, svc *runtime.ServiceRuntime, policies []rbacv1.PolicyRule, compName, namespace, suffix string, withDeletionProtectionDisabled bool) error
AddSaWithRole creates a service account with the given policy and binds it to the role. withDeletionProtectionDisabled will add a label to the sa, role and rolbinding's Object to allow deletion.
func AddUserAlerting ¶ added in v4.42.0
func AddUserAlerting[T client.Object](ctx context.Context, obj T, svc *runtime.ServiceRuntime) *fnproto.Result
AddUserAlerting adds user alerting to the Redis instance.
func BootstrapInstanceNs ¶ added in v4.45.0
func CreateBillingRecord ¶ added in v4.99.0
func CreateBillingRecord(ctx context.Context, svc *runtime.ServiceRuntime, comp InfoGetter, addOns ...ServiceAddOns) *xfnproto.Result
CreateBillingRecord creates a new prometheus rule per each instance namespace The rule is skipped for any secondary service such as postgresql instance for nextcloud The skipping is based on whether label appuio.io/billing-name is set or not on instance namespace
func CreateIngresses ¶ added in v4.127.0
func CreateIngresses(comp InfoGetter, svc *runtime.ServiceRuntime, ingresses []*netv1.Ingress, opts ...runtime.KubeObjectOption) error
Apply generated ingresses using svc.SetDesiredKubeObject()
func CreateNetworkPolicy ¶ added in v4.44.0
func CreateNetworkPolicy(comp Composite, svc *runtime.ServiceRuntime) error
CreateNetworkPolicy creates network policy in the instance namespace to allow other namespaces access to the service
func CreateOrUpdateBillingService ¶ added in v4.172.0
func CreateOrUpdateBillingService(ctx context.Context, svc *runtime.ServiceRuntime, comp InfoGetter) *xfnproto.Result
CreateOrUpdateBillingService creates or updates a BillingService CR for the given service instance. The salesOrder is populated from the composition for APPUiO Managed The Organisation is populated from claim namespace for APPUiO Cloud The productID is constructed as: appcat-vshn-{service}-{sla}
func CreateOrUpdateBillingServiceWithOptions ¶ added in v4.172.0
func CreateOrUpdateBillingServiceWithOptions(ctx context.Context, svc *runtime.ServiceRuntime, comp InfoGetter, opts BillingServiceOptions) *xfnproto.Result
CreateOrUpdateBillingServiceWithOptions creates or updates a BillingService CR with custom options used for AddOns
func CreateTLSCerts ¶ added in v4.102.0
func CreateTLSCerts(ctx context.Context, ns string, serviceName string, svc *runtime.ServiceRuntime, opts *TLSOptions) (string, error)
CreateTLSCerts creates ssl/tls certificates. Servicename will be concatenated with the given namespace to generate a proper k8s fqdn. In addition to an error it also returns the name of the secret containing the server certifcates.
func CustomCreateNetworkPolicy ¶ added in v4.69.0
func CustomCreateNetworkPolicy(sourceNS []string, instanceNs, name, kubeName string, allowAll bool, svc *runtime.ServiceRuntime) error
CustomCreateNetworkPolicy creates a more flexible network policy Use this method when, for instance, a service needs a sub-service with more refined network policy access `sourceNS` - are the namespaces from where the access is allowed `instanceNs` - is the namespace where the network policy is created and to where the `sourceNS` will have access `name` - the name of the network policy `kubeName` -the kube name that this network policy should be encapsulated. If not given "<composite.name>-netpol" is used `allowAll` - will override the `sourceNS` parameter and will allow all namespace to access `instanceNs` service
func DisableBilling ¶ added in v4.60.0
func DisableBilling(instanceNamespace string, svc *runtime.ServiceRuntime) error
DisableBilling deploys a special config map to the appcat control namespace. This configMap contains a key that specifies if a given namespace should be billed or not. The configMap can also be used for other configurations in the future.
func GenerateBundledIngresses ¶ added in v4.127.0
func GenerateBundledIngresses(comp InfoGetter, svc *runtime.ServiceRuntime, ingressConfig IngressConfig) ([]*netv1.Ingress, error)
Generate up to 2 ingresses that bundle FQDNs depending on the following: FQDNs that are one subdomain ON defaultAppsDomain (e.g. sub1.apps.cluster.com) -> Empty TLS config (uses wildcard cert on OCP). FQDNs that do not statisfy the former -> TLS config using a Let's Encrypt certificate.
func GenerateIngress ¶ added in v4.127.0
func GenerateIngress(comp InfoGetter, svc *runtime.ServiceRuntime, ingressConfig IngressConfig) (*netv1.Ingress, error)
Generate an ingress containing a single FQDN using a TLS config as such: FQDN is one subdomain ON defaultAppsDomain (e.g. sub1.apps.cluster.com) -> Empty TLS config (uses wildcard cert on OCP). FQDN does not statisfy the former -> TLS config using a Let's Encrypt certificate.
func GetBitnamiNano ¶ added in v4.102.0
GetBitnamiNano returns a "nano" bitnami resource termplate, but without the ephemeral storage. See for more details: https://github.com/bitnami/charts/blob/main/bitnami/common/templates/_resources.tpl#L15
func GetDesiredReleaseValues ¶ added in v4.61.0
func GetDesiredReleaseValues(svc *runtime.ServiceRuntime, releaseName string) (map[string]interface{}, error)
GetDesiredReleaseValues returns the desired releaseValues for the given release name.
func GetItemDescription ¶ added in v4.172.0
GetItemDescription returns item description with cluster and namespace name
func GetObservedReleaseValues ¶ added in v4.53.0
func GetObservedReleaseValues(svc *runtime.ServiceRuntime, releaseName string) (map[string]interface{}, error)
GetObservedReleaseValues returns the observed releaseValues for the given release name.
func GetOrg ¶ added in v4.44.2
func GetOrg(instance string, svc *runtime.ServiceRuntime) (string, error)
func GetReleaseValues ¶ added in v4.49.0
GetReleaseValues returns the parsed values from the given release.
func IsSingleSubdomainOfRefDomain ¶ added in v4.127.0
Checks if an FQDN is part of a reference FQDN, e.g. an OpenShift Apps domain; "*nextcloud*.apps.cluster.com". Returns true if yes and FQDN is not a 2nd level subdomain (i.e. *sub2.sub1*.apps.cluster.com)
func MailgunAlerting ¶ added in v4.42.0
func MergeSidecarsIntoValues ¶ added in v4.166.0
func NewRelease ¶ added in v4.53.0
func NewRelease(ctx context.Context, svc *runtime.ServiceRuntime, comp InfoGetter, values map[string]any, resName string, cd ...xhelmv1.ConnectionDetail) (*xhelmv1.Release, error)
NewRelease returns a new release with some defaults set.
func SetNestedObjectValue ¶ added in v4.65.0
SetNestedObjectValue is necessary as unstructured can't handle anything except basic values and maps. this is a recursive function, it will traverse the map until it reaches the last element of the path. If it encounters any non-map values while traversing, it will throw an error.
func SetRandomBackupSchedule ¶ added in v4.170.0
func SetRandomBackupSchedule(backup BackupScheduler, maintenanceTime *time.Time)
SetRandomBackupSchedule sets a random backup schedule if not already set and backups are enabled. The backup schedule will be set to once a day, one hour before the provided maintenance time. If no maintenance time is provided, it will be set to a random time between 20:00 and 4:00.
func SetRandomMaintenanceSchedule ¶ added in v4.170.0
func SetRandomMaintenanceSchedule(maintenance MaintenanceScheduler) time.Time
SetRandomMaintenanceSchedule sets a random maintenance schedule if not already set. The maintenance will be set to a random time on a random day (Sunday-Friday) between 21:00 and 5:00, with the exception that Sunday maintenance only runs after 21:00 (not in the early morning hours). Returns the maintenance time that was set or already existed.
func SetSELinuxSecurityContextDeployment ¶ added in v4.64.2
func SetSELinuxSecurityContextDeployment(depl *appsv1.Deployment, comp InfoGetter, svc *runtime.ServiceRuntime) error
func SetSELinuxSecurityContextStatefulset ¶ added in v4.64.2
func SetSELinuxSecurityContextStatefulset(sts *appsv1.StatefulSet, comp InfoGetter, svc *runtime.ServiceRuntime) error
Types ¶
type Alerter ¶ added in v4.42.0
type Alerter interface {
GetVSHNMonitoring() vshnv1.VSHNMonitoring
GetInstanceNamespace() string
}
Required to get info required for alerting.
type AllowedNamespaceGetter ¶ added in v4.69.0
type BackupEnabledChecker ¶ added in v4.170.0
type BackupEnabledChecker interface {
IsBackupEnabled() bool
}
BackupEnabledChecker can check if backups are enabled
type BackupScheduler ¶
type BackupScheduler interface {
GetBackupSchedule() string
SetBackupSchedule(string)
BackupEnabledChecker
}
BackupScheduler can schedule backups
type BillingServiceOptions ¶ added in v4.172.0
type BillingServiceOptions struct {
// ResourceNameSuffix is appended to comp.GetName() to form the resource name (e.g., "-billing-service", "-addon-collabora")
ResourceNameSuffix string
// ProductID overrides the auto-generated productID based on service type and sla
ProductID string
// Size overrides the replica count for billing purposes
Size string
// AdditionalLabels are added to the BillingService CR labels
AdditionalLabels map[string]string
}
BillingServiceOptions contains customization options for creating a BillingService CR
type CertOptions ¶ added in v4.134.0
type CertOptions func(*cmv1.Certificate)
type Composite ¶ added in v4.62.2
type Composite interface {
InfoGetter
client.Object
SetInstanceNamespaceStatus()
AllowedNamespaceGetter
}
Composite can get and set the relevant information on a given composite.
type CredentialSecretOption ¶ added in v4.79.0
type CredentialSecretOption func(obj *corev1.Secret, cd []xkube.ConnectionDetail) []xkube.ConnectionDetail
func AddStaticFieldToSecret ¶ added in v4.79.0
func AddStaticFieldToSecret(staticFields map[string]string) CredentialSecretOption
AddStaticFieldToSecret adds predefined staticFields into a secret. This is helpful if multiple you need to add a static username to a secret for example.
type InfoGetter ¶ added in v4.46.0
type InfoGetter interface {
GetBackupSchedule() string
GetBackupRetention() vshnv1.K8upRetentionPolicy
IsBackupEnabled() bool
GetServiceName() string
GetLabels() map[string]string
GetSize() vshnv1.VSHNSizeSpec
GetInstances() int
GetFullMaintenanceSchedule() vshnv1.VSHNDBaaSMaintenanceScheduleSpec
GetMonitoring() vshnv1.VSHNMonitoring
GetSecurity() *vshnv1.Security
InstanceNamespaceInfo
GetPDBLabels() map[string]string
GetWorkloadPodTemplateLabelsManager() vshnv1.PodTemplateLabelsManager
GetWorkloadName() string
GetClaimName() string
GetSLA() string
GetBillingName() string
}
InfoGetter will return various information about the given AppCat composite.
type IngressConfig ¶ added in v4.127.0
type IngressConfig struct {
AdditionalAnnotations map[string]string // Optional
AdditionalIngressNames []string // Optional
AdditionalLabels map[string]string // Optional
FQDNs []string
ServiceConfig IngressRuleConfig
TlsCertBaseName string
}
IngressConfig contains general information for generating an Ingress object
type IngressRuleConfig ¶ added in v4.127.0
type IngressRuleConfig struct {
RelPath string // Optional, defaults to "/"
ServiceNameSuffix string // Optional
ServicePortName string // Has preference over ServicePortNumber
ServicePortNumber int32
}
IngressRuleConfig describes an ingress rule configuration
type InstanceNamespaceGetter ¶ added in v4.117.0
type InstanceNamespaceGetter interface {
GetInstanceNamespace() string
}
InstanceNamespaceGetter returns the instance namespace of the given object
type InstanceNamespaceInfo ¶ added in v4.45.2
type InstanceNamespaceInfo interface {
InstanceNamespaceGetter
GetName() string
GetClaimNamespace() string
GetLabels() map[string]string
}
InstanceNamespaceInfo provides all the necessary information to create an instance namespace.
type IssuerOption ¶ added in v4.134.0
type MaintenanceScheduler ¶
type PostgreSQLDependencyBuilder ¶ added in v4.83.0
type PostgreSQLDependencyBuilder struct {
// contains filtered or unexported fields
}
func NewPostgreSQLDependencyBuilder ¶ added in v4.83.0
func NewPostgreSQLDependencyBuilder(svc *runtime.ServiceRuntime, comp InfoGetter) *PostgreSQLDependencyBuilder
func (*PostgreSQLDependencyBuilder) AddPGBouncerConfig ¶ added in v4.83.0
func (a *PostgreSQLDependencyBuilder) AddPGBouncerConfig(pgBouncerConfig map[string]string) *PostgreSQLDependencyBuilder
func (*PostgreSQLDependencyBuilder) AddPGSettings ¶ added in v4.148.0
func (a *PostgreSQLDependencyBuilder) AddPGSettings(pgSettings map[string]string) *PostgreSQLDependencyBuilder
func (*PostgreSQLDependencyBuilder) AddParameters ¶ added in v4.83.0
func (a *PostgreSQLDependencyBuilder) AddParameters(psqlParams *vshnv1.VSHNPostgreSQLParameters) *PostgreSQLDependencyBuilder
func (*PostgreSQLDependencyBuilder) AddRestore ¶ added in v4.163.0
func (a *PostgreSQLDependencyBuilder) AddRestore(restore *vshnv1.VSHNPostgreSQLRestore, kind string) *PostgreSQLDependencyBuilder
func (*PostgreSQLDependencyBuilder) CreateDependency ¶ added in v4.83.0
func (a *PostgreSQLDependencyBuilder) CreateDependency() (string, error)
CreateDependency applies the postgresql instance to the desired state. It returns the name of the secret that will contain the connection details.
func (*PostgreSQLDependencyBuilder) SetCustomMaintenanceSchedule ¶ added in v4.83.0
func (a *PostgreSQLDependencyBuilder) SetCustomMaintenanceSchedule(timeOfDayMaintenance vshnv1.TimeOfDay) *PostgreSQLDependencyBuilder
func (*PostgreSQLDependencyBuilder) SetDiskSize ¶ added in v4.148.0
func (a *PostgreSQLDependencyBuilder) SetDiskSize(size string) *PostgreSQLDependencyBuilder
type Resources ¶ added in v4.53.0
type Resources struct {
ReqMem resource.Quantity
ReqCPU resource.Quantity
Mem resource.Quantity
CPU resource.Quantity
Disk resource.Quantity
}
func GetResources ¶ added in v4.44.0
GetResources will return a `Resources` object with the correctly calculated requests, limits and disk space according to the definitions in the plan as well as the overrides in the claim.
type ServiceAddOns ¶ added in v4.115.0
ServiceAddOns describes an addOn for a services with necessary data for billing
type TLSOptions ¶ added in v4.134.0
type TLSOptions struct {
// AdditionalSans is a list of additional SANs that should get added to the
// certificate
AdditionalSans []string
// AdditionalOutputFormats is a list of additional output formats for the issued
// certificate
AdditionalOutputFormats []cmv1.CertificateAdditionalOutputFormat
// IssuerOptions is a list of additional functions that manipulate the Issuer resource
IssuerOptions []IssuerOption
// CertOptions is a list of additional functions that manipulate the Certificate resource
CertOptions []CertOptions
//KubeOptions is a list of KubecObjectOptions that will be passed to the SetDesiredKubeObject function
KubeOptions []runtime.KubeObjectOption
}
TLSOptions let's you pass advanced configurations to the underlying objects.