Skip to content

Commit

Permalink
Add helm test spec to bundle and run during helm deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
david-clark-anaplan committed Nov 5, 2021
1 parent ee75e0b commit c2440c0
Show file tree
Hide file tree
Showing 4 changed files with 281 additions and 20 deletions.
136 changes: 136 additions & 0 deletions charts/fleet-crd/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,23 @@ spec:
type: string
takeOwnership:
type: boolean
test:
properties:
enabled:
type: boolean
filters:
additionalProperties:
items:
nullable: true
type: string
nullable: true
type: array
nullable: true
type: object
timeout:
nullable: true
type: string
type: object
timeoutSeconds:
type: integer
values:
Expand Down Expand Up @@ -495,6 +512,23 @@ spec:
type: string
takeOwnership:
type: boolean
test:
properties:
enabled:
type: boolean
filters:
additionalProperties:
items:
nullable: true
type: string
nullable: true
type: array
nullable: true
type: object
timeout:
nullable: true
type: string
type: object
timeoutSeconds:
type: integer
values:
Expand Down Expand Up @@ -1002,6 +1036,23 @@ spec:
type: string
takeOwnership:
type: boolean
test:
properties:
enabled:
type: boolean
filters:
additionalProperties:
items:
nullable: true
type: string
nullable: true
type: array
nullable: true
type: object
timeout:
nullable: true
type: string
type: object
timeoutSeconds:
type: integer
values:
Expand Down Expand Up @@ -1145,6 +1196,23 @@ spec:
type: string
takeOwnership:
type: boolean
test:
properties:
enabled:
type: boolean
filters:
additionalProperties:
items:
nullable: true
type: string
nullable: true
type: array
nullable: true
type: object
timeout:
nullable: true
type: string
type: object
timeoutSeconds:
type: integer
values:
Expand Down Expand Up @@ -2799,6 +2867,23 @@ spec:
type: string
takeOwnership:
type: boolean
test:
properties:
enabled:
type: boolean
filters:
additionalProperties:
items:
nullable: true
type: string
nullable: true
type: array
nullable: true
type: object
timeout:
nullable: true
type: string
type: object
timeoutSeconds:
type: integer
values:
Expand Down Expand Up @@ -3166,6 +3251,23 @@ spec:
type: string
takeOwnership:
type: boolean
test:
properties:
enabled:
type: boolean
filters:
additionalProperties:
items:
nullable: true
type: string
nullable: true
type: array
nullable: true
type: object
timeout:
nullable: true
type: string
type: object
timeoutSeconds:
type: integer
values:
Expand Down Expand Up @@ -3674,6 +3776,23 @@ spec:
type: string
takeOwnership:
type: boolean
test:
properties:
enabled:
type: boolean
filters:
additionalProperties:
items:
nullable: true
type: string
nullable: true
type: array
nullable: true
type: object
timeout:
nullable: true
type: string
type: object
timeoutSeconds:
type: integer
values:
Expand Down Expand Up @@ -3817,6 +3936,23 @@ spec:
type: string
takeOwnership:
type: boolean
test:
properties:
enabled:
type: boolean
filters:
additionalProperties:
items:
nullable: true
type: string
nullable: true
type: array
nullable: true
type: object
timeout:
nullable: true
type: string
type: object
timeoutSeconds:
type: integer
values:
Expand Down
15 changes: 15 additions & 0 deletions pkg/apis/fleet.cattle.io/v1alpha1/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ type HelmOptions struct {
TakeOwnership bool `json:"takeOwnership,omitempty"`
MaxHistory int `json:"maxHistory,omitempty"`
ValuesFiles []string `json:"valuesFiles,omitempty"`
Test HelmTest `json:"test,omitempty"`
}

// Define helm values that can come from configmap, secret or external. Credit: https://github.com/fluxcd/helm-operator/blob/0cfea875b5d44bea995abe7324819432070dfbdc/pkg/apis/helm.fluxcd.io/v1/types_helmrelease.go#L439
Expand All @@ -245,6 +246,20 @@ type ValuesFrom struct {
SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty"`
}

// Configure the helm test run for the release.
type HelmTest struct {
// Enable helm test for this release or not.
Enabled bool `json:"enabled"`
// Timeout passed to helm test. If absent a default helm test timeout is applied.
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`
// Filters for tests to be run during helm test. See: https://helm.sh/docs/helm/helm_test/ for syntax.
// +optional
Filters HelmFilters `json:"filters,omitempty"`
}

type HelmFilters map[string][]string

type ConfigMapKeySelector struct {
LocalObjectReference `json:",inline"`
// +optional
Expand Down
67 changes: 67 additions & 0 deletions pkg/apis/fleet.cattle.io/v1alpha1/zz_generated_deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c2440c0

Please sign in to comment.