Skip to content

Commit

Permalink
feat: support Kubernetes 1.29 (#122)
Browse files Browse the repository at this point in the history
Upstream API deprecations and removals are reflected here.

Signed-off-by: Max Brauer <mbrauer@vmware.com>
Signed-off-by: Scott Andrews <scott@andrews.me>
Co-authored-by: Scott Andrews <scott@andrews.me>
  • Loading branch information
mamachanko and scothis committed Feb 5, 2024
1 parent 30e7d09 commit 7672b18
Show file tree
Hide file tree
Showing 20 changed files with 1,145 additions and 3,531 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.19.x
go-version: 1.21.x
- name: Ensure generated code is committed
run: ./hack/update-codegen.sh && git diff --exit-code
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion apis/apiregistration/v1/zz_generated.die.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apis/apiserver/flowcontrol/v1beta1/zz_generated.die.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions apis/batch/v1/zz_generated.die.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions apis/core/v1/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,14 @@ func (d *LifecycleHandlerDie) TCPSocketDie(fn func(d *TCPSocketActionDie)) *Life
})
}

func (d *LifecycleHandlerDie) SleepDie(fn func(d *SleepActionDie)) *LifecycleHandlerDie {
return d.DieStamp(func(r *corev1.LifecycleHandler) {
d := SleepActionBlank.DieImmutable(false).DieFeedPtr(r.Sleep)
fn(d)
r.Sleep = d.DieReleasePtr()
})
}

// +die
type _ = corev1.ProbeHandler

Expand Down Expand Up @@ -472,6 +480,9 @@ type _ = corev1.TCPSocketAction
// +die
type _ = corev1.GRPCAction

// +die
type _ = corev1.SleepAction

// +die
type _ = corev1.SecurityContext

Expand Down
44 changes: 42 additions & 2 deletions apis/core/v1/persistantvolumeclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ func (d *PersistentVolumeClaimSpecDie) SelectorDie(fn func(d *diemetav1.LabelSel
})
}

func (d *PersistentVolumeClaimSpecDie) ResourcesDie(fn func(d *ResourceRequirementsDie)) *PersistentVolumeClaimSpecDie {
func (d *PersistentVolumeClaimSpecDie) ResourcesDie(fn func(d *VolumeResourceRequirementsDie)) *PersistentVolumeClaimSpecDie {
return d.DieStamp(func(r *corev1.PersistentVolumeClaimSpec) {
d := ResourceRequirementsBlank.DieImmutable(false).DieFeed(r.Resources)
d := VolumeResourceRequirementsBlank.DieImmutable(false).DieFeed(r.Resources)
fn(d)
r.Resources = d.DieRelease()
})
Expand All @@ -60,6 +60,35 @@ func (d *PersistentVolumeClaimSpecDie) DataSourceRefDie(fn func(d *TypedObjectRe
})
}

// +die
type _ = corev1.VolumeResourceRequirements

func (d *VolumeResourceRequirementsDie) AddLimit(name corev1.ResourceName, quantity resource.Quantity) *VolumeResourceRequirementsDie {
return d.DieStamp(func(r *corev1.VolumeResourceRequirements) {
if r.Limits == nil {
r.Limits = corev1.ResourceList{}
}
r.Limits[name] = quantity
})
}

func (d *VolumeResourceRequirementsDie) AddLimitString(name corev1.ResourceName, quantity string) *VolumeResourceRequirementsDie {
return d.AddLimit(name, resource.MustParse(quantity))
}

func (d *VolumeResourceRequirementsDie) AddRequest(name corev1.ResourceName, quantity resource.Quantity) *VolumeResourceRequirementsDie {
return d.DieStamp(func(r *corev1.VolumeResourceRequirements) {
if r.Requests == nil {
r.Requests = corev1.ResourceList{}
}
r.Requests[name] = quantity
})
}

func (d *VolumeResourceRequirementsDie) AddRequestString(name corev1.ResourceName, quantity string) *VolumeResourceRequirementsDie {
return d.AddRequest(name, resource.MustParse(quantity))
}

// +die:ignore={AllocatedResourceStatuses}
type _ = corev1.PersistentVolumeClaimStatus

Expand Down Expand Up @@ -158,6 +187,17 @@ func (d *PersistentVolumeClaimStatusDie) AddAllocatedResourceStatus(name corev1.
})
}

func (d *PersistentVolumeClaimStatusDie) ModifyVolumeStatusDie(fn func(d *ModifyVolumeStatusDie)) *PersistentVolumeClaimStatusDie {
return d.DieStamp(func(r *corev1.PersistentVolumeClaimStatus) {
d := ModifyVolumeStatusBlank.DieImmutable(false).DieFeedPtr(r.ModifyVolumeStatus)
fn(d)
r.ModifyVolumeStatus = d.DieReleasePtr()
})
}

// +die
type _ corev1.ModifyVolumeStatus

// +die
type _ corev1.PersistentVolumeClaimTemplate

Expand Down
20 changes: 20 additions & 0 deletions apis/core/v1/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
diemetav1 "dies.dev/apis/meta/v1"
corev1 "k8s.io/api/core/v1"
)

Expand Down Expand Up @@ -545,6 +546,14 @@ func (d *VolumeProjectionDie) ServiceAccountTokenDie(fn func(d *ServiceAccountTo
})
}

func (d *VolumeProjectionDie) ClusterTrustBundleDie(fn func(d *ClusterTrustBundleProjectionDie)) *VolumeProjectionDie {
return d.DieStamp(func(r *corev1.VolumeProjection) {
d := ClusterTrustBundleProjectionBlank.DieImmutable(false).DieFeedPtr(r.ClusterTrustBundle)
fn(d)
r.ClusterTrustBundle = d.DieReleasePtr()
})
}

// +die
type _ = corev1.SecretProjection

Expand Down Expand Up @@ -620,6 +629,17 @@ func (d *ConfigMapProjectionDie) ItemDie(key string, fn func(d *KeyToPathDie)) *
// +die
type _ = corev1.ServiceAccountTokenProjection

// +die
type _ = corev1.ClusterTrustBundleProjection

func (d *ClusterTrustBundleProjectionDie) LabelSelectorDie(fn func(d *diemetav1.LabelSelectorDie)) *ClusterTrustBundleProjectionDie {
return d.DieStamp(func(r *corev1.ClusterTrustBundleProjection) {
d := diemetav1.LabelSelectorBlank.DieImmutable(false).DieFeedPtr(r.LabelSelector)
fn(d)
r.LabelSelector = d.DieReleasePtr()
})
}

// +die
type _ = corev1.PortworxVolumeSource

Expand Down
Loading

0 comments on commit 7672b18

Please sign in to comment.