-
Notifications
You must be signed in to change notification settings - Fork 15
feat: node scan #944
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
Merged
Merged
feat: node scan #944
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
cd037b6
feat(api): define crds for nodescan
alegrey91 93b23b7
feat: add nodescan logic
alegrey91 bc31efc
feat(helm): add chart for nodescan
alegrey91 cab746e
feat(webhook): add nodescanconfigiration validation
alegrey91 9e71d7c
docs(examples): add nodescan crds
alegrey91 07d28aa
refactor(api): remove unused label
alegrey91 07adad8
style(examples): use real name
alegrey91 7bcf269
fix(controller): use indexer to cleanup node resources
alegrey91 6544508
refactor(controller): remove managedby label where not needed
alegrey91 5958555
refactor(controller): invert logic of validateNodeAgainstConfig function
alegrey91 e69bdbc
refactor(handler): change variable name
alegrey91 7471012
refactor(handler): change variable name
alegrey91 f4d8376
refactor(handlers): use CreateOrUpdate funtion when creating nodesbom
alegrey91 e45efbb
style(handlers): improve logging for node scan sbom
alegrey91 1757dc0
style(messaging): rename variable for registry pattern
alegrey91 20a8044
style(handlers): add godoc to helper functions
alegrey91 9770b93
style: fix golangci-lint errors
alegrey91 ad5b667
test(nodescan): fix stale condition
alegrey91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package v1alpha1 | ||
|
|
||
| // IndexNodeMetadataName is the field index for the digest of a node. | ||
| const ( | ||
| IndexNodeMetadataName = "nodeMetadata.name" | ||
| ) | ||
|
|
||
| // NodeMetadata contains the metadata details of a node. | ||
| type NodeMetadata struct { | ||
| // Name specifies the name of the node. | ||
| Name string `json:"name" protobuf:"bytes,1,req,name=name"` | ||
| // Platform specifies the platform of the image. Example "linux/amd64". | ||
| Platform string `json:"platform" protobuf:"bytes,2,req,name=platform"` | ||
| } | ||
|
|
||
| type NodeMetadataAccessor interface { | ||
| GetNodeMetadata() NodeMetadata | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/apimachinery/pkg/runtime" | ||
| ) | ||
|
|
||
| // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
|
||
| // NodeSBOMList contains a list of Software Bill of Materials for nodes | ||
| type NodeSBOMList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
|
||
| Items []NodeSBOM `json:"items" protobuf:"bytes,2,rep,name=items"` | ||
| } | ||
|
|
||
| // +genclient | ||
| // +genclient:nonNamespaced | ||
| // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
| // +kubebuilder:resource:scope=Cluster | ||
| // +kubebuilder:selectablefield:JSONPath=`.nodeMetadata.name` | ||
| // +kubebuilder:selectablefield:JSONPath=`.nodeMetadata.platform` | ||
|
|
||
| // NodeSBOM represents a Software Bill of Materials of a node | ||
| type NodeSBOM struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
|
||
| NodeMetadata NodeMetadata `json:"nodeMetadata" protobuf:"bytes,2,req,name=nodeMetadata"` | ||
| // SPDX contains the SPDX document of the SBOM in JSON format | ||
| SPDX runtime.RawExtension `json:"spdx" protobuf:"bytes,3,req,name=spdx"` | ||
| } | ||
|
|
||
| func (s *NodeSBOM) GetNodeMetadata() NodeMetadata { | ||
| return s.NodeMetadata | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package v1alpha1 | ||
|
alegrey91 marked this conversation as resolved.
|
||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
|
||
| // NodeVulnerabilityReportList contains a list of NodeVulnerabilityReport | ||
| type NodeVulnerabilityReportList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
|
||
| Items []NodeVulnerabilityReport `json:"items" protobuf:"bytes,2,rep,name=items"` | ||
| } | ||
|
|
||
| // +genclient | ||
| // +genclient:nonNamespaced | ||
| // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
| // +kubebuilder:resource:scope=Cluster | ||
| // +kubebuilder:selectablefield:JSONPath=`.nodeMetadata.name` | ||
| // +kubebuilder:selectablefield:JSONPath=`.nodeMetadata.platform` | ||
|
|
||
| // NodeVulnerabilityReport is the Schema for the scanresults API | ||
| type NodeVulnerabilityReport struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
|
||
| // NodeMetadata contains info about the scanned node | ||
| NodeMetadata NodeMetadata `json:"nodeMetadata" protobuf:"bytes,2,req,name=nodeMetadata"` | ||
|
|
||
| // Report is the actual vulnerability scan report | ||
| Report Report `json:"report" protobuf:"bytes,3,req,name=report"` | ||
| } | ||
|
|
||
| func (v *NodeVulnerabilityReport) GetNodeMetadata() NodeMetadata { | ||
| return v.NodeMetadata | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.