user-create - Action issue

Bug #1956615 reported by Pedro Victor Lourenço Fragola
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Kubernetes Control Plane Charm
Fix Released
Medium
Adam Dyess

Bug Description

App Version Status Scale Charm Store Channel Rev OS Message
kubernetes-master 1.23.1 active 1 kubernetes-master charmstore stable 1106 ubuntu Kubernetes master running.

juju run-action --wait kubernetes-master/0 user-create name='test5' groups='system:masters,devs'
unit-kubernetes-master-0:
  UnitId: kubernetes-master/0
  id: "16"
  message: exit status 1
  results:
    ReturnCode: 1
    Stderr: |
      Traceback (most recent call last):
        File "/var/lib/juju/agents/unit-kubernetes-master-0/charm/actions/user-create", line 101, in <module>
          user_create()
        File "/var/lib/juju/agents/unit-kubernetes-master-0/charm/actions/user-create", line 67, in user_create
          public_address, public_port = layer.kubernetes_master.get_api_endpoint()
      AttributeError: module 'charms.layer.kubernetes_master' has no attribute 'get_api_endpoint'
    users: admin, alice, alice1, system:kube-controller-manager, system:kube-proxy,
      system:node:juju-1c420c-cdk-4, system:node:juju-1c420c-cdk-5, pedro, system:kube-scheduler,
      system:monitoring, test1
  status: failed
  timing:
    completed: 2022-01-06 19:31:09 +0000 UTC
    enqueued: 2022-01-06 19:31:06 +0000 UTC
    started: 2022-01-06 19:31:06 +0000 UTC

The user is created but the kubeconfig file is not created

juju run-action --wait kubernetes-master/0 user-list
unit-kubernetes-master-0:
  UnitId: kubernetes-master/0
  id: "18"
  results:
    users: admin, alice, alice1, system:kube-controller-manager, system:kube-proxy,
      system:node:juju-1c420c-cdk-4, system:node:juju-1c420c-cdk-5, pedro, system:kube-scheduler,
      system:monitoring, test1, test5

George Kraft (cynerva)
Changed in charm-kubernetes-master:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Adam Dyess (addyess) wrote :
Changed in charm-kubernetes-master:
milestone: none → 1.23+ck1
assignee: nobody → Adam Dyess (addyess)
status: Triaged → Fix Committed
Revision history for this message
Adam Dyess (addyess) wrote (last edit ):

Workaround:
As as work-around I've lifted the current action's solution out of the main branch to a gist which lets an admin user run with `juju run`

I've provided an example run with the user "example". in this case, i'm targetting the application kubernetes-control-plane, but in some deployments it may be kubernetes-master

```
wget https://gist.githubusercontent.com/addyess/681a2733987beeffeb11ddcf3ff2d799/raw/e1aab89c977977772583bb97e0ddc823303a273e/lp-1956615.sh -O LP1956615.sh

USER="example"
GROUPS=""
juju run -u kubernetes-control-plane/leader -- bash -c "$(cat LP1956615.sh) $USER $GROUPS"
juju run-actions kubernetes-control-plane/leader user-list -- wait
juju scp kubernetes-control-plane/0:/home/ubuntu/example-kubeconfig .
```

Revision history for this message
George Kraft (cynerva) wrote :
Changed in charm-kubernetes-master:
milestone: 1.23+ck1 → 1.24
Changed in charm-kubernetes-master:
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.