openshift / ansible-service-broker

Ansible Service Broker
Apache License 2.0
228 stars 84 forks source link

APB pods should have descriptive names #385

Closed djwhatle closed 6 years ago

djwhatle commented 7 years ago

Feature Request: Use more descriptive names for APB pods

What happened:

NAME                                       READY     STATUS      RESTARTS   AGE
apb-040cb995-5c99-41b0-8c79-c1bb512d399e   0/1       Completed   0          2h
apb-10465d96-b7b6-46bb-858e-81236d8391de   0/1       Completed   0          2h
apb-11ed3a4d-ae70-4e9b-9787-9f042544bec0   0/1       Completed   0          2h
apb-dfe46c9e-89be-41b9-b7ce-07be8a1daf29   0/1       Completed   0          2h
docker-registry-1-lzwrb                    1/1       Running     0          2h
hello-world-1-3x7zf                        1/1       Running     0          2h
persistent-volume-setup-ct6k5              0/1       Completed   0          2h
router-1-8dls6                             1/1       Running     0          2h

What you expected to happen: APBs have descriptive but unique names, similar to how normal pods are named in OpenShift. Example: apb-hello-world-1-3x7zf

Edit: It would be even more helpful to see the action that the APB pod is carrying out. Example: apb-provision-hello-world-1-lzwrb

Perhaps the APB name can be used in the pod name as-is. Another option would be to have a "short name" parameter defined in apb.yml.

Relevant line in broker: https://github.com/openshift/ansible-service-broker/blob/master/pkg/apb/executor.go#L71

eriknelson commented 7 years ago

We should be able to use a k8s construct: metadata.generatedName to address this:

https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#idempotency

Names generated by the system may be requested using metadata.generateName. GenerateName indicates that the name should be made unique by the server prior to persisting it. A non-empty value for the field indicates the name will be made unique (and the name returned to the client will be different than the name passed). The value of this field will be combined with a unique suffix on the server if the Name field has not been provided.

So I'd propose something descriptive (apb.Name), for this value. metadata.generatedName: foo-apb- would result in a pod name of foo-apb-xyrhf, for example. We just need to make sure the broker does not set the Name field on the pod.