cd$HOMEgit clone https://github.com/redhat-gpte-devopsautomation/ansible-operator-roles
cd ansible-operator-roles
git checkout v0.16.0
cd$HOME
使用operator-sdk创建gogs-operator的框架。
$ operator-sdk new gogs-operator --api-version=gpte.opentlc.com/v1alpha1 --kind=Gogs --type=ansible --generate-playbook
INFO[0000] Creating new Ansible operator 'gogs-operator'.
INFO[0000] Created deploy/service_account.yaml
INFO[0000] Created deploy/role.yaml
INFO[0000] Created deploy/role_binding.yaml
INFO[0000] Created deploy/crds/gpte.opentlc.com_v1alpha1_gogs_cr.yaml
INFO[0000] Created build/Dockerfile
INFO[0000] Created roles/gogs/README.md
INFO[0000] Created roles/gogs/meta/main.yml
INFO[0000] Created roles/gogs/files/.placeholder
INFO[0000] Created roles/gogs/templates/.placeholder
INFO[0000] Created roles/gogs/vars/main.yml
INFO[0000] Created molecule/test-local/playbook.yml
INFO[0000] Created roles/gogs/defaults/main.yml
INFO[0000] Created roles/gogs/tasks/main.yml
INFO[0000] Created molecule/default/molecule.yml
INFO[0000] Created molecule/default/prepare.yml
INFO[0000] Created molecule/default/playbook.yml
INFO[0000] Created molecule/default/verify.yml
INFO[0000] Created roles/gogs/handlers/main.yml
INFO[0000] Created watches.yaml
INFO[0000] Created deploy/operator.yaml
INFO[0000] Created .travis.yml
INFO[0000] Created requirements.yml
INFO[0000] Created molecule/test-local/molecule.yml
INFO[0000] Created molecule/test-local/prepare.yml
INFO[0000] Created molecule/test-local/verify.yml
INFO[0000] Created molecule/cluster/molecule.yml
INFO[0000] Created molecule/cluster/create.yml
INFO[0000] Created molecule/cluster/prepare.yml
INFO[0000] Created molecule/cluster/playbook.yml
INFO[0000] Created molecule/cluster/verify.yml
INFO[0000] Created molecule/cluster/destroy.yml
INFO[0000] Created molecule/templates/operator.yaml.j2
INFO[0000] Generated CustomResourceDefinition manifests.
INFO[0000] Generating Ansible playbook.
INFO[0000] Created playbook.yml
INFO[0000] Project creation complete.
$ oc get pod
NAME READY STATUS RESTARTS AGE
gogs-gogs-7b6f957d49-ggfr9 1/1 Running 0 116s
gogs-operator-54867bf5cf-hlknh 1/1 Running 0 11m
postgresql-gogs-gogs-56d7884467-b9h9t 1/1 Running 0 4m31s
查看部署的gogs对象。
$ oc get gogs
NAME AGE
gogs 7m10s
查看gogs对象的信息。
oc describe gogs gogs
查看gogs的route。
oc get route
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
gogs-gogs gogs-gogs-pek-2b3a-gogs.apps.cluster-pek-2b3a.pek-2b3a.sandbox954.opentlc.com gogs-gogs <all> edge/Redirect None