kubescape / storage

Apache License 2.0
1 stars 6 forks source link

Move NP generate to v1beta1 #83

Closed dwertent closed 6 months ago

dwertent commented 6 months ago

Type

enhancement, tests


Description

This PR focuses on moving the Network Policy generation to the v1beta1 version. The main changes include:


PR changes walkthrough

Relevant files                                                                                                                                 
Enhancement
4 files
network_types.go                                                                                       
    pkg/apis/softwarecomposition/v1beta1/network_types.go

    **Made the `PoliciesRef` field in the `GeneratedNetworkPolicy`
    struct optional by adding `omitempty` to its JSON tag.**
+1/-1
networkpolicy.go                                                                                       
    pkg/apis/softwarecomposition/v1beta1/networkpolicy/networkpolicy.go

    **Updated the import path for `softwarecomposition` to point
    to the `v1beta1` version.**
+1/-1
types.go                                                                                                       
    pkg/apis/softwarecomposition/v1beta1/types.go

    **Made the `Relevant` field in the `VulnerabilityCounters`
    struct and the `WorkloadVulnerabilitiesObj` field in the
    `VulnerabilitiesComponents` struct optional by adding
    `omitempty` to their JSON tags.**
+2/-2
generatednetworkpolicy.go                                                                     
    pkg/registry/file/generatednetworkpolicy.go

    **Updated the import paths for `softwarecomposition` and
    `networkpolicy` to point to the `v1beta1` version.**
+2/-2
Tests
2 files
networkpolicy_test.go                                                                             
    pkg/apis/softwarecomposition/v1beta1/networkpolicy/networkpolicy_test.go

    **Updated the import path for `softwarecomposition` in the
    test file to point to the `v1beta1` version.**
+1/-1
generatednetworkpolicy_test.go                                                           
    pkg/registry/file/generatednetworkpolicy_test.go

    **Updated the import path for `softwarecomposition` in the
    test file to point to the `v1beta1` version. Also, made
    changes in the test cases to reflect the updated import
    paths.**
+24/-6

User description

Sorry, we do not accept changes directly against this repository. Please see CONTRIBUTING.md for information on where and how to contribute instead.

codiumai-pr-agent[bot] commented 6 months ago

PR Description updated to latest commit (https://github.com/kubescape/storage/commit/f704a3ad824bb2f73584d101f3ba3f438977138f)

codiumai-pr-agent[bot] commented 6 months ago

PR Analysis

๐Ÿ’ก General suggestions: The PR seems to be well-structured and follows good practices. The changes are clear and the updates to the tests are appropriate. However, it would be beneficial to include more context or reasoning behind why certain fields are now optional.

๐Ÿค– Code feedback:
relevant filepkg/apis/softwarecomposition/v1beta1/network_types.go
suggestion       Consider adding a comment explaining why `PoliciesRef` is now optional. This would provide more context to other developers and maintainers. [medium]
relevant linePoliciesRef []PolicyRef `json:"policyRef,omitempty"`

relevant filepkg/apis/softwarecomposition/v1beta1/types.go
suggestion       Similar to the previous suggestion, it would be helpful to add a comment explaining why `Relevant` and `WorkloadVulnerabilitiesObj` are now optional. [medium]
relevant lineRelevant int `json:"relevant,omitempty"`

relevant filepkg/registry/file/generatednetworkpolicy_test.go
suggestion       It might be beneficial to add more test cases to cover the new optional fields when they are not provided. This would ensure that the code behaves as expected in these scenarios. [important]
relevant lineobjPtr: &softwarecomposition.GeneratedNetworkPolicy{},

โœจ Usage tips:
> To invoke the PR-Agent, add a comment using one of the following commands: > - **/review**: Request a review of your Pull Request. > - **/describe**: Update the PR title and description based on the contents of the PR. > - **/improve [--extended]**: Suggest code improvements. Extended mode provides a higher quality feedback. > - **/ask \**: Ask a question about the PR. > - **/update_changelog**: Update the changelog based on the PR's contents. > - **/add_docs** ๐Ÿ’Ž: Generate docstring for new components introduced in the PR. > - **/generate_labels** ๐Ÿ’Ž: Generate labels for the PR based on the PR's contents. > - **/analyze** ๐Ÿ’Ž: Automatically analyzes the PR, and presents changes walkthrough for each component. >See the [tools guide](https://github.com/Codium-ai/pr-agent/blob/main/docs/TOOLS_GUIDE.md) for more details. >To edit any configuration parameter from the [configuration.toml](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml), add --config_path=new_value. >For example: /review --pr_reviewer.extra_instructions="focus on the file: ..." >To list the possible configuration parameters, add a **/config** comment.
github-actions[bot] commented 6 months ago

Summary: