-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(manager/helm-values): add image support in helm values manager #29828
Open
KyriosGN0
wants to merge
8
commits into
renovatebot:main
Choose a base branch
from
KyriosGN0:feat/add-image-support-in-helm-values-manager
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+96
−4
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
06921d6
add check for if image or repostiry in matchesHelmValuesDockerHeuristic
KyriosGN0 53b24f3
fix by pnpm lint-fix
KyriosGN0 a5f9bf3
add support for image in helm-values manager
KyriosGN0 3fa4fa6
fix lint issues
KyriosGN0 1319af0
updated readme for helm-values
KyriosGN0 d54b975
added return null if both image and repository are undefined
KyriosGN0 6d6112c
remove extra line in readme
KyriosGN0 b13d7f7
add test
KyriosGN0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
lib/modules/manager/helm-values/__fixtures__/values_with_image_instead_of_repo.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Default values for test-chart. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
replicaCount: 1 | ||
|
||
image: | ||
repo: nginx | ||
tag: 1.16.1 | ||
pullPolicy: IfNotPresent | ||
|
||
imagePullSecrets: [] | ||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
serviceAccount: | ||
# Specifies whether a service account should be created | ||
create: true | ||
# The name of the service account to use. | ||
# If not set and create is true, a name is generated using the fullname template | ||
name: | ||
|
||
podSecurityContext: {} | ||
# fsGroup: 2000 | ||
|
||
securityContext: {} | ||
# capabilities: | ||
# drop: | ||
# - ALL | ||
# readOnlyRootFilesystem: true | ||
# runAsNonRoot: true | ||
# runAsUser: 1000 | ||
|
||
service: | ||
type: ClusterIP | ||
port: 80 | ||
|
||
ingress: | ||
enabled: false | ||
annotations: {} | ||
# kubernetes.io/ingress.class: nginx | ||
# kubernetes.io/tls-acme: "true" | ||
hosts: | ||
- host: chart-example.local | ||
paths: [] | ||
|
||
tls: [] | ||
# - secretName: chart-example-tls | ||
# hosts: | ||
# - chart-example.local | ||
|
||
resources: {} | ||
# We usually recommend not to specify default resources and to leave this as a conscious | ||
# choice for the user. This also increases chances charts run on environments with little | ||
# resources, such as Minikube. If you do want to specify resources, uncomment the following | ||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. | ||
# limits: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
# requests: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,10 @@ const helmMultiAndNestedImageValues = Fixtures.get( | |
'multi_and_nested_image_values.yaml', | ||
); | ||
|
||
const helmImageInsteadOfRepository = Fixtures.get( | ||
'values_with_image_instead_of_repo.yaml', | ||
); | ||
|
||
Comment on lines
+14
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. inline to test |
||
const config = partial<ExtractConfig>({}); | ||
|
||
const configAliases = partial<ExtractConfig>({ | ||
|
@@ -108,5 +112,14 @@ describe('modules/manager/helm-values/extract', () => { | |
], | ||
}); | ||
}); | ||
|
||
it('return null if image and repo are not defined', () => { | ||
const result = extractPackageFile( | ||
helmImageInsteadOfRepository, | ||
packageFile, | ||
config, | ||
); | ||
expect(result).toBeNull(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,10 +48,16 @@ | |
Object.entries(parsedContent).forEach(([key, value]) => { | ||
if (matchesHelmValuesDockerHeuristic(key, value)) { | ||
const currentItem = value; | ||
|
||
let registry = currentItem.registry; | ||
registry = registry ? `${registry}/` : ''; | ||
const repository = String(currentItem.repository); | ||
if ( | ||
currentItem.repository === undefined && | ||
currentItem.image === undefined | ||
) { | ||
logger.debug('repository and image are both undefined'); | ||
KyriosGN0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs a test |
||
} | ||
const repository = `${currentItem.repository ?? currentItem.image}`; | ||
const tag = `${currentItem.tag ?? currentItem.version}`; | ||
packageDependencies.push(getHelmDep(registry, repository, tag, config)); | ||
} else if (matchesHelmValuesInlineImage(key, value)) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduce to minimal size and inline to test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean to inline? i should remove the file and pass the values in the test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes