@@ -18,13 +18,19 @@ package v1beta1
1818
1919import (
2020 "github.com/fluxcd/pkg/apis/meta"
21- apimeta "k8s.io/apimachinery/pkg/api/meta"
2221 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2322)
2423
2524// HelmChartKind is the string representation of a HelmChart.
2625const HelmChartKind = "HelmChart"
2726
27+ const (
28+ DependenciesBuildCondition string = "DependenciesBuild"
29+ ValuesFilesMergedCondition string = "ValuesFilesMerged"
30+ ChartPackagedCondition string = "ChartPackaged"
31+ ChartReconciled string = "ChartReconciled"
32+ )
33+
2834// HelmChartSpec defines the desired state of a Helm chart.
2935type HelmChartSpec struct {
3036 // The name or path the Helm chart is available at in the SourceRef.
@@ -122,52 +128,20 @@ const (
122128 ChartPackageSucceededReason string = "ChartPackageSucceeded"
123129)
124130
125- // HelmChartProgressing resets the conditions of the HelmChart to meta.Condition
126- // of type meta.ReadyCondition with status 'Unknown' and meta.ProgressingReason
127- // reason and message. It returns the modified HelmChart.
128- func HelmChartProgressing (chart HelmChart ) HelmChart {
129- chart .Status .ObservedGeneration = chart .Generation
130- chart .Status .URL = ""
131- chart .Status .Conditions = []metav1.Condition {}
132- meta .SetResourceCondition (& chart , meta .ReadyCondition , metav1 .ConditionUnknown , meta .ProgressingReason , "reconciliation in progress" )
133- return chart
134- }
135-
136- // HelmChartReady sets the given Artifact and URL on the HelmChart and sets the
137- // meta.ReadyCondition to 'True', with the given reason and message. It returns
138- // the modified HelmChart.
139- func HelmChartReady (chart HelmChart , artifact Artifact , url , reason , message string ) HelmChart {
140- chart .Status .Artifact = & artifact
141- chart .Status .URL = url
142- meta .SetResourceCondition (& chart , meta .ReadyCondition , metav1 .ConditionTrue , reason , message )
143- return chart
144- }
145-
146- // HelmChartNotReady sets the meta.ReadyCondition on the given HelmChart to
147- // 'False', with the given reason and message. It returns the modified
148- // HelmChart.
149- func HelmChartNotReady (chart HelmChart , reason , message string ) HelmChart {
150- meta .SetResourceCondition (& chart , meta .ReadyCondition , metav1 .ConditionFalse , reason , message )
151- return chart
152- }
153-
154- // HelmChartReadyMessage returns the message of the meta.ReadyCondition with
155- // status 'True', or an empty string.
156- func HelmChartReadyMessage (chart HelmChart ) string {
157- if c := apimeta .FindStatusCondition (chart .Status .Conditions , meta .ReadyCondition ); c != nil {
158- if c .Status == metav1 .ConditionTrue {
159- return c .Message
160- }
161- }
162- return ""
163- }
164-
165131// GetArtifact returns the latest artifact from the source if present in the
166132// status sub-resource.
167133func (in * HelmChart ) GetArtifact () * Artifact {
168134 return in .Status .Artifact
169135}
170136
137+ func (in HelmChart ) GetConditions () []metav1.Condition {
138+ return in .Status .Conditions
139+ }
140+
141+ func (in * HelmChart ) SetConditions (conditions []metav1.Condition ) {
142+ in .Status .Conditions = conditions
143+ }
144+
171145// GetStatusConditions returns a pointer to the Status.Conditions slice
172146func (in * HelmChart ) GetStatusConditions () * []metav1.Condition {
173147 return & in .Status .Conditions
0 commit comments