@@ -30,8 +30,6 @@ import (
3030
3131 "github.com/crossplane/crossplane-runtime/v2/pkg/errors"
3232 "github.com/crossplane/crossplane-runtime/v2/pkg/logging"
33- "github.com/crossplane/crossplane-runtime/v2/pkg/meta"
34- "github.com/crossplane/crossplane-runtime/v2/pkg/resource"
3533 "github.com/crossplane/crossplane-runtime/v2/pkg/resource/unstructured/composed"
3634 ucomposite "github.com/crossplane/crossplane-runtime/v2/pkg/resource/unstructured/composite"
3735
@@ -42,14 +40,6 @@ import (
4240 renderv1alpha1 "github.com/crossplane/cli/v2/proto/render/v1alpha1"
4341)
4442
45- // Annotations added to composed resources.
46- const (
47- AnnotationKeyCompositionResourceName = "crossplane.io/composition-resource-name"
48- AnnotationKeyCompositeName = "crossplane.io/composite"
49- AnnotationKeyClaimNamespace = "crossplane.io/claim-namespace"
50- AnnotationKeyClaimName = "crossplane.io/claim-name"
51- )
52-
5343// CompositionInputs contains all inputs to the render process.
5444type CompositionInputs struct {
5545 CompositeResource * ucomposite.Unstructured
@@ -154,54 +144,6 @@ func RewriteAddressesForDocker(fns []*renderv1alpha1.FunctionInput) []*renderv1a
154144 return fns
155145}
156146
157- // GetSecret retrieves the secret with the specified name and namespace from the provided list of secrets.
158- func GetSecret (name string , nameSpace string , secrets []corev1.Secret ) (* corev1.Secret , error ) {
159- for _ , s := range secrets {
160- if s .GetName () == name && s .GetNamespace () == nameSpace {
161- return & s , nil
162- }
163- }
164-
165- return nil , errors .Errorf ("secret %q not found" , name )
166- }
167-
168- // SetComposedResourceMetadata sets standard, required composed resource
169- // metadata. It mirrors the behavior of RenderComposedResourceMetadata in
170- // Crossplane's composition controller.
171- func SetComposedResourceMetadata (cd resource.Object , xr resource.LegacyComposite , name string ) error {
172- namePrefix := xr .GetLabels ()[AnnotationKeyCompositeName ]
173- if namePrefix == "" {
174- namePrefix = xr .GetName ()
175- }
176-
177- if cd .GetName () == "" && cd .GetGenerateName () == "" {
178- cd .SetGenerateName (namePrefix + "-" )
179- }
180-
181- if xr .GetNamespace () != "" {
182- cd .SetNamespace (xr .GetNamespace ())
183- }
184-
185- meta .AddAnnotations (cd , map [string ]string {AnnotationKeyCompositionResourceName : name })
186- meta .AddLabels (cd , map [string ]string {AnnotationKeyCompositeName : namePrefix })
187-
188- if xr .GetLabels ()[AnnotationKeyClaimName ] != "" && xr .GetLabels ()[AnnotationKeyClaimNamespace ] != "" {
189- meta .AddLabels (cd , map [string ]string {
190- AnnotationKeyClaimNamespace : xr .GetLabels ()[AnnotationKeyClaimNamespace ],
191- AnnotationKeyClaimName : xr .GetLabels ()[AnnotationKeyClaimName ],
192- })
193- } else if ref := xr .GetClaimReference (); ref != nil {
194- meta .AddLabels (cd , map [string ]string {
195- AnnotationKeyClaimNamespace : ref .Namespace ,
196- AnnotationKeyClaimName : ref .Name ,
197- })
198- }
199-
200- or := meta .AsController (meta .TypedReferenceTo (xr , xr .GetObjectKind ().GroupVersionKind ()))
201-
202- return errors .Wrapf (meta .AddControllerReference (cd , or ), "cannot set composite resource %q as controller ref of composed resource" , xr .GetName ())
203- }
204-
205147// injectNetworkAnnotation sets the Docker network annotation on all functions
206148// so their containers join the specified network.
207149func injectNetworkAnnotation (fns []pkgv1.Function , networkName string ) {
0 commit comments