argoproj / argoproj/argo-cd

namespace not found vs. CreateNamespace=true

Open
#11,625 41 comments 18 reactions 0 assignees View on GitHub
bug triage/high-traffic version:3.0
Dominant language
Go
Stars
24.2k
Forks
7.9k
Avg merge
1d 6h
Merged PRs (30d)
239

Description

**Describe the bug**
I'm getting a `namespace not found` error when deploying an app.
It worked yesterday but stopped working today.

Since yesterday all nodes have only been scaled down and up again. No configuration has been changed apart from the fact I deleted the app along with the namespace and was trying to deploy it again.
I also tried with a different namespace but it didn't work.

App definition:
```
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
finalizers:
- resources-finalizer.argocd.argoproj.io
labels:
argocd.argoproj.io/instance: test-hello-world-app
name: test-hello-world
namespace: test-hello-world
spec:
destination:
namespace: test-hello-world
server: 'https://kubernetes.default.svc'
project: sebolabs-test
source:
helm:
valueFiles:
- values.yaml
- values-test.yaml
path: apps/hello-world
repoURL: 'https://...'
targetRevision: trying-out-things
syncPolicy:
automated:
prune: true
retry:
backoff:
duration: 5s
factor: 2
maxDuration: 1m
limit: 1
syncOptions:
- CreateNamespace=true
```

The `sebolabs-test` project accepts `test-*` namespaces + ArgoCD is configured with `application.namespaces: "test-*"`. Just like it was explained yesterday [here](https://github.com/argoproj/argo-cd/issues/11597).

As I was running out of ideas on how to get it working again I updated ArgoCD to v2.5.4 but that didn't change anything.

**To Reproduce**

See above.

**Expected behavior**

The `test-hello-world` namespace should be automatically created and the app should be successfully deployed.

**Screenshots**

N/A

**Version**

```shell
v2.5.4+86b2dde
```

**Logs**

```
time="2022-12-08T21:29:29Z" level=info msg=Syncing application=argocd/test-hello-world-app skipHooks=false started=false syncId=00008-QWOTG
time="2022-12-08T21:29:29Z" level=info msg="Tasks (dry-run)" application=argocd/test-hello-world-app syncId=00008-QWOTG tasks="[Sync/0 resource argoproj.io/Application:test-hello-world/test-hello-world nil->obj (,,)]"
time="2022-12-08T21:29:29Z" level=info msg="Applying resource Application/test-hello-world in cluster: https://172.20.0.1:443, namespace: test-hello-world"
time="2022-12-08T21:29:29Z" level=info msg="Updating operation state. phase: Running -> Running, message: 'one or more objects failed to apply, reason: namespaces \"test-hello-world\" not found. Retrying attempt #4 at 9:28PM.' -> 'one or more tasks are running'" application=argocd/test-hello-world-app syncId=00008-QWOTG
time="2022-12-08T21:29:29Z" level=info msg="Applying resource Application/test-hello-world in cluster: https://172.20.0.1:443, namespace: test-hello-world"
time="2022-12-08T21:29:29Z" level=info msg="Apply failed" application=argocd/test-hello-world-app dryRun=false message="namespaces \"test-hello-world\" not found" syncId=00008-QWOTG task="Sync/0 resource argoproj.io/Application:test-hello-world/test-hello-world nil->obj (,,)"
time="2022-12-08T21:29:29Z" level=info msg="Adding resource result, status: 'SyncFailed', phase: 'Failed', message: 'namespaces \"test-hello-world\" not found'" application=argocd/test-hello-world-app kind=Application name=test-hello-world namespace=test-hello-world phase=Sync syncId=00008-QWOTG
time="2022-12-08T21:29:29Z" level=info msg="Updating operation state. phase: Running -> Failed, message: 'one or more tasks are running' -> 'one or more objects failed to apply, reason: namespaces \"test-hello-world\" not found'" application=argocd/test-hello-world-app syncId=00008-QWOTG
```

Contributor guide

Open the contributing guide

Research direction

Start with the Application manifest's syncOptions entry and the sync log showing the test-hello-world namespace was not found, then compare this behavior with the application.namespaces and project namespace settings described in the report and issue #11597. Done means an Application using CreateNamespace=true creates the destination namespace and deploys successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, helm, kubernetes
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.