Add create/delete HelmRelease e2e tests

pull/118/head
stefanprodan 5 years ago
parent 5f0b95dc59
commit 797aec5528

@ -91,6 +91,20 @@ jobs:
- name: tk delete source git
run: |
./bin/tk delete source git podinfo --silent
- name: tk create source helm
run: |
./bin/tk create source helm podinfo \
--url https://stefanprodan.github.io/podinfo
- name: tk create hr
run: |
./bin/tk create hr podinfo \
--target-namespace=default \
--source=podinfo \
--chart-name=podinfo \
--chart-version=">4.0.0 <5.0.0"
- name: tk delete hr
run: |
./bin/tk delete hr podinfo --silent
- name: tk check
run: |
./bin/tk check

@ -25,6 +25,7 @@ import (
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
@ -43,6 +44,7 @@ var createHelmReleaseCmd = &cobra.Command{
Example: ` # Create a HelmRelease from a source
tk create hr podinfo \
--interval=10m \
--release-name=podinfo \
--target-namespace=default \
--source=podinfo \
--chart-name=podinfo \
@ -69,6 +71,7 @@ var createHelmReleaseCmd = &cobra.Command{
}
var (
hrName string
hrSource string
hrDependsOn []string
hrChartName string
@ -78,6 +81,7 @@ var (
)
func init() {
createHelmReleaseCmd.Flags().StringVar(&hrName, "release-name", "", "name used for the Helm release, defaults to a composition of '<target-namespace>-<hr-name>'")
createHelmReleaseCmd.Flags().StringVar(&hrSource, "source", "", "HelmRepository name")
createHelmReleaseCmd.Flags().StringVar(&hrChartName, "chart-name", "", "Helm chart name")
createHelmReleaseCmd.Flags().StringVar(&hrChartVersion, "chart-version", "", "Helm chart version, accepts semver range")
@ -121,7 +125,8 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
Namespace: namespace,
},
Spec: helmv2.HelmReleaseSpec{
DependsOn: hrDependsOn,
ReleaseName: hrName,
DependsOn: hrDependsOn,
Interval: metav1.Duration{
Duration: interval,
},
@ -255,6 +260,9 @@ func isHelmChartReady(ctx context.Context, kubeClient client.Client, name, names
err := kubeClient.Get(ctx, namespacedName, &helmChart)
if err != nil {
if apierrors.IsNotFound(err) {
return false, nil
}
return false, err
}

@ -16,6 +16,7 @@ tk create helmrelease [name] [flags]
# Create a HelmRelease from a source
tk create hr podinfo \
--interval=10m \
--release-name=podinfo \
--target-namespace=default \
--source=podinfo \
--chart-name=podinfo \
@ -47,6 +48,7 @@ tk create helmrelease [name] [flags]
--chart-version string Helm chart version, accepts semver range
--depends-on stringArray HelmReleases that must be ready before this release can be installed
-h, --help help for helmrelease
--release-name string name used for the Helm release, defaults to a composition of '<target-namespace>-<hr-name>'
--source string HelmRepository name
--target-namespace string namespace to install this release, defaults to the HelmRelease namespace
--values string local path to the values.yaml file

Loading…
Cancel
Save