Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

ROLE: openshift-patch-resource - patch a k8s/openshift resource #386

Merged
merged 3 commits into from
Dec 2, 2019

Conversation

pabrahamsson
Copy link
Contributor

What does this PR do?

Let's you patch a k8s/openshift resource with either strategic-merge or merge strategy

How should this be manually tested?

cd tests && ansible-playbook -i inventory test.yml
                                                                                                         
PLAY [localhost] **************************************************************************************************************************************************
                                                                                                                                                                   
TASK [Patch annotations on default project (strategic-merge strategy)] ********************************************************************************************
Monday 02 December 2019  13:38:12 -0500 (0:00:00.120)       0:00:00.120 *******                                                                                    
                                                                                                                                                                   
TASK [openshift-patch-resource : Patch v1 Namespace/default] ******************************************************************************************************
Monday 02 December 2019  13:38:12 -0500 (0:00:00.254)       0:00:00.375 ******* 
changed: [localhost]

TASK [Get annotated namespace] ************************************************************************************************************************************
Monday 02 December 2019  13:38:15 -0500 (0:00:02.902)       0:00:03.278 ******* 
ok: [localhost]

TASK [Assert namespace was labelled] ******************************************************************************************************************************
Monday 02 December 2019  13:38:17 -0500 (0:00:02.412)       0:00:05.690 ******* 
ok: [localhost] => {
    "changed": false,
    "msg": "There's one namespace with the label 'patch-role: patched'"
}

TASK [Remove patch-role label (merge strategy)] *******************************************************************************************************************
Monday 02 December 2019  13:38:17 -0500 (0:00:00.032)       0:00:05.723 ******* 

TASK [openshift-patch-resource : Patch v1 Namespace/default] ******************************************************************************************************
Monday 02 December 2019  13:38:17 -0500 (0:00:00.040)       0:00:05.763 ******* 
changed: [localhost]

TASK [Get annotated namespace] ************************************************************************************************************************************
Monday 02 December 2019  13:38:19 -0500 (0:00:01.917)       0:00:07.681 ******* 
ok: [localhost]

TASK [Assert namespace label was removed] *************************************************************************************************************************
Monday 02 December 2019  13:38:21 -0500 (0:00:01.948)       0:00:09.630 ******* 
ok: [localhost] => {
    "changed": false,
    "msg": "There's no namespace with the label 'patch-role: patched'"
}

PLAY RECAP ********************************************************************************************************************************************************
localhost                  : ok=6    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Is there a relevant Issue open for this?

Provide a link to any open issues that describe the problem you are solving.

Use resolves #<pr-number> to auto-close at merge time

Other Relevant info, PRs, etc.

Please provide link to other PRs that may be related (blocking, resolves, etc.)

Who would you like to review this?

cc: @redhat-cop/casl

Copy link
Contributor

@oybed oybed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good ... a few minor comments on the README

| api_version | The api_version of the resource | yes ||
| definition | The patch definition | yes ||
| kind | The kind of the resource | yes ||
| merge_type | A list of merge types ("strategic-merge, merge") | no | strategic-merge |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a link to the ansible k8s module in the defaults column (maybe as just a link when clicking strategic-merge) to indicate that the default is coming from the actual module (i.e.: not set by this role).

Requirements
------------

This role requires the `kubernetes` python module
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also mentioned a "valid" or "active" session to an OpenShift (or k8s) cluster as a requirement?

| name | The name of the resource | yes ||
| namespace | The namespace of the resource | no ||

Example Playbook
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we include some example vars here as well? ... or maybe just point to the tests to see some examples?

@pabrahamsson
Copy link
Contributor Author

Thank you @oybed, updated the README based on your feedback

Copy link
Contributor

@oybed oybed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@oybed oybed merged commit 225f203 into redhat-cop:master Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants