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

Adding Prometheus Exporter to Helm Charts #343

Merged
merged 2 commits into from
Jan 11, 2024
Merged

Conversation

0xt3j4s
Copy link
Contributor

@0xt3j4s 0xt3j4s commented Dec 7, 2023

Type

Enhancement


Description

This PR introduces the integration of Prometheus Exporter into the Helm charts of the kubescape-operator. The main changes include:

  • Enabling Prometheus Exporter in the Helm charts.
  • Adding new YAML configuration files for Prometheus Exporter, including deployment, service, service account, network policy, cluster role, and cluster role binding.
  • Updating the values.yaml file to include configurations for Prometheus Exporter.

PR changes walkthrough

Relevant files                                                                                                                                 
Configuration changes
8 files
_helpers.tpl                                                                                               
    charts/kubescape-operator/templates/_helpers.tpl

    Added a new configuration for Prometheus Exporter.
+2/-0
clusterrole.yaml                                                                                       
    charts/kubescape-operator/templates/prometheus-exporter/clusterrole.yaml

    Added a new cluster role for Prometheus Exporter.
+14/-0
clusterrolebinding.yaml                                                                         
    charts/kubescape-operator/templates/prometheus-exporter/clusterrolebinding.yaml

    Added a new cluster role binding for Prometheus Exporter.
+15/-0
deployment.yaml                                                                                         
    charts/kubescape-operator/templates/prometheus-exporter/deployment.yaml

    Added a new deployment configuration for Prometheus
    Exporter.
+82/-0
networkpolicy.yaml                                                                                   
    charts/kubescape-operator/templates/prometheus-exporter/networkpolicy.yaml

    Added a new network policy for Prometheus Exporter.
+39/-0
service.yaml                                                                                               
    charts/kubescape-operator/templates/prometheus-exporter/service.yaml

    Added a new service configuration for Prometheus Exporter.
+19/-0
serviceaccount.yaml                                                                                 
    charts/kubescape-operator/templates/prometheus-exporter/serviceaccount.yaml

    Added a new service account for Prometheus Exporter.
+19/-0
values.yaml                                                                                                 
    charts/kubescape-operator/values.yaml

    Updated the values.yaml file to include configurations for
    Prometheus Exporter.
+24/-0

User description

Type

Enhancement


Description

This PR introduces the integration of Prometheus Exporter into the Helm charts of the kubescape-operator. The main changes include:

  • Enabling Prometheus Exporter in the Helm charts.
  • Adding new YAML configuration files for Prometheus Exporter, including deployment, service, service account, network policy, cluster role, and cluster role binding.
  • Updating the values.yaml file to include configurations for Prometheus Exporter.

PR changes walkthrough

Relevant files                                                                                                                                 
Configuration changes
8 files
_helpers.tpl                                                                                               
    charts/kubescape-operator/templates/_helpers.tpl

    Added a new configuration for Prometheus Exporter.
+2/-0
clusterrole.yaml                                                                                       
    charts/kubescape-operator/templates/prometheus-exporter/clusterrole.yaml

    Added a new ClusterRole for Prometheus Exporter with
    specific rules.
+14/-0
clusterrolebinding.yaml                                                                         
    charts/kubescape-operator/templates/prometheus-exporter/clusterrolebinding.yaml

    Added a new ClusterRoleBinding for Prometheus Exporter.
+15/-0
deployment.yaml                                                                                         
    charts/kubescape-operator/templates/prometheus-exporter/deployment.yaml

    Added a new Deployment configuration for Prometheus
    Exporter.
+82/-0
networkpolicy.yaml                                                                                   
    charts/kubescape-operator/templates/prometheus-exporter/networkpolicy.yaml

    Added a new NetworkPolicy for Prometheus Exporter.
+39/-0
service.yaml                                                                                               
    charts/kubescape-operator/templates/prometheus-exporter/service.yaml

    Added a new Service configuration for Prometheus Exporter.
+19/-0
serviceaccount.yaml                                                                                 
    charts/kubescape-operator/templates/prometheus-exporter/serviceaccount.yaml

    Added a new ServiceAccount for Prometheus Exporter.
+19/-0
values.yaml                                                                                                 
    charts/kubescape-operator/values.yaml

    Updated the values.yaml file to include configurations for
    Prometheus Exporter.
+24/-0
___ ## User description ## Overview - This PR will add the prometheus exporter to the helm charts.

@codiumai-pr-agent-free codiumai-pr-agent-free bot added the enhancement New feature or request label Dec 7, 2023
Copy link

PR Description updated to latest commit (80d39f2)

Copy link

codiumai-pr-agent-free bot commented Dec 7, 2023

PR Analysis

(review updated until commit 8ba1036)

  • 🎯 Main theme: Integration of Prometheus Exporter into the Helm charts of the kubescape-operator
  • 📝 PR summary: This PR introduces Prometheus Exporter into the Helm charts of the kubescape-operator. It includes the addition of new YAML configuration files for the exporter and updates to the values.yaml file to include configurations for the exporter.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 4, because the PR involves changes in multiple files and the addition of new configurations which requires a good understanding of the project and Prometheus Exporter.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The PR is well-structured and the changes are logically grouped. However, it would be beneficial to include tests to verify the integration of the Prometheus Exporter. Additionally, it would be helpful to include more detailed comments in the code to explain the purpose of each configuration.

  • 🤖 Code feedback:
    relevant filecharts/kubescape-operator/templates/prometheus-exporter/deployment.yaml
    suggestion      Consider parameterizing the liveness and readiness probe configurations (like initialDelaySeconds and periodSeconds) in the values.yaml file. This will provide more flexibility to the users of the Helm chart. [medium]
    relevant linelivenessProbe:

    relevant filecharts/kubescape-operator/templates/prometheus-exporter/service.yaml
    suggestion      It would be a good practice to parameterize the service type in the values.yaml file. This will allow users to choose the type of service (like ClusterIP, NodePort, LoadBalancer) based on their requirements. [medium]
    relevant linespec:

    relevant filecharts/kubescape-operator/templates/prometheus-exporter/networkpolicy.yaml
    suggestion      It would be beneficial to parameterize the network policy configurations in the values.yaml file. This will provide more flexibility to the users of the Helm chart. [medium]
    relevant linespec:

    relevant filecharts/kubescape-operator/values.yaml
    suggestion      It would be a good practice to provide default values for all the configurations in the values.yaml file. This will ensure that the Helm chart can be deployed even if the user does not provide all the required configurations. [important]
    relevant lineprometheusExporter:

How to use

Instructions

To invoke the PR-Agent, add a comment using one of the following commands:
/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs: Generate docstring for new components introduced in the PR.
/generate_labels: Generate labels for the PR based on the PR's contents.
see the tools guide for more details.

To edit any configuration parameter from the configuration.toml, add --config_path=new_value.
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, add a /config comment.

Copy link
Contributor

@dwertent dwertent left a comment

Choose a reason for hiding this comment

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

Well done!
Please see my few comments.

In addition, we should add documentation and we should remove the deprecated Prometheus support (currently we support only the kubescape workload).

charts/kubescape-operator/values.yaml Outdated Show resolved Hide resolved
charts/kubescape-operator/values.yaml Show resolved Hide resolved
charts/kubescape-operator/values.yaml Outdated Show resolved Hide resolved
@dwertent
Copy link
Contributor

@0xt3j4s What are the metrics that will be supported? Configuration scanning and image scanning?

@matthyx matthyx marked this pull request as draft December 11, 2023 10:56
@0xt3j4s
Copy link
Contributor Author

0xt3j4s commented Dec 11, 2023

Currently, the metrics support configuration scanning (control metrics) and image scanning (vulnerability metrics).

@dwertent
Copy link
Contributor

@0xt3j4s Can you pls fix the conflicts?

@0xt3j4s 0xt3j4s marked this pull request as ready for review December 14, 2023 13:00
Copy link

PR Description updated to latest commit (8ba1036)

Copy link

Persistent review updated to latest commit 8ba1036

@dwertent dwertent merged commit 86adaef into kubescape:main Jan 11, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants