Skip to content

Commit

Permalink
Ensure kubeapps apis helm plugin returns additional values files.
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Nelson <minelson@vmware.com>
  • Loading branch information
absoludity committed Dec 20, 2022
1 parent 3d62492 commit adace23
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/asset-syncer/server/postgresql_db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Currently these tests will be skipped entirely unless the
// ENABLE_PG_INTEGRATION_TESTS env var is set.
// Run the local postgres with
// docker run --publish 5432:5432 -e ALLOW_EMPTY_PASSWORD=yes bitnami/postgresql:14.5.0-debian-11-r31
// docker run --publish 5432:5432 -e ALLOW_EMPTY_PASSWORD=yes bitnami/postgresql:12-debian-11
// in another terminal.
package server

Expand Down
1 change: 1 addition & 0 deletions cmd/kubeapps-apis/plugins/helm/packages/v1alpha1/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ func AvailablePackageDetailFromChart(chart *models.Chart, chartFiles *models.Cha
pkg.Readme = chartFiles.Readme
pkg.DefaultValues = chartFiles.DefaultValues
pkg.ValuesSchema = chartFiles.Schema
pkg.AdditionalDefaultValues = chartFiles.AdditionalDefaultValues
}
return pkg, nil
}
Expand Down
42 changes: 42 additions & 0 deletions cmd/kubeapps-apis/plugins/helm/packages/v1alpha1/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,48 @@ func TestAvailablePackageDetailFromChart(t *testing.T) {
},
statusCode: codes.OK,
},
{
name: "it includes additional values files in AvailablePackageDetail when available",
chart: makeChart("foo", "repo-1", "http://foo", "my-ns", []string{"3.0.0"}, DefaultChartCategory),
chartFiles: &models.ChartFiles{
Readme: "chart readme",
DefaultValues: "chart values",
AdditionalDefaultValues: map[string]string{
"values-production": "chart production values",
"values-staging": "chart staging values",
},
Schema: "chart schema",
},
expected: &corev1.AvailablePackageDetail{
Name: "foo",
DisplayName: "foo",
RepoUrl: "http://foo",
HomeUrl: DefaultChartHomeURL,
IconUrl: DefaultChartIconURL,
Categories: []string{DefaultChartCategory},
ShortDescription: DefaultChartDescription,
LongDescription: "",
Version: &corev1.PackageAppVersion{
PkgVersion: "3.0.0",
AppVersion: DefaultAppVersion,
},
Readme: "chart readme",
DefaultValues: "chart values",
AdditionalDefaultValues: map[string]string{
"values-production": "chart production values",
"values-staging": "chart staging values",
},
ValuesSchema: "chart schema",
SourceUrls: []string{"http://source-1"},
Maintainers: []*corev1.Maintainer{{Name: "me", Email: "me@me.me"}},
AvailablePackageRef: &corev1.AvailablePackageReference{
Context: &corev1.Context{Namespace: "my-ns"},
Identifier: "repo-1/foo",
Plugin: &plugins.Plugin{Name: "helm.packages", Version: "v1alpha1"},
},
},
statusCode: codes.OK,
},
{
name: "it returns internal error if empty chart",
chart: &models.Chart{},
Expand Down

0 comments on commit adace23

Please sign in to comment.