pulumi-kubernetes icon indicating copy to clipboard operation
pulumi-kubernetes copied to clipboard

PodSpecArgs.ServiceAccount comment (deprecation) not properly formatted

Open ghostsquad opened this issue 3 years ago • 4 comments

What happened?

// DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.
ServiceAccount pulumi.StringPtrInput `pulumi:"serviceAccount"`

Should be:

// Deprecated: ServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.
ServiceAccount pulumi.StringPtrInput `pulumi:"serviceAccount"`

Steps to reproduce

n/a

Expected Behavior

n/a

Actual Behavior

n/a

Versions used

github.com/pulumi/pulumi-kubernetes/sdk/v3 v3.20.0

Additional context

Formatting the comment correctly allows IDE's that know how to read the standard deprecation format in comments to linethrough the field, which is a helpful indicator not to use that field.

https://rakyll.org/deprecated/

https://github.com/golang/go/wiki/Deprecated

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

ghostsquad avatar Jul 20 '22 21:07 ghostsquad

I'd submit a PR to fix this simple problem, but I don't completely understand how the SDK code is autogenerated.

ghostsquad avatar Jul 20 '22 21:07 ghostsquad

@ghostsquad thanks for opening the issue! The SDK and docs are generated directly from the openapi spec published by Kubernetes: https://raw.githubusercontent.com/kubernetes/kubernetes/v1.24.3/api/openapi-spec/swagger.json. Indeed the spec includes the same typo there. Could you open the issue in https://github.com/kubernetes/kubernetes/issues and/or submit a fix there?

viveklak avatar Jul 21 '22 21:07 viveklak

@viveklak of thank you very much. I'll open a issue/PR there.

ghostsquad avatar Jul 21 '22 22:07 ghostsquad

Ok, so more information. The field was actually renamed to DeprecatedServerAccount, in addition to having a comment of the deprecation. The problem I'm seeing actually on the pulumi side, is that "paragraphs" appear not to be captured properly.

https://stackoverflow.com/questions/7849663/how-do-you-mark-code-as-deprecated-in-go

https://go.dev/blog/godoc

https://rakyll.org/deprecated/

I can confirm that the upstream struct shows the field (as being renamed) as well as my IDE properly seeing the "Deprecated: " paragraph comment.

image

Here's how it shows up in their swagger:

"serviceAccount": {
          "description": "DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.",
          "type": "string"
        },

Here's how it shows up in code:

https://github.com/kubernetes/api/blob/f6f0d0e54216133456777fa675f58cf10cf79330/core/v1/types.go#L3138-L3142

	// DeprecatedServiceAccount is a depreciated alias for ServiceAccountName.
	// Deprecated: Use serviceAccountName instead.
	// +k8s:conversion-gen=false
	// +optional
	DeprecatedServiceAccount string `json:"serviceAccount,omitempty" protobuf:"bytes,9,opt,name=serviceAccount"`

ghostsquad avatar Jul 26 '22 22:07 ghostsquad