Repository navigation
Releases
v0.3.1
Release v0.3.1 - function-deletion-protection
Overview
This is a maintenance release. It contains no functional changes to the
function: dependency updates, CI pin refreshes, and documentation
corrections only.
The one code change is an import path update required by Crossplane
v2.4.x, which moved its API types into a separate Go module. Behavior is
identical to v0.3.0.
Dependency Updates
Crossplane API module split (#58)
Crossplane v2.4.x moved its API types out of the main module into a
separate github.com/crossplane/crossplane/apis/v2 module, so
crossplane/v2@v2.4.2 no longer provides apis/apiextensions/v1beta1
or apis/protection/v1beta1.
The imports in fn.go now point at the new module, and the unused
github.com/crossplane/crossplane/v2 requirement was dropped:
// Before
apiextensionsv1beta1 "github.com/crossplane/crossplane/v2/apis/apiextensions/v1beta1"
protectionv1beta1 "github.com/crossplane/crossplane/v2/apis/protection/v1beta1"
// After
apiextensionsv1beta1 "github.com/crossplane/crossplane/apis/v2/apiextensions/v1beta1"
protectionv1beta1 "github.com/crossplane/crossplane/apis/v2/protection/v1beta1"function-sdk-go was bumped to v0.7.1 as part of the same change --
v0.6.2 still imported crossplane-runtime/v2/apis/common/v1, which was
removed in crossplane-runtime v2.4.2.
Go modules
- Added
github.com/crossplane/crossplane/apis/v2v2.4.2, replacing
github.com/crossplane/crossplane/v2v2.2.0 (#58) - Updated
github.com/crossplane/function-sdk-goto v0.7.1 (#58) - Updated
k8s.io/apimachineryto v0.37.1 (#60, #69) - Updated
sigs.k8s.io/controller-toolsto v0.22.0 (#61) - Updated
github.com/alecthomas/kongto v1.16.1 (#57) - Updated
google.golang.org/protobufto v1.36.12 (#56)
CI/CD Updates
- Updated runner image to
ubuntu-26.04(#68) - Updated
actions/checkoutto v7 (#55, #62) - Updated
actions/setup-goto v7 (#40, #53, #63) - Updated
negz/create-tagto v2 (#64) - Updated
docker/login-actionto v4.6.0 (#42, #43) - Refreshed pinned digests for
docker/build-push-action(#44, #65),
docker/setup-buildx-action(#51, #66),
docker/setup-qemu-action(#54, #67),
golangci/golangci-lint-action(#49),
actions/upload-artifact(#45, #71), and
actions/download-artifact(#70)
Documentation
README updated for annotations (#39)
The v0.3.0 release made annotations the default mechanism for enabling
deletion protection, but the README still described the label-based
approach throughout. It now documents annotations as the primary
mechanism, with labels noted as supported for backward compatibility.
This is a documentation fix only -- the behavior it describes shipped in
v0.3.0.
Installation
apiVersion: pkg.crossplane.io/v1
kind: Function
metadata:
name: crossplane-contrib-function-deletion-protection
spec:
package: xpkg.upbound.io/crossplane-contrib/function-deletion-protection:v0.3.1Compatibility
- Crossplane 2.x: Full support for all features including Operations
- Crossplane 1.x: Composition pipeline support available with v1 mode
- Breaking Changes: None -- fully backward compatible with v0.3.0
Files Requiring Updates
The following still reference older versions and should be bumped to
v0.3.1 before or alongside the release:
- README.md:77 - references
v0.3.0 - examples/composition/functions.yaml:12 - references
v0.3.0 - examples/operations/functions.yaml:12 - references
v0.3.0 - examples/operations/README.md:34 - references
v0.2.2, two releases behind
What's Changed
Full Changelog: v0.3.0...v0.3.1
v0.3.0
Release v0.3.0
Overview
This release adds support for annotations-based protection, the ability
to set custom reasons, replay deletion support, typed Usage generation,
updated examples for Crossplane v2, and multiple dependency updates.
Key Features
Annotations Support (#32)
The function now defaults to using annotations for enabling
deletion protection and other settings.
metadata:
annotations:
protection.fn.crossplane.io/block-deletion: "true"The protection.fn.crossplane.io/block-deletion label is still
supported for backwards compatibility. In the case of a conflict
between the annotation and label, the annotation will take
precedence.
All other settings like custom reasons and replay deletion
are only supported via annotations.
metadata:
labels:
protection.fn.crossplane.io/block-deletion: "true"Custom Reason Messages
You can now specify custom reason messages that appear in the Usage and deletion rejection messages using the protection.fn.crossplane.io/reason annotation:
metadata:
annotations:
protection.fn.crossplane.io/block-deletion: "true"
protection.fn.crossplane.io/reason: "in use by production workload - do not delete"Custom reasons help provide context-specific information about why a resource is protected, making it clearer to operators why deletion is blocked.
Replay Deletion
The function now supports the replayDeletion feature for Usages via the protection.fn.crossplane.io/replay-deletion annotation. When enabled, deletion attempts will be logged and tracked:
metadata:
annotations:
protection.fn.crossplane.io/block-deletion: "true"
protection.fn.crossplane.io/replay-deletion: "true"Replay deletion can speed up deletion of nested resources that
have been blocked by the Usage webhook. However, it will attempt
to delete a resource if the Usage is removed.
See comment 6140#issuecomment-2538629314. For
a discussion of possible downsides.
Typed Usage Generation (#35)
The function now uses Go types to generate Usage objects instead of unstructured data.
Before: Usage objects were created as map[string]any with manual field construction:
usage := map[string]any{
"apiVersion": ProtectionGroupVersion,
"kind": usageType,
"metadata": usageMeta,
"spec": map[string]any{
"of": map[string]any{
"apiVersion": u.GetAPIVersion(),
// ...
},
},
}In release v0.3.0, they are created as Go structs:
usage := protectionv1beta1.Usage{
ObjectMeta: v1.ObjectMeta{
Name: GenerateName(name, UsageNameSuffix),
Namespace: u.GetNamespace(),
},
Spec: protectionv1beta1.UsageSpec{
Of: protectionv1beta1.NamespacedResource{
APIVersion: u.GetAPIVersion(),
Kind: u.GetKind(),
ResourceRef: &protectionv1beta1.NamespacedResourceRef{
Name: u.GetName(),
},
},
Reason: &uo.Reason,
ReplayDeletion: &uo.ReplayDeletion,
},
}
return composed.From(&usage)Updated Examples for Crossplane v2 (#37)
All examples have been updated to align with Crossplane v2 APIs and conventions:
- Updated API versions from
v1beta1tov1for Function packages - Updated composition examples with v2-compatible resources
- Fixed indentation and package version references
- Updated example documentation to reflect v2 changes
Technical Improvements
Dependency Updates
- Updated
github.com/crossplane/function-sdk-goto v0.6.2 (#36, #22) - Updated
google.golang.org/protobufto v1.36.11 (#17) - Updated module dependencies (#34)
- Pin dependencies for reproducible builds (#33)
CI/CD Updates
- Updated
docker/build-push-actionto v7 (#30) - Updated
docker/setup-buildx-actionto v4 (#29) - Updated
docker/setup-qemu-actionto v4 (#28) - Updated
docker/login-actionto v4 (#27) - Updated
golangci/golangci-lint-actionto v9 (#26) - Updated
actions/checkoutto v6.0.2 (#16) - Updated GitHub artifact actions (#25)
Installation
Install via Crossplane package specification:
apiVersion: pkg.crossplane.io/v1
kind: Function
metadata:
name: crossplane-contrib-function-deletion-protection
spec:
package: xpkg.upbound.io/crossplane-contrib/function-deletion-protection:v0.3.0Compatibility
- Crossplane 2.x: Full support for all features including Operations
- Crossplane 1.x: Composition pipeline support available with v1 mode
- Breaking Changes: None - fully backward compatible with v0.2.x
What's Changed
Full Changelog: v0.2.0...v0.3.0
v0.2.2
v0.2.2 contains a fix that automatically marks usages as ready, thanks to a fix submitted by @fabioaraujopt.
The function can be installed using the following manifest:
apiVersion: pkg.crossplane.io/v1
kind: Function
metadata:
name: crossplane-contrib-function-deletion-protection
spec:
package: xpkg.upbound.io/crossplane-contrib/function-deletion-protection:v0.2.2What's Changed
- fix: mark generated usages as ready in function output by @fabioaraujopt in #12
- update to version v0.2.2 by @stevendborrelli in #14
- Backport fixes to release-0.2 branch by @stevendborrelli in #15
New Contributors
- @haarchri made their first contribution in #11
- @fabioaraujopt made their first contribution in #12
Full Changelog: v0.2.1...v0.2.2
v0.2.1
v0.2.1 includes new checks that will raise an error if a Namespace-scoped resource has protection enabled when enableV1Mode is true.
What's Changed
- update for v0.2.0 by @stevendborrelli in #3
- add checks for v1 usages and namespaced resources by @stevendborrelli in #2
- Sync to release-0.2 by @stevendborrelli in #4
- Update version to v0.2.1 by @stevendborrelli in #5
Full Changelog: v0.2.0...v0.2.1
v0.2.0
Release v0.2.0 - function-deletion-protection
Overview
This release introduces major functionality enabling Crossplane Operations support, allowing protection of any Kubernetes resource beyond composed resources in pipelines, plus code quality enhancements and improved documentation.
This is the first release out of the Crossplane-contrib GitHub org via https://github.com/crossplane-contrib/function-deletion-protection and published to the Upbound Marketplace.
Key Features
Operations Support
The function now integrates with WatchOperation to protect arbitrary Kubernetes resources. When resources matching watch conditions receive specific labels, the system automatically generates Usage objects preventing deletion.
An example of Protecting namespaces from deletion via labeled resources has been created at https://github.com/crossplane-contrib/function-deletion-protection/tree/main/examples/operations.
Enhanced Usage Reason Strings
The release provides more descriptive reason messages:
- Label-based protection identification
- Composite resource protection tracking
- Operation and WatchOperation attribution
Documentation Improvements
- Reorganized examples into composition and operations directories
- Enhanced README with Operations guidance
- Clearer Crossplane version compatibility notes
Installation
Install via Crossplane package specification using the image:
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
name: crossplane-contrib-function-deletion-protection
spec:
package: xpkg.upbound.io/crossplane-contrib/function-deletion-protection:v0.2.0Compatibility
- Crossplane 2.x required for Operations
- Composition pipeline support: Crossplane 1.x and 2.x
- V1 mode available for older clusters
What's Changed
- update for crossplane-contrib repo by @stevendborrelli in #1
New Contributors
- @stevendborrelli made their first contribution in #1
Full Changelog: https://github.com/crossplane-contrib/function-deletion-protection/commits/v0.2.0