Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add openshift-tekton-resources integration #1892

Merged
merged 20 commits into from Nov 16, 2021

Conversation

rporres
Copy link
Contributor

@rporres rporres commented Oct 4, 2021

https://issues.redhat.com/browse/APPSRE-3389
Design doc: https://gitlab.cee.redhat.com/service/app-interface/-/blob/master/docs/app-sre/design-docs/openshift-tekton-resources-integration.md

This work has been split in two

  1. The new integration in this PR
  2. The openshift-saas-deploy bits in Openshift-tekton-resources: the saasherder part #1998

We will first merge this one, verify that everything goes well and then merge the other.

Related schema changes

See app-sre/qontract-schemas#9

Current testing includes:

  • Creation/modification/deletion of Pipelines and Tasks
  • Coexistence with current coexistence of openshift-resources managed objects
  • Dry-run creation of openshit-saas-deploy related PipelineRuns
  • Do not create PipelineRuns if no correspondent openshift-saas-deploy objects do not exist

Current testing does not include

  • Creation of PipelineRuns and check that deployments actually work, since it needs access to an up to date qontract-server

Request and limits defaults

The variability is always in the openshift-saas-deploy step task. The rest consume a very low amount of resources. A minimum of 20Mb of memory has been assigned to avoid pod creation issues.

I have gathered a fair amount of openshift-saas-deploy metric pods examples that have been used to generate defaults. The outliers will need to be configured at a saas file level. Find examples in the related JIRA issue

Method documentation

Since the new integration uses type hints, I haven't added parameter related documentation of the methods. Let me know if that's a problem and I will add it.

Signed-off-by: Rafa Porres Molina rporresm@redhat.com

EDIT: Split PR in two.

@rporres
Copy link
Contributor Author

rporres commented Oct 4, 2021

package_data does not support recursive globs: pypa/setuptools#1806

@Piojo
Copy link
Contributor

Piojo commented Oct 5, 2021

Nothing major stands out, but can we add some unit tests? The one thing that will get in your way is the fetching of settings in __init__ - you can mock away the entire constructor with testslide if that's problematic.

@rporres
Copy link
Contributor Author

rporres commented Oct 5, 2021

do you mean more tests apart to those that are in reconcile/test/test_openshift_tekton_resources.py?

My main worry here is how the dependency with openshift_resources_base.py is not tested. If I'm honest I don't have yet an idea on how to test that module, but it is in my personal roadmap. Since it is used by a few integrations, it makes sense to add them but I think it is a bit out of the scope of this particular MR. I can create a JIRA to track it.

Copy link
Contributor

@Piojo Piojo left a comment

Choose a reason for hiding this comment

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

Sorry, I had forgotten to press "submit" on my comments. :|

reconcile/openshift_resources_base.py Outdated Show resolved Hide resolved
reconcile/openshift_saas_deploy_trigger_base.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
@Piojo
Copy link
Contributor

Piojo commented Oct 5, 2021

My main worry here is how the dependency with openshift_resources_base.py

While ob.realize_data isn't tested, tests are coming for init_specs_to_fetch in #1868 - or whatever incarnation we choose for it.

We could use some unit tests around _build_tkn_namespaces, in particular confirm that we skip non-tekton providers and that the resourceNames for pipelines and tasks are introduced in the right locations. I see myself screwing that up.

If you open a ticket for that I'm satisfied.

@maorfr
Copy link
Contributor

maorfr commented Oct 6, 2021

as discussed, perhaps it would be more consistent to use openshift_base instead of openshift_resources_base (which is for integrations getting their data from the openshiftResources section).

@rporres
Copy link
Contributor Author

rporres commented Oct 6, 2021

  • ok with not using openshift_resources_base functions.
  • also ok with moving templates and template settings into its own schema

I'll get back to https://gitlab.cee.redhat.com/service/app-interface/-/merge_requests/26409

reconcile/openshift_resources_base.py Outdated Show resolved Hide resolved
reconcile/openshift_saas_deploy_trigger_base.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Piojo Piojo left a comment

Choose a reason for hiding this comment

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

You've addressed all comments except for a trivial one around type hints. Approving to unblock you ASAP.

@rporres
Copy link
Contributor Author

rporres commented Oct 25, 2021

Thx @Piojo. This went back to development due to #1892 (comment) (whenever I have time for it)

@rporres rporres changed the title Add openshift-tekton-resources integration WIP: Add openshift-tekton-resources integration Oct 25, 2021
@rporres
Copy link
Contributor Author

rporres commented Nov 3, 2021

@maorfr This is ready for a preliminary review. Style wise things to fix are:

  • Missing tests fixed in aeb28ab
  • The section that builds the desired state is too big, I should try to refactor in smaller pieces Fixed in 5e253e7
  • No exception handling and no custom exceptions fixed in 7eac1c3
  • No type hints Fixed in 58c3f4f
  • I may review the idea of making a runner class as it is not giving much. I'll see when I write tests again. Fixed in a49d55c

Functionally wise I will need to take a look to the schema to make sure we don't allow for names that are too long Fixed in app-sre/qontract-schemas@bde4e6e and 0342941

Related schema changes in: app-sre/qontract-schemas#9

Copy link
Contributor

@Piojo Piojo left a comment

Choose a reason for hiding this comment

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

Can we have some unit tests at least for the auxiliary methods in the openshift_tekton_resources integration?

reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Show resolved Hide resolved
reconcile/openshift_tekton_resources.py Show resolved Hide resolved
@rporres
Copy link
Contributor Author

rporres commented Nov 9, 2021

Thx for the review, @Piojo . It was still marked as WIP as tests are missing. I will add them.

@rporres rporres changed the title WIP: Add openshift-tekton-resources integration Add openshift-tekton-resources integration Nov 11, 2021
@rporres
Copy link
Contributor Author

rporres commented Nov 11, 2021

Tests added, this is ready for review now.

@rporres rporres force-pushed the openshift-tekton-resources branch 2 times, most recently from db3e15f to b72821f Compare November 11, 2021 15:12
@rporres
Copy link
Contributor Author

rporres commented Nov 11, 2021

conflicts resolved

reconcile/test/test_openshift_tekton_resources.py Outdated Show resolved Hide resolved
reconcile/test/test_openshift_tekton_resources.py Outdated Show resolved Hide resolved
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
@rporres
Copy link
Contributor Author

rporres commented Nov 15, 2021

Removed openshift-saas-deploy saasherder stuff in 613b835 and created a new PR in #1998

@rporres rporres merged commit 05471e3 into app-sre:master Nov 16, 2021
@rporres rporres deleted the openshift-tekton-resources branch November 16, 2021 12:19
rporres added a commit to rporres/qontract-reconcile that referenced this pull request Nov 19, 2021
We have divided the work for openshift-tekton-resources in two parts:

1) The new integration in app-sre#1892
2) The saasherder bits here. They include logic to make sure that names
   for the resources created by the new integration are correctly
   referenced from openshift-saas-deploy integrations and dealing with a
   race condition on the new objects not yet existing (a recently
   created saas file).

This is part of APPSRE-3389

Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
rporres added a commit that referenced this pull request Nov 19, 2021
We have divided the work for openshift-tekton-resources in two parts:

1) The new integration in #1892
2) The saasherder bits here. They include logic to make sure that names
   for the resources created by the new integration are correctly
   referenced from openshift-saas-deploy integrations and dealing with a
   race condition on the new objects not yet existing (a recently
   created saas file).

This is part of APPSRE-3389

Signed-off-by: Rafa Porres Molina <rporresm@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants