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

[kube-prometheus-stack] Add downward compat for Prom CRD #4906

Conversation

schnatterer
Copy link
Contributor

What this PR does / why we need it

Running the latest prom-stack versions on legacy OpenShift clusters with no influence on the preinstalled CRDs results in errors such as this:

failed to create typed patch object (..): .spec.scrapeConfigNamespaceSelector: field not declared in schema

This PR provides a workaround using this values.yaml:

prometheus:
  prometheusSpec:
    scrapeConfigNamespaceSelector: null
    scrapeConfigSelectorNilUsesHelmValues: null
    scrapeConfigSelector: null

Yes, this is no ideal solution, but that seems to be what the enterprise-world requires 😐️

At runtime, the operator yields some warnings about the missing fields, but apparently everything else works.

Special notes for your reviewer

As discussed with @jkroepke I'm launching another try to include this feature 🙂

This is the same functionality as in #4818, which unfortunately was reverted in #4883, because it hit a bug in helm helm/helm#12879.

If we go for my original minimally invasive approach, there is no breaking change we won't cause #4878 again.

It won't work for sub charts (because of aforementioned bug in helm) but at least for direct users of kps chart.

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

… fields

Running the latest prom-stack versions on legacy OpenShift clusters with no influence on the preinstalled CRDs results in errors such as this:

failed to create typed patch object (..): .spec.scrapeConfigNamespaceSelector: field not declared in schema

This patch provides a workaround using this values.yaml:

prometheus:
  prometheusSpec:
    scrapeConfigNamespaceSelector: null
    scrapeConfigSelectorNilUsesHelmValues: null
    scrapeConfigSelector: null

Signed-off-by: Johannes Schnatterer <[email protected]>
Signed-off-by: Johannes Schnatterer <[email protected]>
Signed-off-by: Johannes Schnatterer <[email protected]>
@schnatterer schnatterer force-pushed the feature/downward-compat-prom-crd-2 branch from 104aee9 to cd1fcca Compare October 16, 2024 11:13
@jkroepke
Copy link
Member

@QuentinBisson please double check this, LGTM

Copy link
Member

@QuentinBisson QuentinBisson left a comment

Choose a reason for hiding this comment

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

LGTM as well

@jkroepke jkroepke merged commit 30ae44d into prometheus-community:main Oct 24, 2024
4 checks passed
@schnatterer
Copy link
Contributor Author

Thank you @jkroepke and @QuentinBisson for your support!

schnatterer added a commit to cloudogu/gitops-playground that referenced this pull request Nov 21, 2024
This allows avoiding errors with skipCrds:

failed to create typed patch object (..): .spec.scrapeConfigNamespaceSelector: field not declared in schema

due to preinstalled legacy CRDs.

To do so, set the following via features.monitoring.values:

prometheus:
  prometheusSpec:
    scrapeConfigNamespaceSelector: null
    scrapeConfigSelectorNilUsesHelmValues: null
    scrapeConfigSelector: null

See also
prometheus-community/helm-charts#4906
schnatterer added a commit to cloudogu/gitops-playground that referenced this pull request Nov 21, 2024
This allows avoiding errors with skipCrds:

failed to create typed patch object (..): .spec.scrapeConfigNamespaceSelector: field not declared in schema

due to preinstalled legacy CRDs.

To do so, set the following via features.monitoring.values:

prometheus:
  prometheusSpec:
    scrapeConfigNamespaceSelector: null
    scrapeConfigSelectorNilUsesHelmValues: null
    scrapeConfigSelector: null

See also
prometheus-community/helm-charts#4906
schnatterer added a commit to cloudogu/gitops-playground that referenced this pull request Nov 21, 2024
This allows avoiding errors with skipCrds:

failed to create typed patch object (..): .spec.scrapeConfigNamespaceSelector: field not declared in schema

due to preinstalled legacy CRDs.

To do so, set the following via features.monitoring.values:

prometheus:
  prometheusSpec:
    scrapeConfigNamespaceSelector: null
    scrapeConfigSelectorNilUsesHelmValues: null
    scrapeConfigSelector: null

See also
prometheus-community/helm-charts#4906
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.

3 participants