Skip to content

Commit

Permalink
Merge pull request #532 from scothis/dies-0.13
Browse files Browse the repository at this point in the history
Update reconciler.io/dies to 0.13.0
  • Loading branch information
scothis authored Jun 25, 2024
2 parents 2b722fb + d3280e5 commit c7f9620
Show file tree
Hide file tree
Showing 6 changed files with 763 additions and 80 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
k8s.io/apimachinery v0.30.2
k8s.io/client-go v0.30.2
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
reconciler.io/dies v0.12.0
reconciler.io/dies v0.13.0
sigs.k8s.io/controller-runtime v0.18.4
sigs.k8s.io/yaml v1.4.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7F
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
reconciler.io/dies v0.12.0 h1:6xg3h2l5gcVF478aRThL/NaStxxpytg/jTnE0zpGEmU=
reconciler.io/dies v0.12.0/go.mod h1:xMXTc1Wp1kt8NwOU9/+gCk6bwJG3TnaFofttwPEEpdI=
reconciler.io/dies v0.13.0 h1:Bc0GrdCI48psuJtPf09h2+BjAeT0lwOlQuEViRQ+xQI=
reconciler.io/dies v0.13.0/go.mod h1:5CKAAP1L9dnehzJkGJeq3RnAbXVuFaABiB2NmLErJS4=
sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw=
sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
Expand Down
2 changes: 1 addition & 1 deletion hack/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module reconciler.io/runtime/hack
go 1.22.0

require (
reconciler.io/dies/diegen v0.12.0
reconciler.io/dies/diegen v0.13.0
sigs.k8s.io/controller-tools v0.15.0
)

Expand Down
4 changes: 2 additions & 2 deletions hack/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
reconciler.io/dies/diegen v0.12.0 h1:iNl64oDzOCwv2pur5jLoTUxe8FTem9JacL8Y/hbnlNA=
reconciler.io/dies/diegen v0.12.0/go.mod h1:tdT0MK+CnHt+uGK9UNz6RFd0O9k7MBUemsnueAtxWYM=
reconciler.io/dies/diegen v0.13.0 h1:p+LjyVziQXG43egR+J3zpSVuBTa3LO2edz4GN0FTUnc=
reconciler.io/dies/diegen v0.13.0/go.mod h1:tdT0MK+CnHt+uGK9UNz6RFd0O9k7MBUemsnueAtxWYM=
sigs.k8s.io/controller-tools v0.15.0 h1:4dxdABXGDhIa68Fiwaif0vcu32xfwmgQ+w8p+5CxoAI=
sigs.k8s.io/controller-tools v0.15.0/go.mod h1:8zUSS2T8Hx0APCNRhJWbS3CAQEbIxLa07khzh7pZmXM=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
Expand Down
38 changes: 4 additions & 34 deletions internal/resources/dies/dies.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package dies

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
diecorev1 "reconciler.io/dies/apis/core/v1"
diemetav1 "reconciler.io/dies/apis/meta/v1"
"reconciler.io/runtime/internal/resources"
)
Expand All @@ -27,6 +26,7 @@ import (
type _ = resources.TestResource

// +die
// +die:field:name=Template,package=_/core/v1,die=PodTemplateSpecDie
type _ = resources.TestResourceSpec

func (d *TestResourceSpecDie) AddField(key, value string) *TestResourceSpecDie {
Expand All @@ -38,14 +38,6 @@ func (d *TestResourceSpecDie) AddField(key, value string) *TestResourceSpecDie {
})
}

func (d *TestResourceSpecDie) TemplateDie(fn func(d *diecorev1.PodTemplateSpecDie)) *TestResourceSpecDie {
return d.DieStamp(func(r *resources.TestResourceSpec) {
d := diecorev1.PodTemplateSpecBlank.DieImmutable(false).DieFeed(r.Template)
fn(d)
r.Template = d.DieRelease()
})
}

// +die
type _ = resources.TestResourceStatus

Expand Down Expand Up @@ -77,28 +69,13 @@ type _ = resources.TestResourceEmptyStatusStatus
type _ = resources.TestResourceNoStatus

// +die:object=true,spec=TestResourceSpec
// +die:field:name=Status,die=TestResourceStatusDie,pointer=true
type _ = resources.TestResourceNilableStatus

// StatusDie stamps the resource's status field with a mutable die.
func (d *TestResourceNilableStatusDie) StatusDie(fn func(d *TestResourceStatusDie)) *TestResourceNilableStatusDie {
return d.DieStamp(func(r *resources.TestResourceNilableStatus) {
d := TestResourceStatusBlank.DieImmutable(false).DieFeedPtr(r.Status)
fn(d)
r.Status = d.DieReleasePtr()
})
}

// +die:object=true
// +die:field:name=Status,die=TestResourceStatusDie
type _ = resources.TestDuck

func (d *TestDuckDie) StatusDie(fn func(d *TestResourceStatusDie)) *TestDuckDie {
return d.DieStamp(func(r *resources.TestDuck) {
d := TestResourceStatusBlank.DieImmutable(false).DieFeed(r.Status)
fn(d)
r.Status = d.DieRelease()
})
}

// +die
type _ = resources.TestDuckSpec

Expand All @@ -115,6 +92,7 @@ func (d *TestDuckSpecDie) AddField(key, value string) *TestDuckSpecDie {
type _ = resources.TestResourceUnexportedFields

// +die:ignore={unexportedFields}
// +die:field:name=Template,package=_/core/v1,die=PodTemplateSpecDie
type _ = resources.TestResourceUnexportedFieldsSpec

func (d *TestResourceUnexportedFieldsSpecDie) AddField(key, value string) *TestResourceUnexportedFieldsSpecDie {
Expand All @@ -137,14 +115,6 @@ func (d *TestResourceUnexportedFieldsSpecDie) AddUnexportedField(key, value stri
})
}

func (d *TestResourceUnexportedFieldsSpecDie) TemplateDie(fn func(d *diecorev1.PodTemplateSpecDie)) *TestResourceUnexportedFieldsSpecDie {
return d.DieStamp(func(r *resources.TestResourceUnexportedFieldsSpec) {
d := diecorev1.PodTemplateSpecBlank.DieImmutable(false).DieFeed(r.Template)
fn(d)
r.Template = d.DieRelease()
})
}

// +die:ignore={unexportedFields}
type _ = resources.TestResourceUnexportedFieldsStatus

Expand Down
Loading

0 comments on commit c7f9620

Please sign in to comment.