ServiceAccountName not properly set in juju 2.8

Bug #1899987 reported by David
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Yang Kelvin Liu

Bug Description

Hello,

A K8s charm with RBAC is not working in juju 2.8.

How to reproduce:

```
$ sudo snap install juju --classic --channel 2.8/stable
$ sudo snap install microk8s --classic
$ microk8s.status --wait-ready
$ microk8s.enable rbac storage dns

$ juju bootstrap microk8s
$ juju add-model osm
$ juju deploy cs:~charmed-osm/mongodb-k8s --config enable-sidecar=true

$ watch -c juju status --color # Wait until it is ready
$ microk8s.kubectl -n osm logs mongodb-k8s-0 -c mongodb-sidecar-k8s
Error in workloop { [Error: [object Object]]
  message:
   { kind: 'Status',
     apiVersion: 'v1',
     metadata: {},
     status: 'Failure',
     message:
      'pods is forbidden: User "system:serviceaccount:osm:default" cannot list resource "pods" in API group "" in the namespace "osm"',
     reason: 'Forbidden',
     details: { kind: 'pods' },
     code: 403 },
  statusCode: 403 }
$ microk8s.kubectl -n osm get pods mongodb-k8s-0 -o json | jq .spec.serviceAccountName
"default"
```

Doing the same with juju 2.7, it's working perfectly:

```
$ sudo snap install juju --classic --channel 2.7/stable
$ sudo snap install microk8s --classic
$ microk8s.status --wait-ready
$ microk8s.enable rbac storage dns

$ juju bootstrap microk8s
$ juju add-model osm
$ juju deploy cs:~charmed-osm/mongodb-k8s --config enable-sidecar=true

$ watch -c juju status --color # Wait until it is ready
$ microk8s.kubectl -n osm get pods mongodb-k8s-0 -o json | jq .spec.serviceAccountName
"mongodb-k8s"
```

I noticed that the serviceAccountName is "default" in 2.8, but it is "mongodb-k8s" in 2.7.

Revision history for this message
Pen Gale (pengale) wrote :

This is currently blocking the OSM team on a deployment.

Changed in juju:
status: New → Triaged
importance: Undecided → High
Pen Gale (pengale)
Changed in juju:
milestone: none → 2.8-next
Changed in juju:
assignee: nobody → Yang Kelvin Liu (kelvin.liu)
status: Triaged → In Progress
Ian Booth (wallyworld)
Changed in juju:
milestone: 2.8-next → 2.8.6
Revision history for this message
Yang Kelvin Liu (kelvin.liu) wrote :

https://github.com/juju/juju/pull/12141 will be landed to 2.8 to fix this issue

Ian Booth (wallyworld)
Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.