sa-mw-dach / podium

48 stars 10 forks source link

Operator fails setting up route on plain k8s #5

Open gandhiano opened 4 years ago

gandhiano commented 4 years ago

After following the instructions for the manual operator setup on a plain k8s and applying the reference podium.yaml only the etherpad gets deployed, all other components are missing.

The operator logs show that it fails while trying to setup the route (which is openshift specific):



 TASK [Deploy etherpad route] ********************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to find exact match for route.openshift.io/v1.Route by [kind, name, singularName, shortNames]"}

-------------------------------------------------------------------------------
{"level":"error","ts":1588277195.5856867,"logger":"runner","msg":"ansible-playbook 2.9.6\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = ['/usr/share/ansible/openshift']\r\n  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible\r\n  executable location = /usr/local/bin/ansible-playbook\r\n  python version = 3.6.8 (default, Oct 11 2019, 15:04:54) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]\r\nUsing /etc/ansible/ansible.cfg as config file\r\n\r\nPLAYBOOK: 6e49006f865047a48e654be8f911f1be *************************************\r\n\r\nPLAYBOOK: 6e49006f865047a48e654be8f911f1be *************************************\n1 plays in /tmp/ansible-operator/runner/podium.com/v1alpha1/Podium/podium/mypodium/project/6e49006f865047a48e654be8f911f1be\n\r\nPLAY [localhost] ***************************************************************\n\r\nTASK [Gathering Facts] *********************************************************\nok: [localhost]\nMETA: ran handlers\n\r\nTASK [podium : debug] **********************************************************\r\ntask path: /opt/ansible/roles/podium/tasks/main.yml:2\nok: [localhost] => {\r\n    \"msg\": \"Deploy Etherpad (Real-time editor) set to True\"\r\n}\n\r\nTASK [Deploy etherpad] *********************************************************\r\ntask path: /opt/ansible/roles/podium/tasks/main.yml:4\n\r\nTASK [etherpad : Deploy etherpad] **********************************************\r\ntask path: /opt/ansible/roles/etherpad/tasks/main.yml:2\r\n\r\nTASK [etherpad : Deploy etherpad] **********************************************\r\ntask path: /opt/ansible/roles/etherpad/tasks/main.yml:2\n: [{\"lastTransitionTime\": \"2020-04-30T18:38:52Z\", \"lastUpdateTime\": \"2020-04-30T18:38:52Z\", \"message\": \"Deployment has minimum availability.\", \"reason\": \"MinimumReplicasAvailable\", \"status\": \"True\", \"type\": \"Available\"}, {\"lastTransitionTime\": \"2020-04-30T18:37:33Z\", \"lastUpdateTime\": \"2020-04-30T18:38:52Z\", \"message\": \"ReplicaSet \\\"etherpad-6f7544c667\\\" has successfully progressed.\", \"reason\": \"NewReplicaSetAvailable\", \"status\": \"True\", \"type\": \"Progressing\"}], \"observedGeneration\": 1, \"readyReplicas\": 1, \"replicas\": 1, \"updatedReplicas\": 1}}}\r\nok: [localhost] => {\"changed\": false, \"method\": \"patch\", \"result\": {\"apiVersion\": \"apps/v1\", \"kind\": \"Deployment\", \"metadata\": {\"annotations\": {\"deployment.kubernetes.io/revision\": \"1\", \"operator-sdk/primary-resource\": \"/mypodium\", \"operator-sdk/primary-resource-type\": \"Podium.podium.com\"}, \"creationTimestamp\": \"2020-04-30T18:37:33Z\", \"generation\": 1, \"labels\": {\"app\": \"etherpad\"}, \"name\": \"etherpad\", \"namespace\": \"podium\", \"resourceVersion\": \"10340661\", \"selfLink\": \"/apis/apps/v1/namespaces/podium/deployments/etherpad\", \"uid\": \"dc9a50c6-aac2-4e97-9627-d88b9975f441\"}, \"spec\": {\"progressDeadlineSeconds\": 600, \"replicas\": 1, \"revisionHistoryLimit\": 10, \"selector\": {\"matchLabels\": {\"app\": \"etherpad\"}}, \"strategy\": {\"rollingUpdate\": {\"maxSurge\": \"25%\", \"maxUnavailable\": \"25%\"}, \"type\": \"RollingUpdate\"}, \"template\": {\"metadata\": {\"creationTimestamp\": null, \"labels\": {\"app\": \"etherpad\", \"name\": \"etherpad\"}}, \"spec\": {\"containers\": [{\"env\": [{\"name\": \"TITLE\", \"value\": \"Etherpad is a real-time text editor\"}, {\"name\": \"DEFAULT_PAD_TEXT\", \"value\": \"Etherpad is a real-time text editor\"}], \"image\": \"etherpad/etherpad\", \"imagePullPolicy\": \"Always\", \"livenessProbe\": {\"failureThreshold\": 3, \"httpGet\": {\"path\": \"/\", \"port\": 9001, \"scheme\": \"HTTP\"}, \"initialDelaySeconds\": 120, \"periodSeconds\": 10, \"successThreshold\": 1, \"timeoutSeconds\": 1}, \"name\": \"etherpad\", \"ports\": [{\"containerPort\": 9001, \"protocol\": \"TCP\"}], \"readinessProbe\": {\"failureThreshold\": 3, \"httpGet\": {\"path\": \"/\", \"port\": 9001, \"scheme\": \"HTTP\"}, \"initialDelaySeconds\": 60, \"periodSeconds\": 10, \"successThreshold\": 1, \"timeoutSeconds\": 60}, \"resources\": {}, \"terminationMessagePath\": \"/dev/termination-log\", \"terminationMessagePolicy\": \"File\"}], \"dnsPolicy\": \"ClusterFirst\", \"restartPolicy\": \"Always\", \"schedulerName\": \"default-scheduler\", \"securityContext\": {}, \"terminationGracePeriodSeconds\": 30}}}, \"status\": {\"availableReplicas\": 1, \"conditions\": [{\"lastTransitionTime\": \"2020-04-30T18:38:52Z\", \"lastUpdateTime\": \"2020-04-30T18:38:52Z\", \"message\": \"Deployment has minimum availability.\", \"reason\": \"MinimumReplicasAvailable\", \"status\": \"True\", \"type\": \"Available\"}, {\"lastTransitionTime\": \"2020-04-30T18:37:33Z\", \"lastUpdateTime\": \"2020-04-30T18:38:52Z\", \"message\": \"ReplicaSet \\\"etherpad-6f7544c667\\\" has successfully progressed.\", \"reason\": \"NewReplicaSetAvailable\", \"status\": \"True\", \"type\": \"Progressing\"}], \"observedGeneration\": 1, \"readyReplicas\": 1, \"replicas\": 1, \"updatedReplicas\": 1}}}\n\r\nTASK [etherpad : Deploy etherpad service] **************************************\r\n\r\nTASK [etherpad : Deploy etherpad service] **************************************\r\ntask path: /opt/ansible/roles/etherpad/tasks/main.yml:52\n\r\nok: [localhost] => {\"changed\": false, \"method\": \"patch\", \"result\": {\"apiVersion\": \"v1\", \"kind\": \"Service\", \"metadata\": {\"annotations\": {\"operator-sdk/primary-resource\": \"/mypodium\", \"operator-sdk/primary-resource-type\": \"Podium.podium.com\"}, \"creationTimestamp\": \"2020-04-30T18:37:35Z\", \"labels\": {\"app\": \"etherpad\"}, \"name\": \"etherpad\", \"namespace\": \"podium\", \"resourceVersion\": \"10340380\", \"selfLink\": \"/api/v1/namespaces/podium/services/etherpad\", \"uid\": \"1027b060-8e43-4c63-8cc5-3aad15140b5a\"}, \"spec\": {\"clusterIP\": \"10.233.9.196\", \"ports\": [{\"port\": 9001, \"protocol\": \"TCP\", \"targetPort\": 9001}], \"selector\": {\"app\": \"etherpad\", \"name\": \"etherpad\"}, \"sessionAffinity\": \"None\", \"type\": \"ClusterIP\"}, \"status\": {\"loadBalancer\": {}}}}\n\r\nTASK [etherpad : Deploy etherpad route] ****************************************\r\n\r\nTASK [etherpad : Deploy etherpad route] ****************************************\r\ntask path: /opt/ansible/roles/etherpad/tasks/main.yml:71\n\r\nfatal: [localhost]: FAILED! => {\"changed\": false, \"msg\": \"Failed to find exact match for route.openshift.io/v1.Route by [kind, name, singularName, shortNames]\"}\n\r\nPLAY RECAP *********************************************************************\r\nlocalhost                  : ok=4    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   \r\nPLAY RECAP *********************************************************************\r\nlocalhost                  : ok=4    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   \r\n\n","job":"545291762129038907","name":"mypodium","namespace":"podium","error":"exit status 2","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\tpkg/mod/github.com/go-logr/zapr@v0.1.1/zapr.go:128\ngithub.com/operator-framework/operator-sdk/pkg/ansible/runner.(*runner).Run.func1\n\tsrc/github.com/operator-framework/operator-sdk/pkg/ansible/runner/runner.go:239"}

--------------------------- Ansible Task Status Event StdOut  -----------------

PLAY RECAP *********************************************************************
localhost                  : ok=4    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

-------------------------------------------------------------------------------
{"level":"error","ts":1588277195.6352737,"logger":"controller-runtime.controller","msg":"Reconciler error","controller":"podium-controller","request":"podium/mypodium","error":"event runner on failed","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\tpkg/mod/github.com/go-logr/zapr@v0.1.1/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tpkg/mod/sigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:258\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tpkg/mod/sigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\tpkg/mod/sigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\tpkg/mod/k8s.io/apimachinery@v0.17.4/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tpkg/mod/k8s.io/apimachinery@v0.17.4/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\tpkg/mod/k8s.io/apimachinery@v0.17.4/pkg/util/wait/wait.go:88"}```
ktenzer commented 4 years ago

Yes this is because a Route is an OpenShift specific. In k8s you have ingress. Routes are more powerful and have some additional capabilities. OpenShift supports everything k8s does plus has extra extentions/capabilities. You should be able to update the Routes and change them to Ingress in the yaml files. I would create new ones and name them k8s. Then you can pull request that. We havent tested on k8s, there could also be some other things regarding role and permissions that need to be adjusted. If you provide a k8s environment I could possibly help but I dont have one.