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

Update API type documentation for 'certmanager', 'meta' and 'acme' API groups #3031

Merged
merged 12 commits into from Jun 26, 2020

Conversation

munnerz
Copy link
Member

@munnerz munnerz commented Jun 24, 2020

What this PR does / why we need it:

I've gone through these two API groups and added/updated documentation for all fields. I still need to go through the acme API group and apply similar changes.

This also includes a const being renamed (i.e. not changing the value of it), which I have separated into its own commit to make it easier to review.

Release note:

Improve documentation of API types displayed via `kubectl explain`

/cc @meyskens @JoshVanL

@jetstack-bot jetstack-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. area/api Indicates a PR directly modifies the 'pkg/apis' directory area/deploy Indicates a PR modifies deployment configuration approved Indicates a PR has been approved by an approver from all required OWNERS files. area/testing Issues relating to testing needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 24, 2020
@meyskens
Copy link
Contributor

@munnerz looking great! just these few nits

@munnerz munnerz added this to the v0.16 milestone Jun 25, 2020
@jetstack-bot jetstack-bot added dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. and removed dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. labels Jun 25, 2020
Copy link
Member

@wallrj wallrj left a comment

Choose a reason for hiding this comment

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

I've gone through the certificate and certificaterequest docs....but just realised that they are the v1alpha2 docs. All those changes also apply to the v1alpha3 docs too...but my question is why bother updating the v1alpha2 docs at all?

pkg/apis/certmanager/v1alpha2/types.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha2/types.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha2/types.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha2/types.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha2/types.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha2/types_certificaterequest.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha2/types_certificaterequest.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha2/types_certificaterequest.go Outdated Show resolved Hide resolved
@munnerz
Copy link
Member Author

munnerz commented Jun 26, 2020

All those changes also apply to the v1alpha3 docs too

This PR updates both v1alpha2 and v1alpha3 😄

We document both because both are valid API versions that you can use to talk to the apiserver with. To not document one would mean that some set of users (those consuming older api versions) have no documentation. For the most part, these comments are identical. But there are a few specific areas where they are not (where we have changed behaviours 😄 )

Copy link
Member

@wallrj wallrj left a comment

Choose a reason for hiding this comment

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

I've gone through the v1alpha3 issuer types and noted a few typos and inconsistencies.

Generally:

  • Should each docstring start with the name of the documented field?
    Personally I think it is laborious and looks clumsy when reading the source code, but I know that some of the golang linters enforce this rule...is it because it is used by the godoc tool to match comments to fields? If so, perhaps we should just automatically enforce this through a linting tool.
  • Use of full stops. Most doc strings have them, some don't. Can we use a linting tool to enforce this too?
  • Use Certificate vs certificate when talking about Certificate custom resources vs x509 certificate.

pkg/apis/acme/v1alpha3/types_issuer.go Outdated Show resolved Hide resolved
pkg/apis/acme/v1alpha3/types_issuer.go Show resolved Hide resolved
pkg/apis/acme/v1alpha3/types_issuer.go Outdated Show resolved Hide resolved
pkg/apis/acme/v1alpha3/types_issuer.go Show resolved Hide resolved
pkg/apis/acme/v1alpha3/types_issuer.go Show resolved Hide resolved
PrivateKey cmmeta.SecretKeySelector `json:"privateKeySecretRef"`

// Solvers is a list of challenge solvers that will be used to solve
// ACME challenges for the matching domains.
// Solver configurations must be provided in order to obtain certificates
// from an ACME server.
// For more information, see: https://cert-manager.io/docs/configuration/acme/
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this would be a better place to explain that solvers are used in order of DNS specificity.
Currently this is explained below on the ACMEChallengeSolver > Selector field

type ACMEChallengeSolver struct {
// Selector selects a set of DNSNames on the Certificate resource that
// should be solved using this challenge solver.
// If not specified, the solver will be treated as the 'default' solver
// with the lowest priority, i.e. if any other solver has a more specific
// match, it will be used instead.
Copy link
Member

Choose a reason for hiding this comment

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

This took me a while to understand this. I think it would be worth describe this solver priority on the ACMEIssuer > Solvers field as well or instead.

pkg/apis/acme/v1alpha3/types_issuer.go Show resolved Hide resolved
pkg/apis/acme/v1alpha3/types_issuer.go Show resolved Hide resolved
pkg/apis/acme/v1alpha3/types_issuer.go Show resolved Hide resolved
Copy link
Member

@wallrj wallrj left a comment

Choose a reason for hiding this comment

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

A few more comments and suggestions.

I only reviewed the v1alpha3 docs, not the internal, or v1alpha2 docs....on the basis that the suggestions apply to those versions too (where applicable).

It's great that you've added all this extra detail. Thanks.

pkg/apis/acme/v1alpha3/types_order.go Show resolved Hide resolved
pkg/apis/certmanager/v1alpha3/types.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha3/types_issuer.go Show resolved Hide resolved
pkg/apis/certmanager/v1alpha3/types_issuer.go Show resolved Hide resolved
pkg/apis/certmanager/v1alpha3/types_issuer.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha3/types_issuer.go Outdated Show resolved Hide resolved
pkg/apis/certmanager/v1alpha3/types_issuer.go Show resolved Hide resolved
pkg/apis/meta/v1/types.go Show resolved Hide resolved
pkg/apis/meta/v1/types.go Show resolved Hide resolved
// ACMEIssuer contains the specification for an ACME issuer.
// This uses the RFC8555 specification to obtain certificates by completing
// 'challenges' to prove ownership of domain identifiers.
// Earlier draft versions of the ACME specification are not supported.
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to document the internal types too? Do these ever get published? It seems like we need a tool to automate the syncing of these doc strings.

Copy link
Member Author

Choose a reason for hiding this comment

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

They don't get published, but I opted to do this a) for consistency with other API doc packages, b) because it's not that difficult to copy and paste them over and c) for consistency with upstream APIs 😄

+1 to something to automate syncing, although there are slight tweaks made (e.g. removing the kubebuilder annotations and the optional markers etc)

@jetstack-bot jetstack-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 26, 2020
@jetstack-bot jetstack-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 26, 2020
@jetstack-bot jetstack-bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. and removed dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. labels Jun 26, 2020
@jetstack-bot jetstack-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 26, 2020
Signed-off-by: James Munnelly <james@munnelly.eu>
Signed-off-by: James Munnelly <james@munnelly.eu>
…ationKey

Signed-off-by: James Munnelly <james@munnelly.eu>
Signed-off-by: James Munnelly <james@munnelly.eu>
Signed-off-by: James Munnelly <james@munnelly.eu>
Signed-off-by: James Munnelly <james@munnelly.eu>
Signed-off-by: James Munnelly <james@munnelly.eu>
Signed-off-by: James Munnelly <james@munnelly.eu>
Signed-off-by: James Munnelly <james@munnelly.eu>
Signed-off-by: James Munnelly <james@munnelly.eu>
Signed-off-by: James Munnelly <james@munnelly.eu>
@jetstack-bot jetstack-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 26, 2020
Signed-off-by: James Munnelly <james@munnelly.eu>
@munnerz munnerz changed the title Update API type documentation for 'certmanager' and 'meta' API groups Update API type documentation for 'certmanager', 'meta' and 'acme' API groups Jun 26, 2020
Copy link
Member

@wallrj wallrj left a comment

Choose a reason for hiding this comment

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

Thanks @munnerz

/lgtm

@jetstack-bot jetstack-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2020
@jetstack-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: munnerz, wallrj

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

@munnerz
Copy link
Member Author

munnerz commented Jun 26, 2020

/kind cleanup

@jetstack-bot jetstack-bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Jun 26, 2020
@jetstack-bot jetstack-bot merged commit 9dc044d into cert-manager:master Jun 26, 2020
@munnerz munnerz deleted the update-api-doc-comments branch June 26, 2020 15:08
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. area/api Indicates a PR directly modifies the 'pkg/apis' directory area/deploy Indicates a PR modifies deployment configuration area/testing Issues relating to testing dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants