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

Add provider family linter #113

Merged
merged 6 commits into from
Jun 13, 2023
Merged

Conversation

ulucinar
Copy link
Contributor

@ulucinar ulucinar commented May 18, 2023

Description of your changes

This PR adds a new linter, ssop-linter, that asserts the following in all the packages in a provider family:

  • Each CRD generated for a provider family is actually packaged in the expected service-scoped provider, e.g., the CRD domains.activedirectory.gcp.upbound.io should be packaged in the provider provider-gcp-activedirectory. The expected suffix for the provider is the short group name (e.g., activedirectory) of the CRD.
  • Each provider has metadata (currently only v1alpha1 API level is supported for the provider metadata)
  • The metadata for each provider package in the family contains the family label with key pkg.crossplane.io/provider-family and the expected value of the config package for the family, e.g., pkg.crossplane.io/provider-family: provider-family-gcp for the GCP family.
  • Each provider package metadata in the family, except for the config package itself, declares a dependency to the family's config package.
  • An optional check for the Upbound authentication annotation on the ProviderConfig CRD in the family's config package
❯ ./_output/bin/darwin_arm64/lint-provider-family --help
usage: ssop-linter [<flags>] <command> [<args> ...]

Linter for the official provider families

Flags:
  --help  Show context-sensitive help (also try --help-long and --help-man).

Commands:
  help [<command>...]
    Show help.

  family --provider-name=PROVIDER-NAME --provider-version=PROVIDER-VERSION [<flags>]
    Checks whether all CRDs generated for a provider family are packaged in the corresponding service-scoped provider and checks the provider metadata.
❯ ./_output/bin/darwin_arm64/lint-provider-family family --help
usage: ssop-linter family --provider-name=PROVIDER-NAME --provider-version=PROVIDER-VERSION [<flags>]

Checks whether all CRDs generated for a provider family are packaged in the corresponding service-scoped provider and checks the provider metadata.

Flags:
  --help                         Show context-sensitive help (also try --help-long and --help-man).
  --crd-dir=./package/crds       Directory containing all the generated CRDs for the provider family.
  --provider-name=PROVIDER-NAME  Provider name such as "aws".
  --provider-version=PROVIDER-VERSION  
                                 Provider family tag to check such as "v0.37.0".
  --package-repo-org="xpkg.upbound.io/upbound-release-candidates"  
                                 Package repo organization with the registry host for the provider family.
  --check-auth-annotation        Check Upbound authentication annotation on the ProviderConfig CRD in the provider family's config package.'

I have:

  • Run make reviewable test to ensure this PR is ready for review.

TODO:

  • Let's also add an optional check for the Upbound authentication annotation on the ProviderConfig CRD in the family's config package.

How has this code been tested

Tested against the AWS, Azure & GCP provider families with versions v0.37.0, v0.34.0 and v0.34.0, respectively, under xpkg.upbound.io/upbound-release-candidates.

Copy link
Contributor

@jeanduplessis jeanduplessis left a comment

Choose a reason for hiding this comment

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

@ulucinar could we move away from ssop naming in favor of the external naming of provider-family. It's more descriptive and should cause less confusion going foward.

@ulucinar ulucinar force-pushed the lint-smaller-providers branch 2 times, most recently from 0fe3953 to a191e97 Compare June 12, 2023 09:21
@ulucinar
Copy link
Contributor Author

ulucinar commented Jun 12, 2023

@ulucinar could we move away from ssop naming in favor of the external naming of provider-family. It's more descriptive and should cause less confusion going foward.

Done. Renamed ssop binary's name as lint-provider-family.

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
…rConfig CRD in package metadata

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
…se-candidates` to `upbound`

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
assert that it is not the config package in lint-provider-family.

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
@ulucinar ulucinar merged commit 0bbdc20 into upbound:main Jun 13, 2023
@ulucinar ulucinar deleted the lint-smaller-providers branch June 13, 2023 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants