Skip to content

Annotation script doesn't work when namespaced is not set in yaml manifest #59

@quentinalbertone

Description

@quentinalbertone

What happened?

Hello, I would like to understand why my tests don't work when I don't set a namespace in my yaml manifest, every thing is fine when I deploy my manifest in a namespace known from the beginning (like default or crossplane-system)
I have created a upjet project form this repository: https://github.com/crossplane/upjet-provider-template

Without namespace:

  1. start test make e2e PROVIDER_NAME=provider-exoscale UPTEST_EXAMPLE_LIST=$(find cluster/test/*/*.yaml | tr '\n' ',') UPTEST_CLOUD_CREDENTIALS="{\"key\": \"$EXOSCALE_API_KEY\", \"secret\": \"$EXOSCALE_API_SECRET\"}"
  2. create kind cluster
  3. create tmp namespace like chainsaw-discrete-ringtail
  4. deploy resource
  5. everything is deployed, synced, ready
  6. test failed
2026/02/09 15:43:56     | 15:43:56 | apply | Apply Resources          | CMD       | RUN   |
2026/02/09 15:43:56         === COMMAND
2026/02/09 15:43:56         /usr/bin/sh -c echo "Running annotation script with retry logic"
2026/02/09 15:43:56         retry_annotate() {
2026/02/09 15:43:56           local max_attempts=10
2026/02/09 15:43:56           local delay=5
2026/02/09 15:43:56           local attempt=1
2026/02/09 15:43:56           local cmd="$1"
2026/02/09 15:43:56         
2026/02/09 15:43:56           while [ $attempt -le $max_attempts ]; do
2026/02/09 15:43:56             echo "Annotation attempt $attempt/$max_attempts for: $cmd"
2026/02/09 15:43:56             if eval "$cmd"; then
2026/02/09 15:43:56               echo "Annotation successful on attempt $attempt"
2026/02/09 15:43:56               return 0
2026/02/09 15:43:56             else
2026/02/09 15:43:56               echo "Annotation failed on attempt $attempt"
2026/02/09 15:43:56               if [ $attempt -lt $max_attempts ]; then
2026/02/09 15:43:56                 echo "Retrying in ${delay}s..."
2026/02/09 15:43:56                 sleep $delay
2026/02/09 15:43:56               fi
2026/02/09 15:43:56               ((attempt++))
2026/02/09 15:43:56             fi
2026/02/09 15:43:56           done
2026/02/09 15:43:56           echo "Annotation failed after $max_attempts attempts"
2026/02/09 15:43:56           return 1
2026/02/09 15:43:56         }
2026/02/09 15:43:56         retry_annotate "${KUBECTL} annotate  blockstoragevolume.compute.exoscale.m.exoscale.ch/my-block-storage upjet.upbound.io/test=true --overwrite"

2026/02/09 15:56:48     | 15:56:48 | apply | Apply Resources          | SCRIPT    | LOG   |
2026/02/09 15:56:48         Annotation attempt 1/10 for: /home/albert_q/go/src/github.com/exoscale/provider-exoscale/.cache/tools/linux_x86_64/kubectl-v1.33.5 annotate  blockstoragevolume.compute.exoscale.m.exoscale.ch/my-block-storage upjet.upbound.io/test=true --overwrite
2026/02/09 15:56:48         Annotation failed on attempt 1
2026/02/09 15:56:48         Retrying in 5s...
[.....]
2026/02/09 15:56:48         Annotation attempt 10/10 for: /home/albert_q/go/src/github.com/exoscale/provider-exoscale/.cache/tools/linux_x86_64/kubectl-v1.33.5 annotate  blockstoragevolume.compute.exoscale.m.exoscale.ch/my-block-storage upjet.upbound.io/test=true --overwrite
2026/02/09 15:56:48         Annotation failed on attempt 10
2026/02/09 15:56:48         Annotation failed after 10 attempts

2026/02/09 15:56:48         === STDERR
2026/02/09 15:56:48         Error from server (NotFound): blockstoragevolumes.compute.exoscale.m.exoscale.ch "my-block-storage" not found
[.....]
2026/02/09 15:56:48         Error from server (NotFound): blockstoragevolumes.compute.exoscale.m.exoscale.ch "my-block-storage" not found

2026/02/09 15:56:48     | 15:56:48 | apply | Apply Resources          | SCRIPT    | ERROR |
2026/02/09 15:56:48         === ERROR
2026/02/09 15:56:48         exit status 1
2026/02/09 15:56:48     | 15:56:48 | apply | Apply Resources          | TRY       | END   |
2026/02/09 15:56:48     | 15:56:48 | apply | @chainsaw                | CLEANUP   | SKIP  |
2026/02/09 15:56:48 === NAME  chainsaw
2026/02/09 15:56:48     | 15:56:48 | chainsaw | @chainsaw | CLEANUP   | SKIP  |
2026/02/09 15:56:48 --- FAIL: chainsaw (0.00s)
2026/02/09 15:56:48     --- FAIL: chainsaw/apply (784.72s)
2026/02/09 15:56:48 FAIL
2026/02/09 15:56:48 Tests Summary...
2026/02/09 15:56:48 - Passed  tests 0
2026/02/09 15:56:48 - Failed  tests 1
2026/02/09 15:56:48 - Skipped tests 0
2026/02/09 15:56:48 Done with failures.
2026/02/09 15:56:48 Error: some tests failed
uptest-v2.2.0: error: cannot run e2e tests successfully: cannot execute tests: cannot execute test 00-apply.yaml: cannot wait for chainsaw: "${CHAINSAW}" test --test-dir /tmp/uptest-e2e/case --test-file 00-apply.yaml --skip-delete --parallel 1 2>&1: exit status 1
15:56:48 [FAIL]
make: *** [Makefile:199: uptest] Error 1

Here is the state of my resource before the test fails

$> kubectl get managed -A
NAMESPACE                    NAME                                                                 SYNCED   READY   EXTERNAL-NAME                          AGE
chainsaw-discrete-ringtail   blockstoragevolume.compute.exoscale.m.exoscale.ch/my-block-storage   True     True    51f3dab6-9e69-4132-a55c-94283b18582a   50m

As I said I have no issue when I set the namespace for my resource

apiVersion: compute.exoscale.m.exoscale.ch/v1alpha1
kind: BlockStorageVolume
metadata:
  name: my-block-storage
+  namespace: default
spec:
  forProvider:
    name: my-block-storage
    size: 20
    zone: ch-gva-2

How can we reproduce it?

It will be difficult to reproduce knowing that the provider for exoscale is not released yet, but I'm trying to test generated resource (namespaced resource not cluster) with upjet + terraform

What environment did it happen in?

  • Uptest Version: v2.2.0
  • Kubernetes version (use kubectl version): Client Version: v1.33.5, Server Version: v1.34.0
  • Kubernetes distribution (e.g. Tectonic, GKE, OpenShift): kind
  • my setup script

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions