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

feat: Extra Helm values from external git repo #5826 #6280

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f3a1c6b
fix: jq installation arm
KaiReichart May 19, 2021
0cccb8c
Merge branch 'fix_arm_docker_build'
KaiReichart May 19, 2021
f53dcab
Merge branch 'argoproj:master' into master
KaiReichart May 20, 2021
94343e6
Merge remote-tracking branch 'origin/master'
KaiReichart Jun 14, 2021
21217e3
added feature for external values
KaiReichart Jun 14, 2021
88683f0
Merge branch 'master' into feat_extra_helm_values_from_git
KaiReichart Jun 14, 2021
7f8b28b
compiled
KaiReichart Jun 14, 2021
c3126d3
updated yamls
KaiReichart Jun 14, 2021
29bc569
go mod tidy
KaiReichart Jun 14, 2021
2ef8dd5
change value file name
KaiReichart Jun 14, 2021
2324155
package versions
KaiReichart Jun 14, 2021
464521e
Merge branch 'argoproj:master' into feat_extra_helm_values_from_git
KaiReichart Jun 15, 2021
4afedb9
change test location
KaiReichart Jun 15, 2021
a0026b0
change test
KaiReichart Jun 15, 2021
16b9d34
values file location
KaiReichart Jun 15, 2021
fd14f72
values file location
KaiReichart Jun 15, 2021
e6bcd7c
value file location
KaiReichart Jun 15, 2021
48b0801
fixed bug with file:// urls
KaiReichart Jun 15, 2021
988d7c8
file bug
KaiReichart Jun 15, 2021
d6d3b3e
file path
KaiReichart Jun 15, 2021
29b4ef5
test chart fix
KaiReichart Jun 15, 2021
fd26f1f
test configmap changes
KaiReichart Jun 15, 2021
36f6b5f
Merge branch 'master' into feat_extra_helm_values_from_git
KaiReichart Jun 29, 2021
9ad1353
generate files
KaiReichart Jun 29, 2021
b92f0d8
sync with test versions
KaiReichart Jun 29, 2021
a0a415d
clean up versions
KaiReichart Jun 29, 2021
7695582
clean go.mod
KaiReichart Jun 29, 2021
763b43c
normalize repo paths consistently w/ gitClient
tinkerborg Jul 6, 2021
333c40f
support credentials for external values repos
tinkerborg Jul 6, 2021
2a7eab7
fix extra values when chart located in git repo
Reuuke Jul 29, 2021
ca03f00
merge master into branch
KaiReichart Jul 31, 2021
55d1b87
codegen-generate
KaiReichart Jul 31, 2021
4a5c754
Merge pull request #2 from Reuuke/feat_extra_helm_values_from_git_fix…
KaiReichart Aug 4, 2021
b0db64b
fix extra values when chart located in git repo
Reuuke Jul 29, 2021
c9eeb80
fix extra values when chart located in git repo
Reuuke Jul 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4796,6 +4796,13 @@
"type": "object",
"title": "ApplicationSourceHelm holds helm specific options",
"properties": {
"externalValueFiles": {
"type": "array",
"title": "ValuesFilesExternalValueFiles is a list of Helm value files to use when generating a template that come from an external git repo",
"items": {
"$ref": "#/definitions/v1alpha1HelmExternalValue"
}
},
"fileParameters": {
"type": "array",
"title": "FileParameters are file parameters to the helm template",
Expand Down Expand Up @@ -5385,6 +5392,27 @@
}
}
},
"v1alpha1HelmExternalValue": {
"type": "object",
"title": "HelmExternalValue are values from other git repositories",
"properties": {
"repoURL": {
"type": "string",
"title": "RepoURL is the URL of the external git repo"
},
"targetRevision": {
"type": "string",
"title": "TargetRevision is the revision of the git repo"
},
"valueFiles": {
"type": "array",
"title": "FileParameters are file parameters to the helm template",
"items": {
"type": "string"
}
}
}
},
"v1alpha1HelmFileParameter": {
"type": "object",
"title": "HelmFileParameter is a file parameter that's passed to helm template during manifest generation",
Expand Down
1 change: 0 additions & 1 deletion controller/appcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,6 @@ func (ctrl *ApplicationController) processAppRefreshQueueItem() (processNext boo
}
origApp = origApp.DeepCopy()
needRefresh, refreshType, comparisonLevel := ctrl.needRefreshAppStatus(origApp, ctrl.statusRefreshTimeout)

if !needRefresh {
return
}
Expand Down
43 changes: 28 additions & 15 deletions controller/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ func (m *appStateManager) getRepoObjs(app *v1alpha1.Application, source v1alpha1
if err != nil {
return nil, nil, err
}
helmExternalValueCredentials := []*v1alpha1.RepoCreds{}
if app.Spec.Source.Helm != nil && app.Spec.Source.Helm.ExternalValueFiles != nil {
for _, helmExternalValueFile := range app.Spec.Source.Helm.ExternalValueFiles {
helmExternalValueCredential, err := m.db.GetRepositoryCredentials(context.Background(), helmExternalValueFile.RepoURL)
if err != nil {
return nil, nil, err
}
if helmExternalValueCredential != nil {
helmExternalValueCredentials = append(helmExternalValueCredentials, helmExternalValueCredential)
}
}
}
conn, repoClient, err := m.repoClientset.NewRepoServerClient()
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -159,21 +171,22 @@ func (m *appStateManager) getRepoObjs(app *v1alpha1.Application, source v1alpha1
}
ts.AddCheckpoint("version_ms")
manifestInfo, err := repoClient.GenerateManifest(context.Background(), &apiclient.ManifestRequest{
Repo: repo,
Repos: permittedHelmRepos,
Revision: revision,
NoCache: noCache,
NoRevisionCache: noRevisionCache,
AppLabelKey: appLabelKey,
AppName: app.Name,
Namespace: app.Spec.Destination.Namespace,
ApplicationSource: &source,
Plugins: tools,
KustomizeOptions: kustomizeOptions,
KubeVersion: serverVersion,
ApiVersions: argo.APIGroupsToVersions(apiGroups),
VerifySignature: verifySignature,
HelmRepoCreds: permittedHelmCredentials,
Repo: repo,
Repos: permittedHelmRepos,
Revision: revision,
NoCache: noCache,
NoRevisionCache: noRevisionCache,
AppLabelKey: appLabelKey,
AppName: app.Name,
Namespace: app.Spec.Destination.Namespace,
ApplicationSource: &source,
Plugins: tools,
KustomizeOptions: kustomizeOptions,
KubeVersion: serverVersion,
ApiVersions: argo.APIGroupsToVersions(apiGroups),
VerifySignature: verifySignature,
HelmRepoCreds: permittedHelmCredentials,
HelmExternalValueRepoCreds: helmExternalValueCredentials,
})
if err != nil {
return nil, nil, err
Expand Down
7 changes: 7 additions & 0 deletions docs/operator-manual/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ spec:
valueFiles:
- values-prod.yaml

# # Helm value files that are stored in a different git repository
# externalValueFiles:
# - repoURL: https://git.example.gom/example.git
# targetRevision: main
# valueFiles:
# - values.yaml

# Values file as block file
values: |
ingress:
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ clean_swagger() {
}

echo "If additional types are added, the number of expected collisions may need to be increased"
EXPECTED_COLLISION_COUNT=55
EXPECTED_COLLISION_COUNT=56
collect_swagger server ${EXPECTED_COLLISION_COUNT}
clean_swagger server
clean_swagger reposerver
Expand Down
144 changes: 144 additions & 0 deletions manifests/crds/application-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,30 @@ spec:
helm:
description: Helm holds helm specific options
properties:
externalValueFiles:
description: ValuesFilesExternalValueFiles is a list of
Helm value files to use when generating a template that
come from an external git repo
items:
description: HelmExternalValue are values from other
git repositories
properties:
repoURL:
description: RepoURL is the URL of the external
git repo
type: string
targetRevision:
description: TargetRevision is the revision of the
git repo
type: string
valueFiles:
description: FileParameters are file parameters
to the helm template
items:
type: string
type: array
type: object
type: array
fileParameters:
description: FileParameters are file parameters to the
helm template
Expand Down Expand Up @@ -570,6 +594,30 @@ spec:
helm:
description: Helm holds helm specific options
properties:
externalValueFiles:
description: ValuesFilesExternalValueFiles is a list of Helm
value files to use when generating a template that come
from an external git repo
items:
description: HelmExternalValue are values from other git
repositories
properties:
repoURL:
description: RepoURL is the URL of the external git
repo
type: string
targetRevision:
description: TargetRevision is the revision of the git
repo
type: string
valueFiles:
description: FileParameters are file parameters to the
helm template
items:
type: string
type: array
type: object
type: array
fileParameters:
description: FileParameters are file parameters to the helm
template
Expand Down Expand Up @@ -934,6 +982,30 @@ spec:
helm:
description: Helm holds helm specific options
properties:
externalValueFiles:
description: ValuesFilesExternalValueFiles is a list
of Helm value files to use when generating a template
that come from an external git repo
items:
description: HelmExternalValue are values from other
git repositories
properties:
repoURL:
description: RepoURL is the URL of the external
git repo
type: string
targetRevision:
description: TargetRevision is the revision of
the git repo
type: string
valueFiles:
description: FileParameters are file parameters
to the helm template
items:
type: string
type: array
type: object
type: array
fileParameters:
description: FileParameters are file parameters to the
helm template
Expand Down Expand Up @@ -1311,6 +1383,30 @@ spec:
helm:
description: Helm holds helm specific options
properties:
externalValueFiles:
description: ValuesFilesExternalValueFiles is
a list of Helm value files to use when generating
a template that come from an external git repo
items:
description: HelmExternalValue are values from
other git repositories
properties:
repoURL:
description: RepoURL is the URL of the external
git repo
type: string
targetRevision:
description: TargetRevision is the revision
of the git repo
type: string
valueFiles:
description: FileParameters are file parameters
to the helm template
items:
type: string
type: array
type: object
type: array
fileParameters:
description: FileParameters are file parameters
to the helm template
Expand Down Expand Up @@ -1673,6 +1769,30 @@ spec:
helm:
description: Helm holds helm specific options
properties:
externalValueFiles:
description: ValuesFilesExternalValueFiles is a list
of Helm value files to use when generating a template
that come from an external git repo
items:
description: HelmExternalValue are values from other
git repositories
properties:
repoURL:
description: RepoURL is the URL of the external
git repo
type: string
targetRevision:
description: TargetRevision is the revision
of the git repo
type: string
valueFiles:
description: FileParameters are file parameters
to the helm template
items:
type: string
type: array
type: object
type: array
fileParameters:
description: FileParameters are file parameters to
the helm template
Expand Down Expand Up @@ -2020,6 +2140,30 @@ spec:
helm:
description: Helm holds helm specific options
properties:
externalValueFiles:
description: ValuesFilesExternalValueFiles is a list
of Helm value files to use when generating a template
that come from an external git repo
items:
description: HelmExternalValue are values from other
git repositories
properties:
repoURL:
description: RepoURL is the URL of the external
git repo
type: string
targetRevision:
description: TargetRevision is the revision
of the git repo
type: string
valueFiles:
description: FileParameters are file parameters
to the helm template
items:
type: string
type: array
type: object
type: array
fileParameters:
description: FileParameters are file parameters to
the helm template
Expand Down
Loading