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

refactor: Embed vulnerabilityreports CRD #484

Merged
merged 1 commit into from
Apr 12, 2021

Conversation

danielpacak
Copy link
Contributor

This change required bumping up Go from v1.15 to v1.16
to take advantage of embed package.

Signed-off-by: Daniel Pacak pacak.daniel@gmail.com

@danielpacak danielpacak requested a review from itaysk April 8, 2021 13:28
@@ -12,6 +12,9 @@ spec:
storage: true
schema:
openAPIV3Schema:
description: |
VulnerabilityReport summarizes vulnerabilities in application dependencies and operating system packages
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just to check that kubectl explain vulnerabilityreports command displays description. We have #409 to document the report schema.

$ kubectl explain vulnerabilityreports
KIND:     VulnerabilityReport
VERSION:  aquasecurity.github.io/v1alpha1

DESCRIPTION:
     VulnerabilityReport summarizes vulnerabilities in application dependencies
     and operating system packages built into container images.


FIELDS:
   apiVersion	<string> -required-
     APIVersion defines the versioned schema of this representation of an
     object. Servers should convert recognized schemas to the latest internal
     value, and may reject unrecognized values. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

   kind	<string> -required-
     Kind is a string value representing the REST resource this object
     represents. Servers may infer this from the endpoint the client submits
     requests to. Cannot be updated. In CamelCase. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

   metadata	<Object> -required-
     Standard object's metadata. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

   report	<Object> -required-

@codecov
Copy link

codecov bot commented Apr 8, 2021

Codecov Report

Merging #484 (4483ed9) into main (748d553) will increase coverage by 0.14%.
The diff coverage is 27.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #484      +/-   ##
==========================================
+ Coverage   69.95%   70.10%   +0.14%     
==========================================
  Files          62       62              
  Lines        3988     3990       +2     
==========================================
+ Hits         2790     2797       +7     
+ Misses        899      895       -4     
+ Partials      299      298       -1     
Impacted Files Coverage Δ
pkg/kube/cr_manager.go 50.00% <27.27%> (-0.69%) ⬇️
pkg/operator/controller/vulnerabilityreport.go 65.02% <0.00%> (-3.30%) ⬇️
pkg/operator/controller/configauditreport.go 66.37% <0.00%> (+1.29%) ⬆️
pkg/operator/controller/ciskubebenchreport.go 67.20% <0.00%> (+6.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 748d553...4483ed9. Read the comment docs.

)

var (
//go:embed deploy/crd/vulnerabilityreports.crd.yaml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We cannot use relative path that start with . or ./.., therefore this embedded.go is in the top level starboard package

@@ -17,208 +11,6 @@ const (
VulnerabilityReportListKind = "VulnerabilityReportList"
)

var (
// TODO Once we migrate to Go 1.16 we can use the embed package to load the CRD from ./deploy/crd/vulnerabilityreports.crd.yaml
VulnerabilityReportsCRD = apiextensionsv1.CustomResourceDefinition{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This Go struct literal was a duplicate of deploy/crd/vulnerabilityreports.crd.yaml

This change required bumping up Go from v1.15 to v1.16
to take advantage of embed package.

Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
@danielpacak danielpacak force-pushed the embed_vulnerabilityreports_crd branch from 583ab45 to 4483ed9 Compare April 10, 2021 23:40
@danielpacak danielpacak merged commit 802cfa7 into main Apr 12, 2021
@danielpacak danielpacak deleted the embed_vulnerabilityreports_crd branch April 12, 2021 07:34
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.

None yet

2 participants