Skip to content

Commit c9a5e76

Browse files
committed
Refactor the API and controller to use the meta.Artifact type
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 46516fd commit c9a5e76

40 files changed

+371
-576
lines changed

api/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.25.0
44

55
require (
66
github.com/fluxcd/pkg/apis/acl v0.9.0
7-
github.com/fluxcd/pkg/apis/meta v1.20.0
7+
github.com/fluxcd/pkg/apis/meta v1.21.0
88
k8s.io/apimachinery v0.34.0
99
sigs.k8s.io/controller-runtime v0.22.0
1010
)

api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
44
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
55
github.com/fluxcd/pkg/apis/acl v0.9.0 h1:wBpgsKT+jcyZEcM//OmZr9RiF8klL3ebrDp2u2ThsnA=
66
github.com/fluxcd/pkg/apis/acl v0.9.0/go.mod h1:TttNS+gocsGLwnvmgVi3/Yscwqrjc17+vhgYfqkfrV4=
7-
github.com/fluxcd/pkg/apis/meta v1.20.0 h1:l9h0kWoDZTcYV0WJkFMgDXq6Q4tSojrJ+bHpFJSsaW0=
8-
github.com/fluxcd/pkg/apis/meta v1.20.0/go.mod h1:XUAEUgT4gkWDAEN79E141tmL+v4SV50tVZ/Ojpc/ueg=
7+
github.com/fluxcd/pkg/apis/meta v1.21.0 h1:R+bN02chcs0HUmyVDQhqe/FHmYLjipVDMLnyYfNX850=
8+
github.com/fluxcd/pkg/apis/meta v1.21.0/go.mod h1:XUAEUgT4gkWDAEN79E141tmL+v4SV50tVZ/Ojpc/ueg=
99
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
1010
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
1111
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=

api/v1/artifact_types.go

Lines changed: 0 additions & 93 deletions
This file was deleted.

api/v1/bucket_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ type BucketStatus struct {
209209

210210
// Artifact represents the last successful Bucket reconciliation.
211211
// +optional
212-
Artifact *Artifact `json:"artifact,omitempty"`
212+
Artifact *meta.Artifact `json:"artifact,omitempty"`
213213

214214
// ObservedIgnore is the observed exclusion patterns used for constructing
215215
// the source artifact.
@@ -245,7 +245,7 @@ func (in *Bucket) GetRequeueAfter() time.Duration {
245245
}
246246

247247
// GetArtifact returns the latest artifact from the source if present in the status sub-resource.
248-
func (in *Bucket) GetArtifact() *Artifact {
248+
func (in *Bucket) GetArtifact() *meta.Artifact {
249249
return in.Status.Artifact
250250
}
251251

api/v1/gitrepository_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,12 @@ type GitRepositoryStatus struct {
256256

257257
// Artifact represents the last successful GitRepository reconciliation.
258258
// +optional
259-
Artifact *Artifact `json:"artifact,omitempty"`
259+
Artifact *meta.Artifact `json:"artifact,omitempty"`
260260

261261
// IncludedArtifacts contains a list of the last successfully included
262262
// Artifacts as instructed by GitRepositorySpec.Include.
263263
// +optional
264-
IncludedArtifacts []*Artifact `json:"includedArtifacts,omitempty"`
264+
IncludedArtifacts []*meta.Artifact `json:"includedArtifacts,omitempty"`
265265

266266
// ObservedIgnore is the observed exclusion patterns used for constructing
267267
// the source artifact.
@@ -319,7 +319,7 @@ func (in GitRepository) GetRequeueAfter() time.Duration {
319319

320320
// GetArtifact returns the latest Artifact from the GitRepository if present in
321321
// the status sub-resource.
322-
func (in *GitRepository) GetArtifact() *Artifact {
322+
func (in *GitRepository) GetArtifact() *meta.Artifact {
323323
return in.Status.Artifact
324324
}
325325

api/v1/helmchart_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ type HelmChartStatus struct {
149149

150150
// Artifact represents the output of the last successful reconciliation.
151151
// +optional
152-
Artifact *Artifact `json:"artifact,omitempty"`
152+
Artifact *meta.Artifact `json:"artifact,omitempty"`
153153

154154
meta.ReconcileRequestStatus `json:",inline"`
155155
}
@@ -182,7 +182,7 @@ func (in HelmChart) GetRequeueAfter() time.Duration {
182182

183183
// GetArtifact returns the latest artifact from the source if present in the
184184
// status sub-resource.
185-
func (in *HelmChart) GetArtifact() *Artifact {
185+
func (in *HelmChart) GetArtifact() *meta.Artifact {
186186
return in.Status.Artifact
187187
}
188188

api/v1/helmrepository_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ type HelmRepositoryStatus struct {
150150

151151
// Artifact represents the last successful HelmRepository reconciliation.
152152
// +optional
153-
Artifact *Artifact `json:"artifact,omitempty"`
153+
Artifact *meta.Artifact `json:"artifact,omitempty"`
154154

155155
meta.ReconcileRequestStatus `json:",inline"`
156156
}
@@ -191,7 +191,7 @@ func (in HelmRepository) GetTimeout() time.Duration {
191191

192192
// GetArtifact returns the latest artifact from the source if present in the
193193
// status sub-resource.
194-
func (in *HelmRepository) GetArtifact() *Artifact {
194+
func (in *HelmRepository) GetArtifact() *meta.Artifact {
195195
return in.Status.Artifact
196196
}
197197

api/v1/ocirepository_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ type OCIRepositoryStatus struct {
200200

201201
// Artifact represents the output of the last successful OCI Repository sync.
202202
// +optional
203-
Artifact *Artifact `json:"artifact,omitempty"`
203+
Artifact *meta.Artifact `json:"artifact,omitempty"`
204204

205205
// ObservedIgnore is the observed exclusion patterns used for constructing
206206
// the source artifact.
@@ -241,7 +241,7 @@ func (in OCIRepository) GetRequeueAfter() time.Duration {
241241

242242
// GetArtifact returns the latest Artifact from the OCIRepository if present in
243243
// the status sub-resource.
244-
func (in *OCIRepository) GetArtifact() *Artifact {
244+
func (in *OCIRepository) GetArtifact() *meta.Artifact {
245245
return in.Status.Artifact
246246
}
247247

api/v1/source.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"time"
2121

2222
"k8s.io/apimachinery/pkg/runtime"
23+
24+
"github.com/fluxcd/pkg/apis/meta"
2325
)
2426

2527
const (
@@ -41,5 +43,5 @@ type Source interface {
4143
GetRequeueAfter() time.Duration
4244
// GetArtifact returns the latest artifact from the source if present in
4345
// the status sub-resource.
44-
GetArtifact() *Artifact
46+
GetArtifact() *meta.Artifact
4547
}

api/v1/zz_generated.deepcopy.go

Lines changed: 7 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)