Skip to content

Fix problems when enabling eks platform patch #1675

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

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

sikachu
Copy link
Contributor

@sikachu sikachu commented Mar 10, 2022

Description

This PR fixes a problem where users are unable to generate k8s manifests when they enable platform: 'eks' in their libsonnet configuration.

An attempt for fixing this has been made in #1286, but it tried to fix all the platforms at once including the documentation. However, in this PR, I would like to focus on just fixing the problem when enabling platform: 'eks' part.

Without this patch, user will get an error when they enable platform: 'eks' part like this:

local kp = (import 'kube-prometheus/main.libsonnet') + {
  values+:: {
    common+: {
      namespace: 'monitoring',
      platform: 'eks',
    },
  },
};
RUNTIME ERROR: Field does not exist: _config
	vendor/kube-prometheus/addons/aws-vpc-cni.libsonnet:80:17-37	
	Field "labels"	
	Field "metadata"	
	Field "resources/kubernetes-prometheusRuleAwsVpcCni"	
	During manifestation

To fix the problem, this patch passes $.values to make those values available for the platform patches. Then, in aws-vpc-cni.libsonnet, I changed those $.prometheus to use values from $.values or just hard-coded alternate values instead.

I think I will submit follow-up patch to update documentation where necessary to reflect the fact that you need to set platform: inside the common object, after this PR is merged.

By the way, this is the first time for me to work with Jsonnet and kube-prometheus codebase, so please feel free to give me feedback if I misunderstood anything. Thank you very much.

Type of change

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Changelog entry

- Fixes a problem when enabling EKS platform patch.

Comment on lines +80 to +84
labels: {
'app.kubernetes.io/name': 'prometheus-vpc-cni-rules',
'app.kubernetes.io/component': 'prometheus',
'app.kubernetes.io/part-of': 'kube-prometheus',
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this part, I couldn't find a good replacement for this as we no longer have access to $.prometheus in this scope. Please let me know if you have any suggestions on how this can be improved so we don't have to hard-coded these values here.

Copy link
Member

@paulfantom paulfantom left a comment

Choose a reason for hiding this comment

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

lgtm

@philipgough philipgough merged commit bbdb94a into prometheus-operator:main Apr 14, 2022
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