velero icon indicating copy to clipboard operation
velero copied to clipboard

K8s io update to 24.0

Open kcboyle opened this issue 2 years ago • 21 comments

Please add a summary of your change

Bump k8s.io dependencies for compatibility with packages that use velero but have updated this version of k8s.

Does your change fix a particular issue?

Fixes #5009

Please indicate you've done the following:

  • [x] Accepted the DCO. Commits without the DCO will delay acceptance.

  • [x] Created a changelog file or added /kind changelog-not-required as a comment on this pull request.

  • [x] Updated the corresponding documentation in site/content/docs/main.

  • Not updating documentation, as this is a dependency bump

kcboyle avatar Jun 15 '22 21:06 kcboyle

make test was run against the branch with these changes with success. Is there anything I could do to help this process go more smoothly? Thank you

kcboyle avatar Jun 15 '22 21:06 kcboyle

Just like with #2651, other projects cannot import both velero and packages relying on k8s 1.24+ without a change like this being merged.

This one's a lot smaller though 😆

laverya avatar Jun 15 '22 21:06 laverya

@kcboyle Discussed this PR in team, we have a little concern about this upgrade, because potential compatibility with previous k8s version. The lowest version of k8s that main branch Velero currently supports is v1.16. Not sure whether the upgrade may make change to that.

blackpiglet avatar Jun 20 '22 01:06 blackpiglet

@blackpiglet to the best of my knowledge, upgrading k8s libraries will not impact compatibility with previous k8s versions - just like you can use 1.24.x kubectl with 1.16.x kubernetes clusters.

Unless there's resource types that have been completely removed that are being used, and that would cause compile errors instead.

laverya avatar Jun 21 '22 20:06 laverya

I get an error when trying to run make update and fix one of the check errors:

make update
Using Cached Image: velero/build-image:3bb6252d
Running all update scripts
Updating gofmt
Updating gofmt - done!
Updating goimports
Updating goimports - done!
+ [[ -z /go ]]
+ [[ ! -d /go/src/k8s.io/code-generator ]]
+ command -v controller-gen
+ /go/src/k8s.io/code-generator/generate-groups.sh all github.com/vmware-tanzu/velero/pkg/generated github.com/vmware-tanzu/velero/pkg/apis velero:v1 --go-header-file ./hack/boilerplate.go.txt --output-base ../../..
Generating deepcopy funcs
Generating clientset for velero:v1 at github.com/vmware-tanzu/velero/pkg/generated/clientset
Generating listers for velero:v1 at github.com/vmware-tanzu/velero/pkg/generated/listers
Generating informers for velero:v1 at github.com/vmware-tanzu/velero/pkg/generated/informers
+ controller-gen crd:crdVersions=v1 paths=./pkg/apis/velero/v1/... rbac:roleName=velero-perms paths=./pkg/controller/... output:crd:artifacts:config=config/crd/v1/bases object paths=./pkg/apis/velero/v1/...
++ cat hack/restore-crd-patch-v1.json
+ kubectl patch -f config/crd/v1/bases/velero.io_restores.yaml -p '[
    { "op": "replace", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/hooks/properties/resources/items/properties/postHooks/items/properties/init/properties/initContainers/items/properties/ports/items/required", "value": [ "containerPort", "protocol"] }
]' --type=json --local=true -o yaml
+ mv /tmp/velero.io_restores-yaml.patched config/crd/v1/bases/velero.io_restores.yaml
+ go generate ./config/crd/v1/crds
Updating generated Github issue template
Success!
Updating plugin proto
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
make[1]: *** [shell] Error 255
make: *** [update] Error 2

I'm sure I missed a step somewhere in the setup/testing. Could you please advise?

kcboyle avatar Jun 22 '22 14:06 kcboyle

I was able to resolve my issue above by running the make commands in a linux box. Waiting on the test results now.

kcboyle avatar Jun 23 '22 19:06 kcboyle

The error in the K8s io update to 24.0 Verify Velero CRDs across k8s versions #1529 job looks like it's failing because the go version in the build image is not 1.17

go get sigs.k8s.io/json/internal/golang/encoding/json
# sigs.k8s.io/json/internal/golang/encoding/json
../../../../pkg/mod/sigs.k8s.io/[email protected]/internal/golang/encoding/json/encode.go:1249:12: sf.IsExported undefined (type reflect.StructField has no field or method IsExported)
../../../../pkg/mod/sigs.k8s.io/[email protected]/internal/golang/encoding/json/encode.go:1255:18: sf.IsExported undefined (type reflect.StructField has no field or method IsExported)
note: module requires Go 1.17

Testing this on my linux box, I could recreate the failure using go 1.16, but when I used go 1.17 (defined in the go mod) this doesn't cause an issue.

Is it possible to update the go version on the box where the test is running?

kcboyle avatar Jun 24 '22 14:06 kcboyle

Also, looking into the other failure, it looks like it's seeing this go sum as having a misspelling of "yet" ("EyT")

go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=

It seems like the workflow should ignore spellings in go mod and go sum files, as there's often random strings of letters like this in those files. I made a commit to add them to the skip list. Please let me know if there is a better course of action here

kcboyle avatar Jun 24 '22 15:06 kcboyle

Codecov Report

Merging #5012 (b83a5ce) into release-1.9 (6021f14) will increase coverage by 0.00%. The diff coverage is 0.00%.

@@             Coverage Diff              @@
##           release-1.9    #5012   +/-   ##
============================================
  Coverage        41.31%   41.32%           
============================================
  Files              210      210           
  Lines            18435    18431    -4     
============================================
  Hits              7616     7616           
+ Misses           10249    10245    -4     
  Partials           570      570           
Impacted Files Coverage Δ
pkg/builder/object_meta.go 0.00% <ø> (ø)
pkg/cmd/server/server.go 6.50% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6021f14...b83a5ce. Read the comment docs.

codecov-commenter avatar Jun 27 '22 02:06 codecov-commenter

@kcboyle Thanks. Two Github actions should be modified. I create PR #5052 to fix it.

blackpiglet avatar Jun 27 '22 06:06 blackpiglet

Removed the commit that did the same thing as what you merged in PR #5052. Hoping the tests pass this time 🤞🏼

kcboyle avatar Jun 28 '22 14:06 kcboyle

@kcboyle I did some verification on my fork repo, and it worked. Need to merge main branch change, not release-1.9. IMO, need to have recently merged Github action change to work.

blackpiglet avatar Jun 29 '22 11:06 blackpiglet

@kcboyle Spell and CRD checks passed, but still needs to run make update to apply the CRDs change. Sorry for the inconvenience in contributing, we will keep the actions update later.

blackpiglet avatar Jun 30 '22 03:06 blackpiglet

re-ran the make update and re-pushed the result :)

kcboyle avatar Jun 30 '22 14:06 kcboyle

@kcboyle Finally passed! Thanks for contribution.

blackpiglet avatar Jul 01 '22 02:07 blackpiglet

@blackpiglet / @kcboyle by when will this get merged? And next release ETA?

anshulahuja98 avatar Aug 16 '22 06:08 anshulahuja98

@anshulahuja98 I think this PR is OK to merge, but Velero team still thinks there may be some impact on older versions of k8s. At least there should be some work for verifying Velero still works on v1.16 k8s cluster after this change, but Velero team doesn't have the environment for test. https://github.com/vmware-tanzu/velero/issues/5009#issuecomment-1161393344

blackpiglet avatar Aug 16 '22 11:08 blackpiglet

@blackpiglet - any update on this? as the current version use fairly old k8s lib's

ShimiT avatar Sep 04 '22 09:09 ShimiT

@blackpiglet - any update on this? as the current version use fairly old k8s lib's

@ShimiT By far, no update yet, because Velero team doesn't have a v1.16 k8s cluster for verification. By the way, may I ask why your case needs update Velero k8s liberary version?

blackpiglet avatar Sep 05 '22 07:09 blackpiglet

Hi

Could we make this PR submitted? My personal project imports velero package. but it prints an error while building it.

I really need a new version including this PR.

 > [builder 10/10] RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go:
#17 23.15 # github.com/vmware-tanzu/velero/pkg/builder
#17 23.15 /go/pkg/mod/github.com/vmware-tanzu/[email protected]/pkg/builder/object_meta.go:124:7: obj.SetClusterName undefined (type "k8s.io/apimachinery/pkg/apis/meta/v1".Object has no field or method SetClusterName)

sunglim avatar Sep 28 '22 06:09 sunglim

Hi

Could we make this PR submitted? My personal project imports velero package. but it prints an error while building it.

I really need a new version including this PR.

 > [builder 10/10] RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go:
#17 23.15 # github.com/vmware-tanzu/velero/pkg/builder
#17 23.15 /go/pkg/mod/github.com/vmware-tanzu/[email protected]/pkg/builder/object_meta.go:124:7: obj.SetClusterName undefined (type "k8s.io/apimachinery/pkg/apis/meta/v1".Object has no field or method SetClusterName)

if you are ok with this branch's code, you can do this in your go.mod file until this gets merged:

// https://github.com/vmware-tanzu/velero/pull/5012
replace github.com/vmware-tanzu/velero => github.com/kcboyle/velero v1.7.0-rc.1.0.20220630140322-e5bb9459a4f3

This will make the dependency follow this commit https://github.com/vmware-tanzu/velero/pull/5012/commits/e5bb9459a4f3b228eb13c14cf40613e76a52c0b1

d1egoaz avatar Sep 29 '22 18:09 d1egoaz

@kcboyle would you have time to rebase this PR?

reasonerjt avatar Oct 19 '22 06:10 reasonerjt

@kcboyle As we are very close to the FC date, I submitted another PR to address this issue.

Your commit is included in the new PR. Thanks for your contribution!

I'm closing this one.

ywk253100 avatar Oct 21 '22 03:10 ywk253100