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

Unable to create serviceMonitor from Helm chart with Kustomize #4247

Closed
stoupance opened this issue Oct 18, 2021 · 2 comments
Closed

Unable to create serviceMonitor from Helm chart with Kustomize #4247

stoupance opened this issue Oct 18, 2021 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@stoupance
Copy link

stoupance commented Oct 18, 2021

Describe the bug

I'm trying to use Kustomize to inflate the Helm chart of ingress-nginx in order to add the serviceMonitor and prometheusRule sections, for monitoring purposes. It is disabled by default in the provided helmChart, but it can be overrided as a native chart values.
The YAML built by Kustomize outputs the prometheusRule section as expected but not the serviceMonitor one. I tried multiple configurations and nothing output any YAML configuration for serviceMonitor

To put aside any issue from Helm itself, it works perfectly with a vanilla Helm (output YAML for both serviceMonitor and prometheusRule) but not when using Kustomize ontop of Helm.

Files that can reproduce the issue

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

helmCharts:
- name: ingress-nginx
  valuesInline:
    controller:
      metrics:
        enabled: true
        serviceMonitor:
          enabled: true
        prometheusRule:
          enabled: true
  version: 4.0.6
  repo: https://kubernetes.github.io/ingress-nginx
  releaseName: xxx

or

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
metadata:
  name: ingress-nginx
generators:
  - generators.yaml

generators.yaml

apiVersion: builtin
kind: HelmChartInflationGenerator
metadata:
  name: nginx
name: ingress-nginx
repo: https://kubernetes.github.io/ingress-nginx
releaseName: xxx
valuesFile: values.yaml

value.yaml

controller:
  metrics:
    enabled: true
    serviceMonitor:
      enabled: true
    prometheusRule:
      enabled: true

Expected output

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: toto-ingress-nginx-controller
  labels:
    helm.sh/chart: ingress-nginx-4.0.6
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: xxx
    app.kubernetes.io/version: "1.0.4"
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: controller
spec:
  endpoints:
    - port: metrics
      interval: 30s
  namespaceSelector:
    matchNames:
      - default
  selector:
    matchLabels:
      app.kubernetes.io/name: ingress-nginx
      app.kubernetes.io/instance: xxx
      app.kubernetes.io/component: controller

Actual output

The output doesn't have any serviceMonitor YAML section as expected but still contains the rest of the YAML manifests (Service, Deployment, ClusterRole...)

Kustomize version

{Version:kustomize/v4.4.0 GitCommit:63ec6bdb3d737a7c66901828c5743656c49b60e1 BuildDate:2021-09-27T16:24:12Z GoOs:linux GoArch:amd64}

Platform

Linux

Additional context

It doesn't work for both Kustomize configurations provided and it works when using only Helm. Sadly, there is no error and.
Any help will be greatly appreciated. Thanks!

@stoupance stoupance added the kind/bug Categorizes issue or PR as related to a bug. label Oct 18, 2021
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 18, 2021
@k8s-ci-robot
Copy link
Contributor

@stoupance: This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@stoupance
Copy link
Author

Issue not related to Kustomize but how the helm chart was build. PR here -> kubernetes/ingress-nginx#7829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

2 participants