security-profiles-operator icon indicating copy to clipboard operation
security-profiles-operator copied to clipboard

BUG 2082099: Fix finalizer string too long

Open Vincent056 opened this issue 2 years ago • 9 comments

Shorten the finalizer string if it is over the limit

/kind bug

This PR shortens the node name in the finalizer string if it is too long.

Fixes: BZ 2082099

Vincent056 avatar Sep 20 '22 02:09 Vincent056

Hi @Vincent056. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Sep 20 '22 02:09 k8s-ci-robot

/ok-to-test

Thank you for the fix @Vincent056!

saschagrunert avatar Sep 20 '22 07:09 saschagrunert

An e2e test would also be nice.

jhrozek avatar Sep 20 '22 14:09 jhrozek

internal/pkg/nodestatus/nodestatus_test.go:23: File is not `gci`-ed with --skip-generated -s standard,default,prefix(sigs.k8s.io/security-profiles-operator) (gci)
	"github.com/stretchr/testify/require"

So far I've had the best results with fixing the gci issues by running gci manually, something like:

go install github.com/daixiang0/gci@latest
gci write path/to/file

There is also the -l option that allows you to specify "local" imports that should be sorted last, but I could never get the flag combination to work, so I sort them manually. Normally the SPO expects the imports to be sorted:

  • stdlib, alphabetically
  • third party, alphabetically
  • local, alphabetically
internal/pkg/nodestatus/nodestatus_test.go:60: File is not `gofumpt`-ed (gofumpt)

/build/golangci-lint run --fix --build-tags no_bpf should do the trick

Don't forget to remove and reinstall golangci-lint if you have an old version locally.

jhrozek avatar Sep 21 '22 09:09 jhrozek

@jhrozek It seems like t.Parallel called after t.Setenv; cannot set environment variables in parallel tests [recovered], and not setting parallel is causing verify to fail

Vincent056 avatar Sep 22 '22 03:09 Vincent056

@jhrozek It seems like t.Parallel called after t.Setenv; cannot set environment variables in parallel tests [recovered], and not setting parallel is causing verify to fail

Can you try adding //nolint:paralleltest with the explanation you used to suppress the warning? There are some other uses of this stanza in SPO, you can git grep for its usage to see exactly where and how it's used.

jhrozek avatar Sep 22 '22 11:09 jhrozek

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhrozek, Vincent056

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Sep 23 '22 08:09 k8s-ci-robot