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

Devfile Library should be updated to support Go 1.21 #1543

Open
Tracked by #1555
johnmcollier opened this issue May 10, 2024 · 4 comments
Open
Tracked by #1555

Devfile Library should be updated to support Go 1.21 #1543

johnmcollier opened this issue May 10, 2024 · 4 comments
Labels
area/library Common devfile library for interacting with devfiles status/blocked

Comments

@johnmcollier
Copy link
Member

/kind bug
/area library

Trying to consume the devfile library with Go 1.21 reports the following errors:

github.com/devfile/library/v2/pkg/devfile/generator
/home/admin/go1.21/gopath/pkg/mod/github.com/devfile/library/v2@v2.2.1-0.20230418160146-e75481b7eebd/pkg/devfile/generator/utils.go:600:14: cannot use corev1.ResourceRequirements{…} (value of type "k8s.io/api/core/v1".ResourceRequirements) as "k8s.io/api/core/v1".VolumeResourceRequirements value in struct literal

It seems that some of its dependencies need to be updated to a version that supports Go 1.21. We should also ensure that there's nothing else in the library that's blocking it from working on 1.21.

@openshift-ci openshift-ci bot added kind/bug Something isn't working area/library Common devfile library for interacting with devfiles labels May 10, 2024
@michael-valdron
Copy link
Member

I did an investigation into this, it appears to be a k8s API change in v1.29 and is breaking pkg/devfile/generator/utils.go#L600 in devfile/library rather than it being the Go version:

Kubernetes 1.28

type PersistentVolumeClaimSpec struct {
...
	// Resources represents the minimum resources required
	// If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements
	// that are lower than previous value but must still be higher than capacity recorded in the
	// status field of the claim.
	// +optional
	Resources ResourceRequirements
...
}

Kubernetes 1.29

type PersistentVolumeClaimSpec struct {
...
	// Resources represents the minimum resources required
	// If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements
	// that are lower than previous value but must still be higher than capacity recorded in the
	// status field of the claim.
	// +optional
	Resources VolumeResourceRequirements
...
}

For this issue we'll need to do two changes:

  1. Support k8s version 1.29 by bumping the version in our modules (might be an epic)
  2. As part of bumping the version for devfile/library we'll need to refactor these breaking changes

With that if a consumer wants to continue using our modules until this is done they should be advised not to upgrade past the v1.28 k8s APIs to avoid breaking changes.

@michael-valdron
Copy link
Member

I did an investigation into this, it appears to be a k8s API change in v1.29 and is breaking pkg/devfile/generator/utils.go#L600 in devfile/library rather than it being the Go version:

Kubernetes 1.28

type PersistentVolumeClaimSpec struct {
...
	// Resources represents the minimum resources required
	// If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements
	// that are lower than previous value but must still be higher than capacity recorded in the
	// status field of the claim.
	// +optional
	Resources ResourceRequirements
...
}

Kubernetes 1.29

type PersistentVolumeClaimSpec struct {
...
	// Resources represents the minimum resources required
	// If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements
	// that are lower than previous value but must still be higher than capacity recorded in the
	// status field of the claim.
	// +optional
	Resources VolumeResourceRequirements
...
}

For this issue we'll need to do two changes:

1. Support k8s version 1.29 by bumping the version in our modules (might be an epic)

2. As part of bumping the version for devfile/library we'll need to refactor these breaking changes

With that if a consumer wants to continue using our modules until this is done they should be advised not to upgrade past the v1.28 k8s APIs to avoid breaking changes.

**Update** k8s.io/api v0.29.x (for Kubernetes 1.29) does require Go 1.21: https://github.com/kubernetes/api/blob/d47313059888ec984bf8432ed155fae5be935c31/go.mod#L5C1-L5C8

With that we'll need the the additional epic of updating to Go 1.21 before moving to Kubernetes 1.29, we could consider merging them into one epic as it could be one of the changes to a Go 1.21 update.

These changes would be towards a new version of the devfile schema.

cc @devfile/devfile-services-team

@michael-valdron
Copy link
Member

Created epic issue #1555 to track all Go 1.21 and Kubernetes 1.29 upgrades.

@michael-valdron
Copy link
Member

michael-valdron commented May 15, 2024

Blocked by #1556 & #1562

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/library Common devfile library for interacting with devfiles status/blocked
Projects
Status: Backlog
Development

No branches or pull requests

3 participants