@@ -22,12 +22,12 @@ import (
22
22
"time"
23
23
24
24
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
25
+ apimeta "k8s.io/apimachinery/pkg/api/meta"
25
26
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26
27
"k8s.io/apimachinery/pkg/types"
27
28
28
29
"github.com/fluxcd/pkg/apis/kustomize"
29
30
"github.com/fluxcd/pkg/apis/meta"
30
- "github.com/fluxcd/pkg/runtime/dependency"
31
31
)
32
32
33
33
const HelmReleaseKind = "HelmRelease"
@@ -59,7 +59,7 @@ type PostRenderer struct {
59
59
60
60
// HelmReleaseSpec defines the desired state of a Helm release.
61
61
type HelmReleaseSpec struct {
62
- // Chart defines the template of the v1beta1 .HelmChart that should be created
62
+ // Chart defines the template of the v1beta2 .HelmChart that should be created
63
63
// for this HelmRelease.
64
64
// +required
65
65
Chart HelmChartTemplate `json:"chart"`
@@ -102,11 +102,11 @@ type HelmReleaseSpec struct {
102
102
// +optional
103
103
StorageNamespace string `json:"storageNamespace,omitempty"`
104
104
105
- // DependsOn may contain a dependency.CrossNamespaceDependencyReference slice with
105
+ // DependsOn may contain a meta.NamespacedObjectReference slice with
106
106
// references to HelmRelease resources that must be ready before this HelmRelease
107
107
// can be reconciled.
108
108
// +optional
109
- DependsOn []dependency. CrossNamespaceDependencyReference `json:"dependsOn,omitempty"`
109
+ DependsOn []meta. NamespacedObjectReference `json:"dependsOn,omitempty"`
110
110
111
111
// Timeout is the time to wait for any individual Kubernetes operation (like Jobs
112
112
// for hooks) during the performance of a Helm action. Defaults to '5m0s'.
@@ -216,32 +216,32 @@ type KubeConfig struct {
216
216
}
217
217
218
218
// HelmChartTemplate defines the template from which the controller will
219
- // generate a v1beta1 .HelmChart object in the same namespace as the referenced
220
- // v1beta1 .Source.
219
+ // generate a v1beta2 .HelmChart object in the same namespace as the referenced
220
+ // v1beta2 .Source.
221
221
type HelmChartTemplate struct {
222
- // Spec holds the template for the v1beta1 .HelmChartSpec for this HelmRelease.
222
+ // Spec holds the template for the v1beta2 .HelmChartSpec for this HelmRelease.
223
223
// +required
224
224
Spec HelmChartTemplateSpec `json:"spec"`
225
225
}
226
226
227
227
// HelmChartTemplateSpec defines the template from which the controller will
228
- // generate a v1beta1 .HelmChartSpec object.
228
+ // generate a v1beta2 .HelmChartSpec object.
229
229
type HelmChartTemplateSpec struct {
230
230
// The name or path the Helm chart is available at in the SourceRef.
231
231
// +required
232
232
Chart string `json:"chart"`
233
233
234
- // Version semver expression, ignored for charts from v1beta1 .GitRepository and
235
- // v1beta1 .Bucket sources. Defaults to latest when omitted.
234
+ // Version semver expression, ignored for charts from v1beta2 .GitRepository and
235
+ // v1beta2 .Bucket sources. Defaults to latest when omitted.
236
236
// +kubebuilder:default:=*
237
237
// +optional
238
238
Version string `json:"version,omitempty"`
239
239
240
- // The name and namespace of the v1beta1 .Source the chart is available at.
240
+ // The name and namespace of the v1beta2 .Source the chart is available at.
241
241
// +required
242
242
SourceRef CrossNamespaceObjectReference `json:"sourceRef"`
243
243
244
- // Interval at which to check the v1beta1 .Source for updates. Defaults to
244
+ // Interval at which to check the v1beta2 .Source for updates. Defaults to
245
245
// 'HelmReleaseSpec.Interval'.
246
246
// +optional
247
247
Interval * metav1.Duration `json:"interval,omitempty"`
@@ -271,7 +271,7 @@ type HelmChartTemplateSpec struct {
271
271
ValuesFile string `json:"valuesFile,omitempty"`
272
272
}
273
273
274
- // GetInterval returns the configured interval for the v1beta1 .HelmChart,
274
+ // GetInterval returns the configured interval for the v1beta2 .HelmChart,
275
275
// or the given default.
276
276
func (in HelmChartTemplate ) GetInterval (defaultInterval metav1.Duration ) metav1.Duration {
277
277
if in .Spec .Interval == nil {
@@ -281,7 +281,7 @@ func (in HelmChartTemplate) GetInterval(defaultInterval metav1.Duration) metav1.
281
281
}
282
282
283
283
// GetNamespace returns the namespace targeted namespace for the
284
- // v1beta1 .HelmChart, or the given default.
284
+ // v1beta2 .HelmChart, or the given default.
285
285
func (in HelmChartTemplate ) GetNamespace (defaultNamespace string ) string {
286
286
if in .Spec .SourceRef .Namespace == "" {
287
287
return defaultNamespace
@@ -836,23 +836,39 @@ func (in HelmReleaseStatus) GetHelmChart() (string, string) {
836
836
// 'Unknown' for meta.ProgressingReason.
837
837
func HelmReleaseProgressing (hr HelmRelease ) HelmRelease {
838
838
hr .Status .Conditions = []metav1.Condition {}
839
- meta .SetResourceCondition (& hr , meta .ReadyCondition , metav1 .ConditionUnknown , meta .ProgressingReason ,
840
- "Reconciliation in progress" )
839
+ newCondition := metav1.Condition {
840
+ Type : meta .ReadyCondition ,
841
+ Status : metav1 .ConditionUnknown ,
842
+ Reason : meta .ProgressingReason ,
843
+ Message : "Reconciliation in progress" ,
844
+ }
845
+ apimeta .SetStatusCondition (hr .GetStatusConditions (), newCondition )
841
846
resetFailureCounts (& hr )
842
847
return hr
843
848
}
844
849
845
850
// HelmReleaseNotReady registers a failed reconciliation of the given HelmRelease.
846
851
func HelmReleaseNotReady (hr HelmRelease , reason , message string ) HelmRelease {
847
- meta .SetResourceCondition (& hr , meta .ReadyCondition , metav1 .ConditionFalse , reason , message )
852
+ newCondition := metav1.Condition {
853
+ Type : meta .ReadyCondition ,
854
+ Status : metav1 .ConditionFalse ,
855
+ Reason : reason ,
856
+ Message : message ,
857
+ }
858
+ apimeta .SetStatusCondition (hr .GetStatusConditions (), newCondition )
848
859
hr .Status .Failures ++
849
860
return hr
850
861
}
851
862
852
863
// HelmReleaseReady registers a successful reconciliation of the given HelmRelease.
853
864
func HelmReleaseReady (hr HelmRelease ) HelmRelease {
854
- meta .SetResourceCondition (& hr , meta .ReadyCondition , metav1 .ConditionTrue , meta .ReconciliationSucceededReason ,
855
- "Release reconciliation succeeded" )
865
+ newCondition := metav1.Condition {
866
+ Type : meta .ReadyCondition ,
867
+ Status : metav1 .ConditionTrue ,
868
+ Reason : ReconciliationSucceededReason ,
869
+ Message : "Release reconciliation succeeded" ,
870
+ }
871
+ apimeta .SetStatusCondition (hr .GetStatusConditions (), newCondition )
856
872
hr .Status .LastAppliedRevision = hr .Status .LastAttemptedRevision
857
873
resetFailureCounts (& hr )
858
874
return hr
@@ -963,13 +979,9 @@ func (in HelmRelease) GetMaxHistory() int {
963
979
return * in .Spec .MaxHistory
964
980
}
965
981
966
- // GetDependsOn returns the types.NamespacedName of the HelmRelease, and a
967
- // dependency.CrossNamespaceDependencyReference slice it depends on.
968
- func (in HelmRelease ) GetDependsOn () (types.NamespacedName , []dependency.CrossNamespaceDependencyReference ) {
969
- return types.NamespacedName {
970
- Namespace : in .Namespace ,
971
- Name : in .Namespace ,
972
- }, in .Spec .DependsOn
982
+ // GetDependsOn returns the list of dependencies across-namespaces.
983
+ func (in HelmRelease ) GetDependsOn () []meta.NamespacedObjectReference {
984
+ return in .Spec .DependsOn
973
985
}
974
986
975
987
// GetStatusConditions returns a pointer to the Status.Conditions slice
0 commit comments