9da206dc7c
PVCs and CloudNativePG Clusters need S3 buckets and backup schedules
provisioned consistently. This operator watches the
backups.unkin.net/{schedule,destination} annotations on those objects and
provisions everything needed to back them up, with no new CRDs.
- Add a PVC controller that provisions cephrgw ObjectStoreUser/Bucket/BucketAccess,
auto-generates a restic repo-password Secret and creates a k8up Schedule scoped
to the PVC via spec.backup.volumes[].persistentVolumeClaim.claimName.
- Add a CNPG Cluster controller that provisions the same bucket stack, idempotently
patches spec.backup.barmanObjectStore (leaving a user-set destinationPath alone
with a Warning event) and creates a ScheduledBackup.
- Resolve destinations through a ConfigMap lookup table; requeue until the
BucketAccess is Ready before creating schedule resources; own-reference created
resources and retain bucket data by default.
- Add schedule-mapping helpers (k8up 5-field/shortcut pass-through, CNPG 6-field
seconds-first) and deterministic, length-bounded name derivation.
- Add unit tests (schedule mapping, name derivation, destination resolution) and
envtest controller tests for both paths, wiring the external CRDs into envtest.
- Add kubebuilder-generated RBAC, a Dockerfile (distroless/nonroot), Woodpecker
lint/test/build pipelines and a tag-triggered image push to the artifactapi
docker-internal registry, plus a version-bump Makefile and deploy manifests.
77 lines
2.6 KiB
Go
77 lines
2.6 KiB
Go
package reflect2
|
|
|
|
import "unsafe"
|
|
|
|
//go:linkname unsafe_New reflect.unsafe_New
|
|
func unsafe_New(rtype unsafe.Pointer) unsafe.Pointer
|
|
|
|
//go:linkname typedmemmove reflect.typedmemmove
|
|
func typedmemmove(rtype unsafe.Pointer, dst, src unsafe.Pointer)
|
|
|
|
//go:linkname unsafe_NewArray reflect.unsafe_NewArray
|
|
func unsafe_NewArray(rtype unsafe.Pointer, length int) unsafe.Pointer
|
|
|
|
// typedslicecopy copies a slice of elemType values from src to dst,
|
|
// returning the number of elements copied.
|
|
//go:linkname typedslicecopy reflect.typedslicecopy
|
|
//go:noescape
|
|
func typedslicecopy(elemType unsafe.Pointer, dst, src sliceHeader) int
|
|
|
|
//go:linkname mapassign reflect.mapassign
|
|
//go:noescape
|
|
func mapassign(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer, val unsafe.Pointer)
|
|
|
|
//go:linkname mapaccess reflect.mapaccess
|
|
//go:noescape
|
|
func mapaccess(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer) (val unsafe.Pointer)
|
|
|
|
//go:noescape
|
|
//go:linkname mapiternext reflect.mapiternext
|
|
func mapiternext(it *hiter)
|
|
|
|
//go:linkname ifaceE2I reflect.ifaceE2I
|
|
func ifaceE2I(rtype unsafe.Pointer, src interface{}, dst unsafe.Pointer)
|
|
|
|
// A hash iteration structure.
|
|
// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate
|
|
// the layout of this structure.
|
|
type hiter struct {
|
|
key unsafe.Pointer
|
|
value unsafe.Pointer
|
|
t unsafe.Pointer
|
|
h unsafe.Pointer
|
|
buckets unsafe.Pointer
|
|
bptr unsafe.Pointer
|
|
overflow *[]unsafe.Pointer
|
|
oldoverflow *[]unsafe.Pointer
|
|
startBucket uintptr
|
|
offset uint8
|
|
wrapped bool
|
|
B uint8
|
|
i uint8
|
|
bucket uintptr
|
|
checkBucket uintptr
|
|
}
|
|
|
|
// add returns p+x.
|
|
//
|
|
// The whySafe string is ignored, so that the function still inlines
|
|
// as efficiently as p+x, but all call sites should use the string to
|
|
// record why the addition is safe, which is to say why the addition
|
|
// does not cause x to advance to the very end of p's allocation
|
|
// and therefore point incorrectly at the next block in memory.
|
|
func add(p unsafe.Pointer, x uintptr, whySafe string) unsafe.Pointer {
|
|
return unsafe.Pointer(uintptr(p) + x)
|
|
}
|
|
|
|
// arrayAt returns the i-th element of p,
|
|
// an array whose elements are eltSize bytes wide.
|
|
// The array pointed at by p must have at least i+1 elements:
|
|
// it is invalid (but impossible to check here) to pass i >= len,
|
|
// because then the result will point outside the array.
|
|
// whySafe must explain why i < len. (Passing "i < len" is fine;
|
|
// the benefit is to surface this assumption at the call site.)
|
|
func arrayAt(p unsafe.Pointer, i int, eltSize uintptr, whySafe string) unsafe.Pointer {
|
|
return add(p, uintptr(i)*eltSize, "i < len")
|
|
}
|