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

update helm default chart name and namespace values #589

Merged
merged 1 commit into from
Mar 31, 2021

Conversation

williepaul
Copy link
Contributor

  • this changes the helm chart default name/namespace values to match a default deployment of a given helm chart

- this changes the helm chart default name/namespace values to match a default deployment of a given helm chart
@sonarcloud
Copy link

sonarcloud bot commented Mar 6, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Mar 6, 2021

Codecov Report

Merging #589 (2c2b8bd) into master (71a677f) will increase coverage by 1.79%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #589      +/-   ##
==========================================
+ Coverage   77.65%   79.45%   +1.79%     
==========================================
  Files         102      104       +2     
  Lines        2524     2964     +440     
==========================================
+ Hits         1960     2355     +395     
- Misses        420      446      +26     
- Partials      144      163      +19     
Impacted Files Coverage Δ
pkg/iac-providers/helm/v3/load-dir.go 85.61% <100.00%> (+0.09%) ⬆️
pkg/iac-providers/kubernetes/v1/load-dir.go 80.95% <0.00%> (-2.39%) ⬇️
pkg/policy/all.go 100.00% <0.00%> (ø)
pkg/runtime/rules.go 100.00% <0.00%> (ø)
pkg/policy/cloud-providers.go 100.00% <0.00%> (ø)
pkg/utils/category.go 100.00% <0.00%> (ø)
pkg/utils/policy.go 50.00% <0.00%> (ø)
pkg/config/config-reader.go 86.36% <0.00%> (+0.64%) ⬆️
pkg/cli/register.go 6.25% <0.00%> (+0.69%) ⬆️
pkg/cli/scan.go 70.83% <0.00%> (+1.26%) ⬆️
... and 12 more

Name: defaultChartName,
Namespace: chartName + "-namespace",
Name: chartName,
Namespace: defaultNamespaceName,
Copy link
Contributor

Choose a reason for hiding this comment

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

Would Namespace always be default? Why did we previously have this value equal to chartName + "-namespace"? I am just trying to understand how is this change affecting terrascan? and what are the repercussions of not having this.

Copy link
Contributor Author

@williepaul williepaul Mar 7, 2021

Choose a reason for hiding this comment

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

Good question. When first adding Helm support, I was not sure where the name field was being pulled from. I remember wanting to use the original chart name, but from the usage in some of their unit tests, it looked arbitrary. While working on some drift mapping fixes, I noticed Helm really was using the Chart name in this field, and hence the name change.

As for the namespace change, "default" is just used by default. However, as you might have wondered, it may be set to something else. Helm takes a namespace command as input, and that namespace specified on the command line is what is fed into this value. We don't currently have a way of passing variables into our provider implementations, but I think we should add some option to do so, for example -Dkey=value, where in this case a user could specify something like -Dnamespace=mynamespace. It's important to us, since without a way to do this, we will not be able to map resources in custom namespaces correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

@williepaul , I am wondering, is PR partially fixing the problem? And the complete solution would be to accept options from the user and to exact mappings?

Copy link
Contributor

Choose a reason for hiding this comment

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

What Willie and I were trying to figure out when looking at this last week: helm by default will use the namespace of the current kubernetes context. So how do we map that into a static scan?

Copy link
Contributor Author

@williepaul williepaul Mar 9, 2021

Choose a reason for hiding this comment

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

@kanchwala-yusuf that is correct. A complete solution should take in command line input with data to replace the chart name and namespace as needed. However, these values are suitable defaults, and are currently needed and used by the k8s scan and drift mapping...

Let's put it this way--these defaults are more suitable than the current ones, up until we have implemented the optional overrides from the command line

@devang-gaur devang-gaur merged commit 538b9ed into tenable:master Mar 31, 2021
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.

None yet

4 participants