#6404 openshift/project role crashes when the project already exists
Closed: Fixed 6 years ago Opened 6 years ago by dcallagh.

Trying to run playbooks/openshift-apps/waiverdb.yml in order to update the deployment config for waiverdb, the first thing the playbook does is apply the openshift/project role. It fails like this:

TASK [openshift/object : Call `oc apply` on the copied file _raw_params=oc -n {{app}} apply -f {{tmpfile.path}}, _uses_shell=True] ********************************************************************************
Friday 29 September 2017  05:41:47 +0000 (0:00:00.045)       0:00:02.024 ****** 
fatal: [os-master01.stg.phx2.fedoraproject.org]: FAILED! => {"changed": true, "cmd": "oc -n waiverdb apply -f /tmp/ansible.21boMc.yml", "delta": "0:00:00.290557", "end": "2017-09-29 05:41:47.587411", "failed": true, "rc": 1, "start": "2017-09-29 05:41:47.296854", "stderr": "The Project \"waiverdb\" is invalid: metadata.annotations[kubectl.kubernetes.io/last-applied-configuration]: Invalid value: \"{\\\"apiVersion\\\":\\\"v1\\\",\\\"kind\\\":\\\"Project\\\",\\\"metadata\\\":{\\\"annotations\\\":{\\\"openshift.io/description\\\":\\\"waiverdb\\\",\\\"openshift.io/display-name\\\":\\\"waiverdb\\\"},\\\"creationTimestamp\\\":null,\\\"name\\\":\\\"waiverdb\\\",\\\"namespace\\\":\\\"\\\"},\\\"spec\\\":{},\\\"status\\\":{}}\\n\": field is immutable, try updating the namespace", "stderr_lines": ["The Project \"waiverdb\" is invalid: metadata.annotations[kubectl.kubernetes.io/last-applied-configuration]: Invalid value: \"{\\\"apiVersion\\\":\\\"v1\\\",\\\"kind\\\":\\\"Project\\\",\\\"metadata\\\":{\\\"annotations\\\":{\\\"openshift.io/description\\\":\\\"waiverdb\\\",\\\"openshift.io/display-name\\\":\\\"waiverdb\\\"},\\\"creationTimestamp\\\":null,\\\"name\\\":\\\"waiverdb\\\",\\\"namespace\\\":\\\"\\\"},\\\"spec\\\":{},\\\"status\\\":{}}\\n\": field is immutable, try updating the namespace"], "stdout": "", "stdout_lines": []}

The temp file in question is the generated output from project.yml. So it's trying to use oc apply on the Project resource.

But if I am understanding correctly, OpenShift does not allow you to oc apply (or in any way modify) Project resources:

https://access.redhat.com/solutions/2677921
https://bugzilla.redhat.com/show_bug.cgi?id=1386401

Most likely, this playbook works the first time you run it. Or if you wipe out the entire project and then let the playbook recreate everything from scratch. But we will need to make the openshift/project role smarter so we can run it on existing projects.


It worked in the past to re-run the playbook, although the openshift/project probably didn't do anything after the first run.

I believe this might be a change between 3.5 and 3.6. I will look into it a bit further. For now, I guess just comment out that role from the playbook?

Metadata Update from @puiterwijk:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

6 years ago

Login to comment on this ticket.

Metadata