automationbroker / apb

A CLI tool for listing and deploying Service Bundles
http://automationbroker.io
Apache License 2.0
62 stars 13 forks source link

Dockerized apb can't create/read registries.json #142

Closed aliok closed 4 years ago

aliok commented 5 years ago

Coming here from https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/issues/321

I am trying to make the apb tool working with OpenShift 3.11. I was told in https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/issues/321 that there is a new apb tool now and the old one won't work with the OKD 3.11.

Followed the instructions.

  1. Start up cluster and give permissions to developer user

    oc cluster up
    oc login -u system:admin
    oc cluster add service-catalog
    oc cluster add automation-service-broker
    oc cluster add template-service-broker
    oc whoami
    oc login -u system:admin && oc adm policy add-cluster-role-to-user access-asb-role developer && oc adm policy add-cluster-role-to-user cluster-admin developer && oc login -u developer
  2. Create apb script based on the instructions here: https://github.com/automationbroker/apb/blob/master/docs/apb_cli.md#running-from-a-container

  3. Switch to nightly because stable and canary points to old apb. See https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/issues/321

  4. Execute apb version:

    [aliok@localhost metrics-apb]$ apb version
    Running APB image: docker.io/ansibleplaybookbundle/apb-tools:nightly
    level=warning msg="Didn't find config file /.apb/registries.json, creating."
    level=error msg="open /.apb/registries.json: no such file or directory"
  5. Execute any apb command, will see the same messages as above.

registries.json is not really created. Created that file manually but result is the same.

Env

$ oc version
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://127.0.0.1:8443
kubernetes v1.11.0+d4cacc0
$ docker images | grep apb
ansibleplaybookbundle/apb-tools                       nightly             30bae8f2e18b        5 days ago          365M
$ docker images | grep broker
openshift/origin-template-service-broker              v3.11               6a8e44174040        14 hours ago        328MB
automationbroker/automation-broker-apb                v3.11               180cc25d3de3        3 weeks ago         626MB
ansibleplaybookbundle/origin-ansible-service-broker   v3.11               9fbc4d964506        3 weeks ago         535MB
dymurray commented 5 years ago

@aliok It looks to me like you are running into an issue that has been documented in bugzilla but never made it to the upstream docs: https://bugzilla.redhat.com/show_bug.cgi?id=1615786#c1.

Looks like you need to mkdir -p ~/.apb and then change your alias to run:

docker run -it --rm --privileged -v $PWD:/mnt -v $HOME/.kube:/.kube -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.apb:/.apb -u $UID docker.io/ansibleplaybookbundle/apb-tools:nightly

I apologize... I don't use the containerized version so I didn't notice these out of date docs. I will update these today, but for now I would do:

$ mkdir -p ~/.apb
$ alias apb=docker run -it --rm --privileged -v $PWD:/mnt -v $HOME/.kube:/.kube -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.apb:/.apb -u $UID docker.io/ansibleplaybookbundle/apb-tools:nightly

and verify that apb version works.

aliok commented 5 years ago

Thanks for the reply. I haven't tried this yet but I will let you know once I try it.

jmrodri commented 4 years ago

@aliok thank you for submitting this issue. The apb tool has been deprecated for the new Operators model. Please consider using Operator SDK (https://github.com/operator-framework/operator-sdk/) and building an Operator instead of an APB.