Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/crd/bases/sets.gitops.pro_gitopssets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1
controller-gen.kubebuilder.io/version: v0.19.0
name: gitopssets.sets.gitops.pro
spec:
group: sets.gitops.pro
Expand Down
2 changes: 1 addition & 1 deletion controllers/gitopsset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sort"
"time"

imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1"
eventv1 "github.com/fluxcd/pkg/apis/event/v1beta1"
fluxMeta "github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/conditions"
Expand Down
4 changes: 2 additions & 2 deletions examples/imagepolicy/policy-resources.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: image.toolkit.fluxcd.io/v1beta2
apiVersion: image.toolkit.fluxcd.io/v1
kind: ImageRepository
metadata:
name: podinfo
Expand All @@ -9,7 +9,7 @@ spec:
interval: 1h
provider: generic
---
apiVersion: image.toolkit.fluxcd.io/v1beta2
apiVersion: image.toolkit.fluxcd.io/v1b
kind: ImagePolicy
metadata:
name: podinfo
Expand Down
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
dario.cat/mergo v1.0.2
github.com/Masterminds/sprig/v3 v3.3.0
github.com/cyphar/filepath-securejoin v0.4.1
github.com/fluxcd/image-reflector-controller/api v0.35.2
github.com/fluxcd/image-reflector-controller/api v1.0.0
github.com/fluxcd/kustomize-controller/api v1.6.1
github.com/fluxcd/pkg/apis/event v0.19.0
github.com/fluxcd/pkg/apis/meta v1.21.0
Expand Down Expand Up @@ -108,13 +108,13 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/oauth2 v0.31.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/term v0.34.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/term v0.35.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/time v0.12.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
google.golang.org/protobuf v1.36.7 // indirect
Expand All @@ -126,8 +126,8 @@ require (
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
k8s.io/kubectl v0.34.0 // indirect
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/kustomize/api v0.20.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
Expand Down
36 changes: 18 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fluxcd/cli-utils v0.36.0-flux.15 h1:Et5QLnIpRjj+oZtM9gEybkAaoNsjysHq0y1253Ai94Y=
github.com/fluxcd/cli-utils v0.36.0-flux.15/go.mod h1:AqRUmWIfNE7cdL6NWSGF0bAlypGs+9x5UQ2qOtlEzv4=
github.com/fluxcd/image-reflector-controller/api v0.35.2 h1:EzjtUpyx8kbTFx7ugdi5LRMaCpQW4kX/vjFCIPpPD38=
github.com/fluxcd/image-reflector-controller/api v0.35.2/go.mod h1:mjpokoQhFs2RxfFjY4rHpn3ZAUvee8TiELyROFN4wiA=
github.com/fluxcd/image-reflector-controller/api v1.0.0 h1:dJEu2FKphDmrMe4GsNNg6752cv8pogUqqNWt9ZQPED8=
github.com/fluxcd/image-reflector-controller/api v1.0.0/go.mod h1:J562aKopNq0H2m0Hnz2M9kOwwyLjjwPwJgNBiIlNHQo=
github.com/fluxcd/kustomize-controller/api v1.6.1 h1:8AOD+BWQwCLT+u5jgtGryZWkCeslgr+cnQAfUzgWmGk=
github.com/fluxcd/kustomize-controller/api v1.6.1/go.mod h1:b0i/KVz28tV8iuqlNHx7MW6ZtTcIbBELGLoKdaK+X8M=
github.com/fluxcd/pkg/apis/acl v0.9.0 h1:wBpgsKT+jcyZEcM//OmZr9RiF8klL3ebrDp2u2ThsnA=
Expand Down Expand Up @@ -259,8 +259,8 @@ go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand All @@ -269,28 +269,28 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo=
golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ=
golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down Expand Up @@ -338,14 +338,14 @@ k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOP
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts=
k8s.io/kubectl v0.34.0 h1:NcXz4TPTaUwhiX4LU+6r6udrlm0NsVnSkP3R9t0dmxs=
k8s.io/kubectl v0.34.0/go.mod h1:bmd0W5i+HuG7/p5sqicr0Li0rR2iIhXL0oUyLF3OjR4=
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y=
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d h1:wAhiDyZ4Tdtt7e46e9M5ZSAJ/MnPGPs+Ki1gHw4w1R0=
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/cli-utils v0.37.2 h1:GOfKw5RV2HDQZDJlru5KkfLO1tbxqMoyn1IYUxqBpNg=
sigs.k8s.io/cli-utils v0.37.2/go.mod h1:V+IZZr4UoGj7gMJXklWBg6t5xbdThFBcpj4MrZuCYco=
sigs.k8s.io/controller-runtime v0.22.1 h1:Ah1T7I+0A7ize291nJZdS1CabF/lB4E++WizgV24Eqg=
sigs.k8s.io/controller-runtime v0.22.1/go.mod h1:FwiwRjkRPbiN+zp2QRp7wlTCzbUXxZ/D4OzuQUDwBHY=
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE=
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
sigs.k8s.io/kustomize/api v0.20.1 h1:iWP1Ydh3/lmldBnH/S5RXgT98vWYMaTUL1ADcr+Sv7I=
sigs.k8s.io/kustomize/api v0.20.1/go.mod h1:t6hUFxO+Ph0VxIk1sKp1WS0dOjbPCtLJ4p8aADLwqjM=
sigs.k8s.io/kustomize/kyaml v0.20.1 h1:PCMnA2mrVbRP3NIB6v9kYCAc38uvFLVs8j/CD567A78=
Expand Down
31 changes: 21 additions & 10 deletions pkg/generators/imagepolicy/image_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1"
templatesv1 "github.com/gitops-tools/gitopssets-controller/api/v1alpha1"
"github.com/gitops-tools/gitopssets-controller/pkg/generators"
"github.com/go-logr/logr"
Expand Down Expand Up @@ -56,7 +56,7 @@ func (g *ImagePolicyGenerator) Generate(ctx context.Context, sg *templatesv1.Git

result := []map[string]any{}

if imagePolicy.Status.LatestImage == "" {
if imagePolicy.Status.LatestRef == nil {
g.Logger.Info("image policy has not calculated the latest image")
return nil, generators.ArtifactError("ImagePolicy",
types.NamespacedName{
Expand All @@ -65,19 +65,22 @@ func (g *ImagePolicyGenerator) Generate(ctx context.Context, sg *templatesv1.Git
})
}

latestTag, err := name.NewTag(imagePolicy.Status.LatestImage)
latestTag, err := name.NewTag(imagePolicy.Status.LatestRef.String())
if err != nil {
return nil, err
return nil, fmt.Errorf("parsing latest ref tag: %w", err)
}

g.Logger.Info("image policy", "latestImage", imagePolicy.Status.LatestImage, "latestTag", latestTag.TagStr(), "previousImage", imagePolicy.Status.ObservedPreviousImage)
g.Logger.Info("image policy",
"latestImage", imageRefString(imagePolicy.Status.LatestRef),
"latestTag", latestTag.TagStr(),
"previousImage", imageRefString(imagePolicy.Status.ObservedPreviousRef))

// This stores empty strings the for the previous tag if it's empty because
// This stores empty strings for the previous tag if it's empty because
// that saves users having to check for the existence of the fields in their
// templates.
previousTag := ""
if imagePolicy.Status.ObservedPreviousImage != "" {
parsedTag, err := name.NewTag(imagePolicy.Status.ObservedPreviousImage)
if imagePolicy.Status.ObservedPreviousRef != nil {
parsedTag, err := name.NewTag(imagePolicy.Status.ObservedPreviousRef.String())
if err != nil {
return nil, err
}
Expand All @@ -86,10 +89,10 @@ func (g *ImagePolicyGenerator) Generate(ctx context.Context, sg *templatesv1.Git
}

generated := map[string]any{
"latestImage": imagePolicy.Status.LatestImage,
"latestImage": imageRefString(imagePolicy.Status.LatestRef),
"image": latestTag.Repository.Name(),
"latestTag": latestTag.TagStr(),
"previousImage": imagePolicy.Status.ObservedPreviousImage,
"previousImage": imageRefString(imagePolicy.Status.ObservedPreviousRef),
"previousTag": previousTag,
}

Expand All @@ -104,3 +107,11 @@ func (g *ImagePolicyGenerator) Generate(ctx context.Context, sg *templatesv1.Git
func (g *ImagePolicyGenerator) Interval(sg *templatesv1.GitOpsSetGenerator) time.Duration {
return generators.NoRequeueInterval
}

func imageRefString(s *imagev1.ImageRef) string {
if s == nil {
return ""
}

return s.String()
}
26 changes: 18 additions & 8 deletions pkg/generators/imagepolicy/image_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package imagepolicy
import (
"testing"

imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1"
"github.com/go-logr/logr"
"github.com/google/go-cmp/cmp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -42,7 +42,7 @@ func TestGenerate(t *testing.T) {
&templatesv1.ImagePolicyGenerator{
PolicyRef: "test-policy",
},
[]runtime.Object{test.NewImagePolicy(withImages("ghcr.io/testing/test:v0.30.0", "ghcr.io/testing/test:v0.29.0"))},
[]runtime.Object{test.NewImagePolicy(withImages("ghcr.io/testing/test", "v0.30.0", "ghcr.io/testing/test", "v0.29.0"))},
[]map[string]any{
{
"image": "ghcr.io/testing/test",
Expand All @@ -58,7 +58,7 @@ func TestGenerate(t *testing.T) {
&templatesv1.ImagePolicyGenerator{
PolicyRef: "test-policy",
},
[]runtime.Object{test.NewImagePolicy(withImages("ghcr.io/testing/test:v0.30.0", ""))},
[]runtime.Object{test.NewImagePolicy(withImages("ghcr.io/testing/test", "v0.30.0", "", ""))},
[]map[string]any{
{
"image": "ghcr.io/testing/test",
Expand Down Expand Up @@ -140,8 +140,8 @@ func TestGenerate_errors(t *testing.T) {
generator: &templatesv1.ImagePolicyGenerator{
PolicyRef: "test-policy",
},
objects: []runtime.Object{test.NewImagePolicy(withImages("testing/test::", "testing/test:v0.29.0"))},
wantErr: "repository can only contain the characters `abcdefghijklmnopqrstuvwxyz0123456789_-.",
objects: []runtime.Object{test.NewImagePolicy(withImages("testing/test", ":", "testing/test", "v0.29.0"))},
wantErr: "must specify a tag name after the colon",
},
}

Expand Down Expand Up @@ -170,10 +170,20 @@ func TestGenerate_errors(t *testing.T) {
}
}

func withImages(latestImage, previousImage string) func(*imagev1.ImagePolicy) {
func withImages(latestName, latestTag, previousName, previousTag string) func(*imagev1.ImagePolicy) {
return func(ip *imagev1.ImagePolicy) {
ip.Status.LatestImage = latestImage
ip.Status.ObservedPreviousImage = previousImage
if latestName != "" && latestTag != "" {
ip.Status.LatestRef = &imagev1.ImageRef{
Name: latestName,
Tag: latestTag,
}
}
if previousName != "" && previousTag != "" {
ip.Status.ObservedPreviousRef = &imagev1.ImageRef{
Name: previousName,
Tag: previousTag,
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/setup/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
// to ensure that exec-entrypoint and run can make use of them.
_ "k8s.io/client-go/plugin/pkg/client/auth"

imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
clustersv1 "github.com/weaveworks/cluster-controller/api/v1alpha1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/setup/generators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"

imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
templatesv1 "github.com/gitops-tools/gitopssets-controller/api/v1alpha1"
clustersv1 "github.com/weaveworks/cluster-controller/api/v1alpha1"
Expand Down
4 changes: 2 additions & 2 deletions test/resources.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package test

import (
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -13,7 +13,7 @@ const testNamespace = "default"
func NewImagePolicy(opts ...func(*imagev1.ImagePolicy)) *imagev1.ImagePolicy {
ip := &imagev1.ImagePolicy{
TypeMeta: metav1.TypeMeta{
APIVersion: "image.toolkit.fluxcd.io/v1beta2",
APIVersion: "image.toolkit.fluxcd.io/v1",
Kind: "ImagePolicy",
},
ObjectMeta: metav1.ObjectMeta{
Expand Down
17 changes: 13 additions & 4 deletions tests/e2e/gitopsset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sort"
"testing"

imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
"github.com/fluxcd/pkg/apis/meta"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
Expand Down Expand Up @@ -300,7 +300,10 @@ func TestReconcilingUpdatingImagePolicy(t *testing.T) {
defer deleteObject(t, testEnv, ip)

ip = waitForResource[*imagev1.ImagePolicy](t, testEnv, ip)
ip.Status.LatestImage = "testing/test:v0.30.0"
ip.Status.LatestRef = &imagev1.ImageRef{
Name: "testing/test",
Tag: "v0.30.0",
}
test.AssertNoError(t, testEnv.Status().Update(ctx, ip))

gs := &templatesv1.GitOpsSet{
Expand Down Expand Up @@ -336,7 +339,10 @@ func TestReconcilingUpdatingImagePolicy(t *testing.T) {
defer deleteGitOpsSetAndWaitForNotFound(t, testEnv, gs)

ip = waitForResource[*imagev1.ImagePolicy](t, testEnv, ip)
ip.Status.LatestImage = "testing/test:v0.31.0"
ip.Status.LatestRef = &imagev1.ImageRef{
Name: "testing/test",
Tag: "v0.31.0",
}
test.AssertNoError(t, testEnv.Status().Update(ctx, ip))

waitForGitOpsSetCondition(t, testEnv, gs, "1 resources created")
Expand All @@ -360,7 +366,10 @@ func TestReconcilingUpdatingImagePolicy_in_matrix(t *testing.T) {
defer deleteObject(t, testEnv, ip)

test.AssertNoError(t, testEnv.Get(ctx, client.ObjectKeyFromObject(ip), ip))
ip.Status.LatestImage = "testing/test:v0.30.0"
ip.Status.LatestRef = &imagev1.ImageRef{
Name: "testing/test",
Tag: "v0.30.0",
}
test.AssertNoError(t, testEnv.Status().Update(ctx, ip))

gs := &templatesv1.GitOpsSet{
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
"github.com/fluxcd/pkg/http/fetch"
"github.com/fluxcd/pkg/runtime/testenv"
Expand Down
Loading
Loading