Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update reconciler.io/dies to 0.13.0 #432

Merged
merged 2 commits into from
Jun 25, 2024
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
27 changes: 4 additions & 23 deletions dies/v1/clusterworkloadresourcemapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,17 @@
type _ = servicebindingv1.ClusterWorkloadResourceMapping

// +die
// +die:field:name=Versions,die=ClusterWorkloadResourceMappingTemplateDie,listMapKey=Version
type _ = servicebindingv1.ClusterWorkloadResourceMappingSpec

// deprecated use VersionDie
func (d *ClusterWorkloadResourceMappingSpecDie) VersionsDie(version string, fn func(d *ClusterWorkloadResourceMappingTemplateDie)) *ClusterWorkloadResourceMappingSpecDie {
return d.DieStamp(func(r *servicebindingv1.ClusterWorkloadResourceMappingSpec) {
for i := range r.Versions {
if version == r.Versions[i].Version {
d := ClusterWorkloadResourceMappingTemplateBlank.DieImmutable(false).DieFeed(r.Versions[i])
fn(d)
r.Versions[i] = d.DieRelease()
return
}
}

d := ClusterWorkloadResourceMappingTemplateBlank.DieImmutable(false).DieFeed(servicebindingv1.ClusterWorkloadResourceMappingTemplate{Version: version})
fn(d)
r.Versions = append(r.Versions, d.DieRelease())
})
return d.VersionDie(version, fn)

Check warning on line 32 in dies/v1/clusterworkloadresourcemapping.go

View check run for this annotation

Codecov / codecov/patch

dies/v1/clusterworkloadresourcemapping.go#L32

Added line #L32 was not covered by tests
}

// +die
// +die:field:name=Containers,die=ClusterWorkloadResourceMappingContainerDie,listType=atomic
type _ = servicebindingv1.ClusterWorkloadResourceMappingTemplate

func (d *ClusterWorkloadResourceMappingTemplateDie) ContainersDie(containers ...*ClusterWorkloadResourceMappingContainerDie) *ClusterWorkloadResourceMappingTemplateDie {
return d.DieStamp(func(r *servicebindingv1.ClusterWorkloadResourceMappingTemplate) {
r.Containers = make([]servicebindingv1.ClusterWorkloadResourceMappingContainer, len(containers))
for i := range containers {
r.Containers[i] = containers[i].DieRelease()
}
})
}

// +die
type _ = servicebindingv1.ClusterWorkloadResourceMappingContainer
65 changes: 6 additions & 59 deletions dies/v1/servicebinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
diemetav1 "reconciler.io/dies/apis/meta/v1"

servicebindingv1 "github.com/servicebinding/runtime/apis/v1"
Expand All @@ -27,81 +26,29 @@ import (
type _ = servicebindingv1.ServiceBinding

// +die
// +die:field:name=Workload,die=ServiceBindingWorkloadReferenceDie
// +die:field:name=Service,die=ServiceBindingServiceReferenceDie
// +die:field:name=Env,die=EnvMappingDie,listType=map
type _ = servicebindingv1.ServiceBindingSpec

func (d *ServiceBindingSpecDie) WorkloadDie(fn func(d *ServiceBindingWorkloadReferenceDie)) *ServiceBindingSpecDie {
return d.DieStamp(func(r *servicebindingv1.ServiceBindingSpec) {
d := ServiceBindingWorkloadReferenceBlank.DieImmutable(false).DieFeed(r.Workload)
fn(d)
r.Workload = d.DieRelease()
})
}

func (d *ServiceBindingSpecDie) ServiceDie(fn func(d *ServiceBindingServiceReferenceDie)) *ServiceBindingSpecDie {
return d.DieStamp(func(r *servicebindingv1.ServiceBindingSpec) {
d := ServiceBindingServiceReferenceBlank.DieImmutable(false).DieFeed(r.Service)
fn(d)
r.Service = d.DieRelease()
})
}

func (d *ServiceBindingSpecDie) EnvDie(name string, fn func(d *EnvMappingDie)) *ServiceBindingSpecDie {
return d.DieStamp(func(r *servicebindingv1.ServiceBindingSpec) {
for i := range r.Env {
if name == r.Env[i].Name {
d := EnvMappingBlank.DieImmutable(false).DieFeed(r.Env[i])
fn(d)
r.Env[i] = d.DieRelease()
return
}
}

d := EnvMappingBlank.DieImmutable(false).DieFeed(servicebindingv1.EnvMapping{Name: name})
fn(d)
r.Env = append(r.Env, d.DieRelease())
})
}

// +die
// +die:field:name=Selector,package=_/meta/v1,die=LabelSelectorDie,pointer=true
type _ = servicebindingv1.ServiceBindingWorkloadReference

func (d *ServiceBindingWorkloadReferenceDie) SelectorDie(fn func(d *diemetav1.LabelSelectorDie)) *ServiceBindingWorkloadReferenceDie {
return d.DieStamp(func(r *servicebindingv1.ServiceBindingWorkloadReference) {
d := diemetav1.LabelSelectorBlank.DieImmutable(false).DieFeedPtr(r.Selector)
fn(d)
r.Selector = d.DieReleasePtr()
})
}

// +die
type _ = servicebindingv1.ServiceBindingServiceReference

// +die
type _ = servicebindingv1.EnvMapping

// +die
// +die:field:name=Conditions,package=_/meta/v1,die=ConditionDie,listType=atomic
// +die:field:name=Binding,die=ServiceBindingSecretReferenceDie,pointer=true
type _ = servicebindingv1.ServiceBindingStatus

func (d *ServiceBindingStatusDie) ConditionsDie(conditions ...*diemetav1.ConditionDie) *ServiceBindingStatusDie {
return d.DieStamp(func(r *servicebindingv1.ServiceBindingStatus) {
r.Conditions = make([]metav1.Condition, len(conditions))
for i := range conditions {
r.Conditions[i] = conditions[i].DieRelease()
}
})
}

var ServiceBindingConditionReady = diemetav1.ConditionBlank.Type(servicebindingv1.ServiceBindingConditionReady).Unknown().Reason("Initializing")
var ServiceBindingConditionServiceAvailable = diemetav1.ConditionBlank.Type(servicebindingv1.ServiceBindingConditionServiceAvailable).Unknown().Reason("Initializing")
var ServiceBindingConditionWorkloadProjected = diemetav1.ConditionBlank.Type(servicebindingv1.ServiceBindingConditionWorkloadProjected).Unknown().Reason("Initializing")

func (d *ServiceBindingStatusDie) BindingDie(fn func(d *ServiceBindingSecretReferenceDie)) *ServiceBindingStatusDie {
return d.DieStamp(func(r *servicebindingv1.ServiceBindingStatus) {
d := ServiceBindingSecretReferenceBlank.DieImmutable(false).DieFeedPtr(r.Binding)
fn(d)
r.Binding = d.DieReleasePtr()
})
}

// +die
type _ = servicebindingv1.ServiceBindingSecretReference
Loading
Loading