Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Add helm release install/upgrade timeout to CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprodan committed Dec 4, 2018
1 parent 5cdd314 commit 495f9d3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
3 changes: 3 additions & 0 deletions chart/flux/templates/helm-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ spec:
releaseName:
type: string
pattern: "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
timeout:
type: integer
format: int64
chartGitPath:
type: string
values:
Expand Down
3 changes: 3 additions & 0 deletions deploy-helm/flux-helm-release-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ spec:
releaseName:
type: string
pattern: "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
timeout:
type: integer
format: int64
valueFileSecrets:
type: array
items:
Expand Down
18 changes: 14 additions & 4 deletions integrations/apis/flux.weave.works/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package v1beta1

import (
"github.com/ghodss/yaml"
v1 "k8s.io/api/core/v1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/helm/pkg/chartutil"

Expand Down Expand Up @@ -65,11 +65,21 @@ type RepoChartSource struct {
// FluxHelmReleaseSpec is the spec for a FluxHelmRelease resource
// FluxHelmReleaseSpec
type HelmReleaseSpec struct {
ChartSource `json:"chart"`
ReleaseName string `json:"releaseName,omitempty"`

ChartSource `json:"chart"`
ReleaseName string `json:"releaseName,omitempty"`
ValueFileSecrets []v1.LocalObjectReference `json:"valueFileSecrets,omitempty"`
HelmValues `json:",inline"`
// Install or upgrade timeout in seconds
// +optional
Timeout *int64 `json:"timeout,omitempty"`
}

// GetTimeout returns the install or upgrade timeout (defaults to 300s)
func (r HelmRelease) GetTimeout() int64 {
if r.Spec.Timeout == nil {
return 300
}
return *r.Spec.Timeout
}

type HelmReleaseStatus struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ func (in *HelmReleaseSpec) DeepCopyInto(out *HelmReleaseSpec) {
copy(*out, *in)
}
in.HelmValues.DeepCopyInto(&out.HelmValues)
if in.Timeout != nil {
in, out := &in.Timeout, &out.Timeout
if *in == nil {
*out = nil
} else {
*out = new(int64)
**out = **in
}
}
return
}

Expand Down

0 comments on commit 495f9d3

Please sign in to comment.