Skip to content

Commit

Permalink
add kubemod/kubemod
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Hoß <[email protected]>
  • Loading branch information
sebhoss committed Nov 12, 2023
1 parent dad3c46 commit e5acf2e
Show file tree
Hide file tree
Showing 9 changed files with 294 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ Files: crd-catalog/kubeedge/kubeedge/*
Copyright: The kubeedge/kubeedge Authors
License: Apache-2.0

Files: crd-catalog/kubemod/kubemod/*
Copyright: The kubemod/kubemod Authors
License: LicenseRef-Kubemod

Files: crd-catalog/kubernetes-sigs/about-api/*
Copyright: The kubernetes-sigs/about-api Authors
License: Apache-2.0
Expand Down
29 changes: 29 additions & 0 deletions LICENSES/LicenseRef-Kubemod.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2020, KubeMod
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 changes: 8 additions & 0 deletions code-generator/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,13 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[
"https://github.com/kubeedge/kubeedge/blob/master/manifests/charts/cloudcore/crds/router_v1_ruleEndpoint.yaml",
],
},
UpstreamSource {
project_name: "kubemod/kubemod",
license: KUBEMOD,
urls: &[
"https://github.com/kubemod/kubemod/blob/master/config/crd/bases/api.kubemod.io_modrules.yaml",
],
},
UpstreamSource {
project_name: "kubernetes-sigs/about-api",
license: APACHE_V2,
Expand Down Expand Up @@ -2038,3 +2045,4 @@ const AGPL_V3_OR_LATER: &'static str = "AGPL-3.0-or-later";
const GPL_V2_OR_LATER: &'static str = "GPL-2.0-or-later";
const UPL_V1: &'static str = "UPL-1.0";
const MPL_V2: &'static str = "MPL-2.0";
const KUBEMOD: &'static str = "LicenseRef-Kubemod";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--derive=PartialEq
138 changes: 138 additions & 0 deletions crd-catalog/kubemod/kubemod/api.kubemod.io/v1beta1/modrules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
name: modrules.api.kubemod.io
spec:
group: api.kubemod.io
names:
kind: ModRule
listKind: ModRuleList
plural: modrules
singular: modrule
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: ModRule is the Schema for the modrules API
properties:
apiVersion:
description: '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'
type: string
kind:
description: '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'
type: string
metadata:
type: object
spec:
description: ModRuleSpec defines the desired state of ModRule
properties:
admissionOperations:
default:
- CREATE
- UPDATE
description: 'AdmissionOperations specifies which admission hook operations this ModRule applies to. Valid values are: - "CREATE" - the rule applies to all matching resources as they are created. - "UPDATE" - the rule applies to all matching resources as they are updated. - "DELETE" - the rule applies to all matching resources as they are deleted. By default, a ModRule applies to all admission operations.'
items:
description: ModRuleAdmissionOperation describes the operation a ModRule is executed on. Only the following ModRuleAdmissionOperation(s) may be specified.
enum:
- CREATE
- UPDATE
- DELETE
type: string
type: array
executionTier:
default: 0
description: ExecutionTier is a value between -32767 and 32766. ExecutionTier controls when this ModRule will be executed as it relates to the other ModRules loaded in the system. ModRules are matched and executed in tiers, starting with the lowest tier. The results of executing all ModRules in a tier are passed as input to the ModRules in the next tier. This cascading execution continues until the highest tier of ModRules has been executed. ModRules in the same tier are executed in indeterminate order.
type: integer
match:
description: Match is a list of match items which consist of select queries and expected match values or regular expressions. When all match items for an object are positive, the rule is in effect.
items:
description: MatchItem represents a single match query.
properties:
matchFor:
description: 'MatchFor instructs how to match the results against the match... requirements. Valid values are: - "Any" - the match is considered positive if any of the results of select have a match. - "All" - the match is considered positive only if all of the results of select have a match.'
enum:
- Any
- All
type: string
matchRegex:
description: MatchRegex specifies the regular expression to compare the result of Select by. The match is considered positive if at least one of the results of evaluating the select query yields a match when compared to value.
nullable: true
type: string
matchValue:
description: MatchValue specifies the exact value to match the result of Select by. The match is considered positive if at least one of the results of evaluating the select query yields a match when compared to matchValue.
nullable: true
type: string
matchValues:
description: MatchValues specifies a list of values to match the result of Select by. The match is considered positive if at least one of the results of evaluating the select query yields a match when compared to any of the values in the array.
items:
type: string
type: array
negate:
description: Negate indicates whether the match result should be to inverted. Defaults to false.
type: boolean
select:
description: 'Select is a JSONPath query expression: https://goessner.net/articles/JsonPath/ which yields zero or more values. If no match value or regex is specified, if the query yields a non-empty result, the match is considered positive.'
type: string
required:
- select
type: object
minItems: 1
type: array
patch:
description: Patch is a list of patch operations to perform on the matching resources at the time of creation. The value part of a patch operation can be a golang template which accepts the resource as its context. This field must be provided for ModRules of type "patch"
items:
description: PatchOperation represents a single JSON Patch operation.
properties:
op:
description: Operation is the type of JSON Path operation to perform against the target element.
enum:
- add
- replace
- remove
type: string
path:
description: Path is the JSON path to the target element.
type: string
select:
description: 'Optional JSONPath query expression: https://goessner.net/articles/JsonPath/ used to construct path. A patch operation is created for each result of the query. A placeholder is created for each wildcard and filter in the expression. These placeholders can be used when constructing "path". For example, if select is "$.spec.containers[*].ports[[email protected] == 80]" placeholder #0 will point to the index of "containers" and #1 will point to the index of "ports". This allows us to define paths such as "/spec/template/spec/containers/#0/securityContext"'
type: string
value:
description: 'Value is the JSON representation of the modification. The value is a golang template which is evaluated against the context of the target resource. KubeMod performs some analysis of the result of the template evaluation in order to infer its JSON type: - If the value matches the format of a JavaScript number, it is considered to be a number. - If the value matches a boolean literal (true/false), it is considered to be a boolean literal. - If the value matches ''null'', it is considered to be null. - If the value is surrounded by double-quotes, it is considered to be a string. - If the value is surrounded by brackets, it is considered to be a JSON array. - If the value is surrounded by curly braces, it is considered to be a JSON object. - If none of the above is true, the value is considered to be a string.'
nullable: true
type: string
required:
- op
- path
type: object
type: array
rejectMessage:
description: RejectMessage is an optional message displayed when a resource is rejected by a Reject ModRule. The field is a Golang template evaluated in the context of the object being rejected.
type: string
targetNamespaceRegex:
description: TargetNamespaceRegex is optional and only applies to ModRules in "kubemod-system" namespace. Its usage enables cluster-wide matching of namespaced resources.
type: string
type:
description: 'Type describes the type of a ModRule. Valid values are: - "Patch" - the rule performs modifications on all the matching resources as they are created. - "Reject" - the rule rejects the creation of all matching resources.'
enum:
- Patch
- Reject
type: string
required:
- match
- type
type: object
status:
description: ModRuleStatus defines the observed state of ModRule
type: object
type: object
served: true
storage: true
status:
acceptedNames:
kind: ''
plural: ''
conditions: []
storedVersions: []
1 change: 1 addition & 0 deletions kube-custom-resources-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ acme_cert_manager_io_v1 = []
addons_cluster_x_k8s_io_v1alpha4 = []
addons_cluster_x_k8s_io_v1beta1 = []
agent_k8s_elastic_co_v1alpha1 = []
api_kubemod_io_v1beta1 = []
apicodegen_apimatic_io_v1beta1 = []
apiextensions_crossplane_io_v1 = []
apigatewayv2_services_k8s_aws_v1alpha1 = []
Expand Down
1 change: 1 addition & 0 deletions kube-custom-resources-rs/src/api_kubemod_io_v1beta1/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod modrules;
Loading

0 comments on commit e5acf2e

Please sign in to comment.