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

recognize metadata.generateName #465

Merged
merged 1 commit into from
Jan 13, 2021
Merged

recognize metadata.generateName #465

merged 1 commit into from
Jan 13, 2021

Conversation

acc-jon
Copy link
Contributor

@acc-jon acc-jon commented Jan 10, 2021

As described at https://kubernetes.io/docs/reference/using-api/api-concepts/#generated-values, the metadata.name may sometimes be generated based on metadata.generateName. Dynamically generated names are populated with unique values at runtime, meaning that metadata.name might be empty when Terrascan is run. This change uses the value of metadata.generateName for the name when metadata.name is empty. This can help, for example, with CRDs that rely on generateName.

@sonarcloud
Copy link

sonarcloud bot commented Jan 10, 2021

SonarCloud Quality Gate failed.

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
49.1% 49.1% Duplication

@codecov
Copy link

codecov bot commented Jan 10, 2021

Codecov Report

Merging #465 (8b2528e) into master (45a7885) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #465      +/-   ##
==========================================
+ Coverage   74.69%   74.73%   +0.03%     
==========================================
  Files          88       88              
  Lines        2039     2042       +3     
==========================================
+ Hits         1523     1526       +3     
  Misses        382      382              
  Partials      134      134              
Impacted Files Coverage Δ
pkg/iac-providers/kubernetes/v1/normalize.go 88.05% <100.00%> (+0.55%) ⬆️

@jlk
Copy link
Contributor

jlk commented Jan 13, 2021

The duplicate code doesn't look like an issue to me - it looks like it's mainly the expected result from unit tests. I guess you could try to define that as a struct and then change the bits for each test, but that seems like over-engineering...

@williepaul
Copy link
Contributor

SonarCloud has a different mode for analyzing source vs test files, will check how to configure that.

@williepaul williepaul merged commit 2272168 into master Jan 13, 2021
@williepaul williepaul deleted the k8s-generateName branch January 13, 2021 17:30
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

3 participants