`add-model` for existing k8s namespace returns strange error message
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Committed
|
Low
|
Jordan Barrett | ||
2.9 |
Fix Released
|
Low
|
Jordan Barrett | ||
3.1 |
Fix Released
|
Low
|
Jordan Barrett | ||
3.2 |
Fix Released
|
Low
|
Jordan Barrett |
Bug Description
I already have a namespace called "m" in my cluster. When I try to add a model with the same name:
-------
$ juju add-model m
ERROR failed to open kubernetes client: annotations map[controller.
-------
I would expect a nicer error message such as
-------
$ juju add-model m
ERROR cannot create model "m": there already exists a namespace called "m" on this cluster
Please choose a different model name.
-------
This is observed on Juju 3.0.1-dc95aea. Info about this namespace:
-------
$ k get namespace m -o yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
controller.
model.
creationTimes
labels:
app.
kubernetes.
model.
name: m
resourceVersion: "1920352"
uid: df343047-
spec:
finalizers:
- kubernetes
status:
phase: Active
-------
Changed in juju: | |
status: | New → Triaged |
importance: | Undecided → Low |
milestone: | none → 3.0.1 |
Changed in juju: | |
milestone: | 3.0.1 → 3.0.2 |
Changed in juju: | |
milestone: | 3.0.2 → 3.0.3 |
Changed in juju: | |
assignee: | nobody → Jordan Barrett (barrettj12) |
Changed in juju: | |
milestone: | 2.9.40 → 2.9.41 |
Changed in juju: | |
milestone: | 2.9.41 → 2.9.42 |
Changed in juju: | |
milestone: | 2.9.42 → 2.9.43 |
Changed in juju: | |
status: | In Progress → Fix Committed |
Changed in juju: | |
milestone: | 2.9.43 → none |
Changed in juju: | |
status: | Fix Committed → Fix Released |
status: | Fix Released → Fix Committed |
Repro steps:
Create a file ns.yaml with the following contents: ------- ------- ------- ------- ------- ------- ------- ------- ------- juju.is/ id: af908c9c- 4d24-4466- 882e-c145bf0c75 4e juju.is/ id: 780625aa- 10d3-4f86- 84a7-69058a61ad b1 kubernetes. io/managed- by: juju io/metadata. name: m juju.is/ name: m ------- ------- ------- ------- ------- ------- ------- ------- -------
-------
apiVersion: v1
kind: Namespace
metadata:
annotations:
controller.
model.
labels:
app.
kubernetes.
model.
name: m
resourceVersion: "1920352"
spec:
finalizers:
- kubernetes
status:
phase: Active
-------
In terminal, run ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
-------
$ k create -f ns.yaml
namespace/m created
-------
Switch to a k8s controller (or bootstrap a new one), and run ------- ------- ------- ------- ------- ------- ------- ------- ------- juju.is/ id:af908c9c- 4d24-4466- 882e-c145bf0c75 4e model.juju. is/id:780625aa- 10d3-4f86- 84a7-69058a61ad b1] for namespace "m" not valid must include map[controller. juju.is/ id:0c9d505c- 6d4d-4a23- 8b67-ec5dc999db 7a model.juju. is/id:8e59657d- 103a-4c43- 8e70-fa16049c48 8e] ------- ------- ------- ------- ------- ------- ------- ------- -------
-------
$ juju add-model m
ERROR failed to open kubernetes client: annotations map[controller.
-------