kubescape / operator

Operator is an in-cluster component of the Kubescape security platform. It allows clients to connect to itself, listens for commands from the connected clients and controls other in-cluster components according to received commands.
Apache License 2.0
12 stars 20 forks source link

feat: WIP add crdhandler #196

Open XDRAGON2002 opened 8 months ago

XDRAGON2002 commented 8 months ago

Type

Enhancement


Description

This PR introduces the crdhandler package with a focus on handling CustomResourceDefinitions (CRDs) related to Github repositories. The main changes include:


PR changes walkthrough

Relevant files                                                                                                                                 
Enhancement
6 files
github.go                                                                                                     
    crdhandler/github/github.go

    **This file introduces a new package `crdhandler` with a
    subpackage `github`. It contains the
    `GithubRepositoryHandler` struct and its associated methods.
    These methods are responsible for initializing the Github
    repository, extracting frameworks, controls, rules,
    exceptions, and control configurations from the repository,
    and cleaning the repository.**
+284/-0
crd.go                                                                                                           
    crdhandler/crd.go

    **This file introduces the `CrdHandler` struct and its
    associated methods. These methods handle the creation of
    frameworks, controls, rules, exceptions, and control
    configurations in the Kubernetes API.**
+151/-0
types.go                                                                                                       
    crdhandler/github/types.go

    **This file defines various types and structs used in the
    `crdhandler` package, such as `GithubRelease`,
    `GithubCommit`, `FrameworkJson`, `ControlJson`, `RuleJson`,
    `Framework`, `Control`, `Rule`, `Exception`, and
    `ControlConfiguration`.**
+162/-0
utils.go                                                                                                       
    crdhandler/github/utils.go

    **This file provides utility functions for unzipping files,
    which is used in the `crdhandler` package.**
+73/-0
main.go                                                                                                         
    main.go

    **This file has been updated to include the creation of a
    `CrdHandler` instance and the handling of CRDs.**
+5/-0
types.go                                                                                                       
    crdhandler/types.go

    **This file defines the `CrdHandler` struct and the
    `repositoryHandler` interface used in the `crdhandler`
    package.**
+22/-0
Configuration changes
1 files
rule.yaml                                                                                                     
    crds/rule.yaml

    **This file defines the CustomResourceDefinition (CRD) for
    `rules` in the Kubernetes API.**
+25/-0

User description

Overview

This PR adds support for CRDs

Signed Commits

How to Test

go run main.go or build the operator/deploy in cluster

codiumai-pr-agent-free[bot] commented 8 months ago

PR Description updated to latest commit (https://github.com/kubescape/operator/commit/02846357a1e14c9875c34dac19d87800d4e3a349)

codiumai-pr-agent-free[bot] commented 8 months ago

PR Analysis

How to use

Instructions > 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. > 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.