Skip to content

Conversation

@sivchari
Copy link
Member

@sivchari sivchari commented Jul 10, 2025

close #117
close #118
close #119

@JoelSpeed @sbueringer

I fix the marker, then check whether the element of array is byte or not.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 10, 2025
@k8s-ci-robot k8s-ci-robot requested a review from jpbetz July 10, 2025 02:15
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 10, 2025
@sivchari
Copy link
Member Author

/assign @JoelSpeed @sbueringer

ByteArrayAliased ByteArrayAlias `json:"byteArrayAliased,omitempty"`

// Byte array with markers - should be ignored even if markers are present
// +listType=atomic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's better than the current behavior 😀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good if the field type is byte array, then it doesn't have listType marker, it's ok to ignore. On the other hand, if the field is byte array, but it has listType marker, it might have to report it.
I want to hear @JoelSpeed 's opinion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is a byte array represented in the CRD yaml? As string?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

byte array represents as base64 encoded string. So if it has listType marker, it doesn't make sense, do it ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make sense to have a listType on a byte array since the generated schema is type: string format: byte. If we see a []byte with a listType we should suggest it to be removed IMO

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably fine to address in a follow-up though? (to get the SSA linter working at least with this PR :))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm happy to have it followed up on if that's easier

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can follow up it in this PR. Let me add the feature.

return &analysis.Analyzer{
Name: name,
Name: name,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the new line here?

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 10, 2025
Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can get this message suggestion applied and update the tests to reflect that, this is good to merge

for _, marker := range listTypeMarkers {
pass.Report(analysis.Diagnostic{
Pos: field.Pos(),
Message: fmt.Sprintf("%s is a byte array, which is not supported by Server-Side Apply. Remove the listType marker", utils.FieldName(field)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can apply a byte array with server side apply, it just has a different format to other arrays. This would probably make more sense

Suggested change
Message: fmt.Sprintf("%s is a byte array, which is not supported by Server-Side Apply. Remove the listType marker", utils.FieldName(field)),
Message: fmt.Sprintf("%s is a byte array, which is does not support the listType marker. Remove the listType marker", utils.FieldName(field)),

Signed-off-by: sivchari <[email protected]>

fix marker

Signed-off-by: sivchari <[email protected]>

add IsByteArray func

Signed-off-by: sivchari <[email protected]>

fix analyzer and test

Signed-off-by: sivchari <[email protected]>

fix lint

Signed-off-by: sivchari <[email protected]>

remove typeList marker if the byte array has it

Signed-off-by: sivchari <[email protected]>

fix report message

Signed-off-by: sivchari <[email protected]>
@JoelSpeed
Copy link
Contributor

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 10, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed, sivchari

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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 10, 2025
@k8s-ci-robot k8s-ci-robot merged commit 57e7fda into kubernetes-sigs:main Jul 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSATags linter suggests SSA markers on field that already has listType on the type SSATags linter suggests SSA markers on []byte

4 participants