Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

[KOGITO-2960] - Prometheus integration with kogito-cloud-operator #521

Merged
merged 13 commits into from Sep 2, 2020
Merged

[KOGITO-2960] - Prometheus integration with kogito-cloud-operator #521

merged 13 commits into from Sep 2, 2020

Conversation

vaibhavjainwiz
Copy link
Contributor

@vaibhavjainwiz vaibhavjainwiz commented Aug 18, 2020

Jira issue : https://issues.redhat.com/browse/KOGITO-2960

Many thanks for submiting your Pull Request ❤️!

Please make sure that your PR meets the following requirements:

  • You have read the contributors' guide
  • Pull Request title is properly formatted: [KOGITO-XYZ] Subject
  • Pull Request contains link to the JIRA issue
  • Pull Request contains description of the issue
  • Pull Request does not include fixes for issues other than the main ticket
  • Your feature/bug fix has a unit test that verifies it
  • You've tested the new feature/bug fix in an actual OpenShift cluster

@kie-ci-bot kie-ci-bot bot added cli 💻 Pull Request related to cli code base needs review 🔍 Pull Request that needs reviewers operator ☁️ Pull Request related to kogito-operator code base labels Aug 18, 2020
@kie-ci-bot
Copy link

kie-ci-bot bot commented Aug 18, 2020

/jenkins test

@codecov
Copy link

codecov bot commented Aug 18, 2020

Codecov Report

Merging #521 into master will decrease coverage by 4.40%.
The diff coverage is 19.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #521      +/-   ##
==========================================
- Coverage   42.01%   37.60%   -4.41%     
==========================================
  Files         169      162       -7     
  Lines        9012     7933    -1079     
==========================================
- Hits         3786     2983     -803     
+ Misses       4812     4602     -210     
+ Partials      414      348      -66     
Flag Coverage Δ
#cli 55.56% <61.34%> (+0.58%) ⬆️
#operator 31.60% <9.63%> (-6.98%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/kogito/command/flag/build_flag.go 0.00% <0.00%> (ø)
cmd/kogito/command/flag/monitoring_flag.go 0.00% <0.00%> (ø)
cmd/kogito/command/flag/runtime_flag.go 0.00% <0.00%> (ø)
cmd/kogito/command/flag/runtimetype_flag.go 0.00% <ø> (ø)
cmd/kogito/command/flag/webhook_flag.go 0.00% <ø> (ø)
cmd/kogito/command/service/build_service.go 0.00% <0.00%> (ø)
cmd/kogito/command/service/runtime_service.go 0.00% <0.00%> (ø)
cmd/kogito/command/shared/install_services.go 0.00% <0.00%> (ø)
pkg/apis/app/v1alpha1/conditions.go 89.47% <ø> (ø)
pkg/apis/app/v1alpha1/kogitobuild_types.go 20.00% <0.00%> (-80.00%) ⬇️
... and 70 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35f4b52...d611316. Read the comment docs.

Copy link
Member

@ricardozanini ricardozanini left a comment

Choose a reason for hiding this comment

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

Thanks Jain! Looks good, I'm just curious about this "custom_writer/reader" that you created, mimicking what we already have on client package, but with this swtich case to verify if it's a Prometheus object or not. Why we need it? I believe we can think on something different to reuse the existing functions.

EDIT: I'm not seeing an update in the openapi generated file. Can you please confirm that you executed the openapi binary? Also, were you able to test this integration with the Prometheus Operator on minikube/crc?

deploy/operator.yaml Outdated Show resolved Hide resolved
pkg/controller/kogitoruntime/deployer.go Outdated Show resolved Hide resolved
pkg/infrastructure/services/custom_reader.go Outdated Show resolved Hide resolved
pkg/infrastructure/services/custom_writer.go Outdated Show resolved Hide resolved
@ricardozanini
Copy link
Member

/jenkins test

@ricardozanini ricardozanini added this to the v0.15.0 milestone Aug 18, 2020
@kie-ci-bot
Copy link

kie-ci-bot bot commented Aug 18, 2020

Change detected in the PR, requesting reviews and running pipeline(if required) again

@kie-ci-bot
Copy link

kie-ci-bot bot commented Aug 18, 2020

/jenkins test

@kie-ci-bot
Copy link

kie-ci-bot bot commented Aug 18, 2020

Change detected in the PR, requesting reviews and running pipeline(if required) again

@kie-ci-bot
Copy link

kie-ci-bot bot commented Aug 18, 2020

/jenkins test

1 similar comment
@ricardozanini
Copy link
Member

/jenkins test

@vaibhavjainwiz
Copy link
Contributor Author

vaibhavjainwiz commented Aug 19, 2020

Thanks Jain! Looks good, I'm just curious about this "custom_writer/reader" that you created, mimicking what we already have on client package, but with this swtich case to verify if it's a Prometheus object or not. Why we need it? I believe we can think on something different to reuse the existing functions.

@ricardozanini
ServiceMonitor is Prometheus operator object so to read/write its value we have to use prometheus client.
Currently we are following below approach :

  1. Generate all requested resource
  2. Use controller client reader to load all deployed resource
  3. Use controller client writer to update all delta resource

Code is written to work with controller client only that why I had written custom reader/writer object which receive complete Client reference and at runtime decides which client(Controller/Prometheus) to use to load/update objects.

custom_reader calls when we say reader.ListAll(objectTypes...) under getDeployedResources() method
custom_writer call when we say writer.Add/Update/DeleteResources(delta.Added);

EDIT: I'm not seeing an update in the openapi generated file. Can you please confirm that you executed the openapi binary?

Following auto-generated files are included in change list :

  • app.kiegroup.org_kogitoruntimes_crd.yaml
  • app.kiegroup.org_kogitoruntimes_crd.yaml
  • kogito-operator.v1.0.0-snapshot.clusterserviceversion.yaml
  • app.kiegroup.org_kogitoruntimes_crd.yaml
  • kogito-operator.clusterserviceversion.yaml
  • zz_generated.deepcopy.go

Also, were you able to test this integration with the Prometheus Operator on minikube/crc?

I tried it on OC cluster. This PR has successfully generates ServiceMonitor object/stats under Prometheus Operator for all kogito-runtime which pass scrap flag as true.

image

image

@vaibhavjainwiz
Copy link
Contributor Author

/jenkins test

@kie-ci-bot
Copy link

kie-ci-bot bot commented Aug 19, 2020

Change detected in the PR, requesting reviews and running pipeline(if required) again

@kie-ci-bot
Copy link

kie-ci-bot bot commented Aug 19, 2020

/jenkins test

@ricardozanini
Copy link
Member

Code is written to work with controller client only that why I had written custom reader/writer object which receive complete
Client reference and at runtime decides which client(Controller/Prometheus) to use to load/update objects.

Hi!

My point is that this interface of "custom resources" that you created is basically this:

https://github.com/kiegroup/kogito-cloud-operator/blob/master/pkg/client/kubernetes/resource.go

Excepts that you are adding a condition of "if is prometheus resource". I'm suggesting to change this to have one interface doing the wrapper around the client that is smart enough to handle Prometheus resources as well.

@ricardozanini
Copy link
Member

@spolti @sutaakar @Kaitou786 could you guys please take a look in this PR?

Copy link
Member

@spolti spolti left a comment

Choose a reason for hiding this comment

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

approving, but left a comment about the flags used.

cmd/kogito/command/flag/prometheus_flag.go Outdated Show resolved Hide resolved
[KOGITO-2960] - Incorporate review comments

[KOGITO-2960] - Incorporate review comments

[KOGITO-2960] - Incorporate review comments

[KOGITO-2960] - Incorporate review comments

[KOGITO-2960] - Incorporate review comments
Copy link
Member

@ricardozanini ricardozanini left a comment

Choose a reason for hiding this comment

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

@vaibhavjainwiz I'm assuming you're going to update the "prometheus" name from the public interface to "monitoring" instead, right?

@kie-ci-bot
Copy link

kie-ci-bot bot commented Sep 1, 2020

Change detected in the PR, requesting reviews and running pipeline(if required) again

@vaibhavjainwiz
Copy link
Contributor Author

@vaibhavjainwiz I'm assuming you're going to update the "prometheus" name from the public interface to "monitoring" instead, right?

yes..already done

@kie-ci-bot
Copy link

kie-ci-bot bot commented Sep 1, 2020

Change detected in the PR, requesting reviews and running pipeline(if required) again

@kie-ci-bot
Copy link

kie-ci-bot bot commented Sep 2, 2020

Change detected in the PR, requesting reviews and running pipeline(if required) again

@ricardozanini ricardozanini added ready 🚀 PR is ready to be merged and removed needs review 🔍 Pull Request that needs reviewers labels Sep 2, 2020
@ricardozanini ricardozanini merged commit 1ea35e8 into apache:master Sep 2, 2020
@vaibhavjainwiz vaibhavjainwiz deleted the KOGITO-2960 branch September 9, 2020 06:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli 💻 Pull Request related to cli code base operator ☁️ Pull Request related to kogito-operator code base ready 🚀 PR is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants