Documentation
¶
Index ¶
- Variables
- func CreateExpectedConfigMap(ab *atroxyzv1alpha1.AppBundle) (*corev1.ConfigMap, error)
- func CreateExpectedDeployment(ab *atroxyzv1alpha1.AppBundle) (*appsv1.Deployment, error)
- func CreateExpectedExternalSecret(ab *atroxyzv1alpha1.AppBundle) (*extsec.ExternalSecret, error)
- func CreateExpectedIngress(ab *atroxyzv1alpha1.AppBundle, name string, ...) (*netv1.Ingress, error)
- func CreateExpectedPVC(ab *atroxyzv1alpha1.AppBundle, volume *atroxyzv1alpha1.AppBundleVolume, ...) (*corev1.PersistentVolumeClaim, error)
- func CreateExpectedService(ab *atroxyzv1alpha1.AppBundle, generatedSpecData *GeneratedServiceSpecData) (*corev1.Service, error)
- func FormulateDiffMessageForLabels(oldObjLabels, newObjLabels interface{}) (string, error)
- func FormulateDiffMessageForSpecs(oldObjSpec, newObjSpec interface{}) (string, error)
- func GetAppBundleNamespacedName(ab *atroxyzv1alpha1.AppBundle) types.NamespacedName
- func GetAppBundleObjectMetaWithOwnerReference(app_bundle *atroxyzv1alpha1.AppBundle) metav1.ObjectMeta
- func GetDiffPaths(oldObj, newObj interface{}) (string, error)
- func GetHomePageAnnotations(annotations map[string]string, ab *atroxyzv1alpha1.AppBundle) map[string]string
- func GetObjectMetaForIngress(app_bundle *atroxyzv1alpha1.AppBundle) metav1.ObjectMeta
- func GetPVCLabels(ab *atroxyzv1alpha1.AppBundle, volume *atroxyzv1alpha1.AppBundleVolume, ...) map[string]string
- func IsDefault[T any](value T) bool
- func MergeIntoServiceSpec(service *corev1.Service, data *GeneratedServiceSpecData)
- func RegisterStateIfNotAlreadyRegistered(app types.AppId) error
- func ResolveAppBundleBase(ctx context.Context, r *AppBundleReconciler, ab *atroxyzv1alpha1.AppBundle, ...) error
- func ReturnFirstNonDefault[T any](elem ...T) T
- func RunReconciles(ctx context.Context, app_bundle *atroxyzv1alpha1.AppBundle, ...) error
- func SetDefault[T any](value *T)
- func SetDefaultAppBundleLabels(ab *atroxyzv1alpha1.AppBundle, labels map[string]string) map[string]string
- func ShouldRecreateResource(err error) bool
- func StateNeedsUpdating(app types.AppId, alreadyRegistered bool) (bool, error)
- func StringMapsMatch(map1, map2 map[string]string) bool
- func UpdateState(app types.AppId) error
- func UpsertResource(ctx context.Context, r ReaderWriter, newObj client.Object, reason string, ...) error
- type AppBundleBaseReconciler
- type AppBundleBaseState
- type AppBundleIdentifier
- type AppBundleReconciler
- func (r *AppBundleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *AppBundleReconciler) ReconcileConfigMap(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
- func (r *AppBundleReconciler) ReconcileDeployment(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
- func (r *AppBundleReconciler) ReconcileExistingPVC(ctx context.Context, ab *atroxyzv1alpha1.AppBundle, ...) error
- func (r *AppBundleReconciler) ReconcileExternalSecret(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
- func (r *AppBundleReconciler) ReconcileIngress(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
- func (r *AppBundleReconciler) ReconcilePVC(ctx context.Context, ab *atroxyzv1alpha1.AppBundle, ...) error
- func (r *AppBundleReconciler) ReconcileRecurringBackupJob(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
- func (r *AppBundleReconciler) ReconcileService(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
- func (r *AppBundleReconciler) ReconcileVolumes(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
- func (r *AppBundleReconciler) SetupWithManager(mgr ctrl.Manager) error
- type AppBundleState
- type GeneratedServiceSpecData
- type ReaderWriter
- type ResourceMutexes
- type StateAlreadyRegisteredError
- type StateNotRegisteredError
Constants ¶
This section is empty.
Variables ¶
var ( State = make(map[string]*AppBundleState) StateMutex = &sync.Mutex{} )
var AppBundleSelector = "appbundle"
Functions ¶
func CreateExpectedConfigMap ¶
func CreateExpectedConfigMap(ab *atroxyzv1alpha1.AppBundle) (*corev1.ConfigMap, error)
CreateExpectedConfigMap creates the expected config mapfrom the appbundle
func CreateExpectedDeployment ¶
func CreateExpectedDeployment(ab *atroxyzv1alpha1.AppBundle) (*appsv1.Deployment, error)
CreateExpectedDeployment creates expected deployment from appbundle
func CreateExpectedExternalSecret ¶
func CreateExpectedExternalSecret(ab *atroxyzv1alpha1.AppBundle) (*extsec.ExternalSecret, error)
CreateExpectedExternalSecret creates the expected external secret from the appbundle or returns nil if no secret is needed
func CreateExpectedIngress ¶
func CreateExpectedIngress(ab *atroxyzv1alpha1.AppBundle, name string, route *atroxyzv1alpha1.AppBundleRoute) (*netv1.Ingress, error)
CreateExpectedIngress creates the expected ingress from the appbundle and the name given
func CreateExpectedPVC ¶
func CreateExpectedPVC(ab *atroxyzv1alpha1.AppBundle, volume *atroxyzv1alpha1.AppBundleVolume, volumeName string) (*corev1.PersistentVolumeClaim, error)
CreateExpectedPVC creates the expected PVC in order to be compared to an already existing PVC if one exists, reconcille if doesn't.
func CreateExpectedService ¶
func CreateExpectedService(ab *atroxyzv1alpha1.AppBundle, generatedSpecData *GeneratedServiceSpecData) (*corev1.Service, error)
CreateExpectedService creates the expected service from the appbundle
func GetAppBundleNamespacedName ¶
func GetAppBundleNamespacedName(ab *atroxyzv1alpha1.AppBundle) types.NamespacedName
func GetAppBundleObjectMetaWithOwnerReference ¶
func GetAppBundleObjectMetaWithOwnerReference(app_bundle *atroxyzv1alpha1.AppBundle) metav1.ObjectMeta
func GetDiffPaths ¶
func GetHomePageAnnotations ¶
func GetObjectMetaForIngress ¶
func GetObjectMetaForIngress(app_bundle *atroxyzv1alpha1.AppBundle) metav1.ObjectMeta
func GetPVCLabels ¶
func GetPVCLabels(ab *atroxyzv1alpha1.AppBundle, volume *atroxyzv1alpha1.AppBundleVolume, pvc *corev1.PersistentVolumeClaim) map[string]string
func MergeIntoServiceSpec ¶
func MergeIntoServiceSpec(service *corev1.Service, data *GeneratedServiceSpecData)
func RegisterStateIfNotAlreadyRegistered ¶
GetState returns the state of an appbundle object from the cache. Returns bool if the state was initialized and error if any.
func ResolveAppBundleBase ¶
func ResolveAppBundleBase(ctx context.Context, r *AppBundleReconciler, ab *atroxyzv1alpha1.AppBundle, abb *atroxyzv1alpha1.AppBundleBase) error
ResolveAppBundleBase resolves the base of an app bundle
func ReturnFirstNonDefault ¶
func ReturnFirstNonDefault[T any](elem ...T) T
ReturnFirstNonNil returns the first non-nil element in a list of pointers
func RunReconciles ¶
func RunReconciles( ctx context.Context, app_bundle *atroxyzv1alpha1.AppBundle, reconciles ...func(context.Context, *atroxyzv1alpha1.AppBundle) error, ) error
RunReconciles takes in a list of reconcile functions, passes argument into each one and runs concurrently.
func SetDefault ¶
func SetDefault[T any](value *T)
func SetDefaultAppBundleLabels ¶
func SetDefaultAppBundleLabels(ab *atroxyzv1alpha1.AppBundle, labels map[string]string) map[string]string
SetDefaultAppBundleLabels attaches default labels to a derivative object of an app bundle
func ShouldRecreateResource ¶
ShouldRecreateResource checks for a specific error message that indicates a resource should be recreated because the field is immutable and updating is not possible.
func StateNeedsUpdating ¶
func StringMapsMatch ¶
func UpdateState ¶
Types ¶
type AppBundleBaseReconciler ¶
AppBundleBaseReconciler reconciles a AppBundleBase object
func (*AppBundleBaseReconciler) Reconcile ¶
func (r *AppBundleBaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the AppBundleBase object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.3/pkg/reconcile
func (*AppBundleBaseReconciler) SetupWithManager ¶
func (r *AppBundleBaseReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type AppBundleBaseState ¶
type AppBundleBaseState struct { SpecHash string LastReconciliation time.Time NextBackoffInSec int16 }
AppBundleBaseState is the in-memory cached state of an appbundlebase object.
type AppBundleIdentifier ¶
type AppBundleIdentifier string // Identifier for the app bundle
type AppBundleReconciler ¶
AppBundleReconciler reconciles a AppBundle object
func (*AppBundleReconciler) Reconcile ¶
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.0/pkg/reconcile
func (*AppBundleReconciler) ReconcileConfigMap ¶
func (r *AppBundleReconciler) ReconcileConfigMap(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
ReconcileConfigMap the config map for the appbundle
func (*AppBundleReconciler) ReconcileDeployment ¶
func (r *AppBundleReconciler) ReconcileDeployment(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
ReconcileDeployment checks currently existing deployment with the expected deployment and updates it if necessary. If no deployment exists, it creates one.
func (*AppBundleReconciler) ReconcileExistingPVC ¶
func (r *AppBundleReconciler) ReconcileExistingPVC(ctx context.Context, ab *atroxyzv1alpha1.AppBundle, volume *atroxyzv1alpha1.AppBundleVolume) error
func (*AppBundleReconciler) ReconcileExternalSecret ¶
func (r *AppBundleReconciler) ReconcileExternalSecret(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
ReconcileExternalSecret reconciles the service for the appbundle
func (*AppBundleReconciler) ReconcileIngress ¶
func (r *AppBundleReconciler) ReconcileIngress(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
func (*AppBundleReconciler) ReconcilePVC ¶
func (r *AppBundleReconciler) ReconcilePVC(ctx context.Context, ab *atroxyzv1alpha1.AppBundle, volume *atroxyzv1alpha1.AppBundleVolume, volumeName string) error
ReconcilePVC compares currently existing PVC (if one exists) with what is the expected PVC and upserts if they differ.
func (*AppBundleReconciler) ReconcileRecurringBackupJob ¶
func (r *AppBundleReconciler) ReconcileRecurringBackupJob(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
func (*AppBundleReconciler) ReconcileService ¶
func (r *AppBundleReconciler) ReconcileService(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
ReconcileService reconciles the service for the appbundle
func (*AppBundleReconciler) ReconcileVolumes ¶
func (r *AppBundleReconciler) ReconcileVolumes(ctx context.Context, ab *atroxyzv1alpha1.AppBundle) error
ReconcileVolumes is a generic function that takes in a volume, checks if its a hostPath, emptyDir or a PVC. If hostPath or a emptyDir it just returns, if a PVC it reconciles it using ReconcilePVC function. If backup is requested it is also reconciled using ReconcileBackup function.
func (*AppBundleReconciler) SetupWithManager ¶
func (r *AppBundleReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type AppBundleState ¶
AppBundleState is the in-memory cached state of an appbundle object.
type GeneratedServiceSpecData ¶
type GeneratedServiceSpecData struct { SessionAffinity corev1.ServiceAffinity IPFamilies []corev1.IPFamily IPFamilyPolicy *corev1.IPFamilyPolicy InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicy // contains filtered or unexported fields }
GeneratedServiceSpecData is data that is generated by k8s API and hence cannot be "expected" as such is passed into expected function.
func GetGeneratedServiceSpecData ¶
func GetGeneratedServiceSpecData(svc *corev1.Service) *GeneratedServiceSpecData
type ResourceMutexes ¶
type StateAlreadyRegisteredError ¶
type StateAlreadyRegisteredError struct {
// contains filtered or unexported fields
}
func (StateAlreadyRegisteredError) Error ¶
func (e StateAlreadyRegisteredError) Error() string
type StateNotRegisteredError ¶
type StateNotRegisteredError struct {
// contains filtered or unexported fields
}
func (StateNotRegisteredError) Error ¶
func (e StateNotRegisteredError) Error() string