-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adjust CRD and add wildcard * add configuration of deployment webhook * add register of webhook and controller * call deployment webhook directly * remove flatternYaml and add more info * modify deployment webhook failurePolicy * do some modifies * rename missing configrender to overrider * remove the outer of * * fix problems in the comments * fix error in e2e of yurtappoverrider * fix error in e2e of yurtappoverrider * fix error in validating webhook of yurtappoverrider * add more UT * gci writting ut * fix error in ut * add more UT * fix problems in the comments * fix problems in the comments * fix problems in the comments
- Loading branch information
1 parent
f9aaa39
commit 7697c53
Showing
25 changed files
with
2,222 additions
and
16 deletions.
There are no files selected for viewing
144 changes: 144 additions & 0 deletions
144
charts/yurt-manager/crds/apps.openyurt.io_yurtappoverriders.yaml
This file contains 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,144 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.7.0 | ||
creationTimestamp: null | ||
name: yurtappoverriders.apps.openyurt.io | ||
spec: | ||
group: apps.openyurt.io | ||
names: | ||
kind: YurtAppOverrider | ||
listKind: YurtAppOverriderList | ||
plural: yurtappoverriders | ||
shortNames: | ||
- yao | ||
singular: yurtappoverrider | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- description: The subject kind of this overrider. | ||
jsonPath: .subject.kind | ||
name: Subject | ||
type: string | ||
- description: The subject name of this overrider. | ||
jsonPath: .subject.name | ||
name: Name | ||
type: string | ||
- description: CreationTimestamp is a timestamp representing the server time when | ||
this object was created. It is not guaranteed to be set in happens-before | ||
order across separate operations. Clients may not set this value. It is represented | ||
in RFC3339 form and is in UTC. | ||
jsonPath: .metadata.creationTimestamp | ||
name: AGE | ||
type: date | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
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 | ||
entries: | ||
items: | ||
description: Describe detailed multi-region configuration of the subject | ||
Entry describe a set of nodepools and their shared or identical configurations | ||
properties: | ||
items: | ||
items: | ||
description: Item represents configuration to be injected. Only | ||
one of its members may be specified. | ||
properties: | ||
image: | ||
description: ImageItem specifies the corresponding container | ||
and the claimed image | ||
properties: | ||
containerName: | ||
description: ContainerName represents name of the container | ||
in which the Image will be replaced | ||
type: string | ||
imageClaim: | ||
description: ImageClaim represents the claimed image name | ||
which is injected into the container above | ||
type: string | ||
required: | ||
- containerName | ||
- imageClaim | ||
type: object | ||
replicas: | ||
format: int32 | ||
type: integer | ||
type: object | ||
type: array | ||
patches: | ||
description: Convert Patch struct into json patch operation | ||
items: | ||
properties: | ||
operation: | ||
description: Operation represents the operation | ||
enum: | ||
- add | ||
- remove | ||
- replace | ||
type: string | ||
path: | ||
description: Path represents the path in the json patch | ||
type: string | ||
value: | ||
description: Indicates the value of json patch | ||
x-kubernetes-preserve-unknown-fields: true | ||
required: | ||
- operation | ||
- path | ||
type: object | ||
type: array | ||
pools: | ||
items: | ||
type: string | ||
type: array | ||
required: | ||
- pools | ||
type: object | ||
type: array | ||
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 | ||
subject: | ||
description: Describe the object Entries belongs | ||
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 | ||
name: | ||
description: Name is the name of YurtAppSet or YurtAppDaemon | ||
type: string | ||
required: | ||
- name | ||
type: object | ||
required: | ||
- entries | ||
- subject | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
This file contains 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 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
60 changes: 60 additions & 0 deletions
60
cmd/yurt-manager/app/options/yurtappoverridercontroller.go
This file contains 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,60 @@ | ||
/* | ||
Copyright 2023 The OpenYurt Authors. | ||
Licensed under the Apache License, Version 2.0 (the License); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an AS IS BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package options | ||
|
||
import ( | ||
"github.com/spf13/pflag" | ||
|
||
"github.com/openyurtio/openyurt/pkg/yurtmanager/controller/yurtappoverrider/config" | ||
) | ||
|
||
type YurtAppOverriderControllerOptions struct { | ||
*config.YurtAppOverriderControllerConfiguration | ||
} | ||
|
||
func NewYurtAppOverriderControllerOptions() *YurtAppOverriderControllerOptions { | ||
return &YurtAppOverriderControllerOptions{ | ||
&config.YurtAppOverriderControllerConfiguration{}, | ||
} | ||
} | ||
|
||
// AddFlags adds flags related to nodepool for yurt-manager to the specified FlagSet. | ||
func (n *YurtAppOverriderControllerOptions) AddFlags(fs *pflag.FlagSet) { | ||
if n == nil { | ||
return | ||
} | ||
|
||
//fs.BoolVar(&n.CreateDefaultPool, "create-default-pool", n.CreateDefaultPool, "Create default cloud/edge pools if indicated.") | ||
} | ||
|
||
// ApplyTo fills up nodepool config with options. | ||
func (o *YurtAppOverriderControllerOptions) ApplyTo(cfg *config.YurtAppOverriderControllerConfiguration) error { | ||
if o == nil { | ||
return nil | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// Validate checks validation of YurtAppOverriderControllerOptions. | ||
func (o *YurtAppOverriderControllerOptions) Validate() []error { | ||
if o == nil { | ||
return nil | ||
} | ||
errs := []error{} | ||
return errs | ||
} |
This file contains 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
Oops, something went wrong.