Skip to content

Commit

Permalink
add StaticPod CRD and controller
Browse files Browse the repository at this point in the history
Signed-off-by: hxcGit <[email protected]>
  • Loading branch information
xavier-hou committed Mar 14, 2023
1 parent d4f1f3a commit 9f7b309
Show file tree
Hide file tree
Showing 21 changed files with 2,498 additions and 0 deletions.
270 changes: 270 additions & 0 deletions charts/openyurt/templates/yurt-manager-auto-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,160 @@
#
# ---------------------------------------------------

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: staticpods.apps.openyurt.io
spec:
group: apps.openyurt.io
names:
categories:
- all
kind: StaticPod
listKind: StaticPodList
plural: staticpods
shortNames:
- sp
singular: staticpod
scope: Cluster
versions:
- additionalPrinterColumns:
- 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
- description: The total number of static pods
jsonPath: .status.totalNumber
name: TotalNumber
type: integer
- description: The number of static pods that desired to be upgraded
jsonPath: .status.desiredNumber
name: DesiredNumber
type: integer
- description: The number of static pods that have been upgraded
jsonPath: .status.upgradedNumber
name: UpgradedNumber
type: integer
- jsonPath: .status.conditions[0].type
name: Status
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: StaticPod is the Schema for the staticpods 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: StaticPodSpec defines the desired state of StaticPod
properties:
staticPodManifest:
description: StaticPodManifest indicates the Static Pod desired to
be upgraded. The corresponding manifest file name is `StaticPodManifest.yaml`.
type: string
staticPodName:
description: StaticPodName indicates the static pod desired to be
upgraded.
type: string
staticPodNamespace:
description: Namespace indicates the namespace of target static pod
type: string
template:
description: An object that describes the desired upgrade static pod.
x-kubernetes-preserve-unknown-fields: true
upgradeStrategy:
description: An upgrade strategy to replace existing static pods with
new ones.
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: Auto upgrade config params. Present only if type
= "auto".
x-kubernetes-int-or-string: true
type:
description: Type of Static Pod upgrade. Can be "auto" or "ota".
type: string
type: object
required:
- staticPodName
type: object
status:
description: StaticPodStatus defines the observed state of StaticPod
properties:
conditions:
description: Represents the latest available observations of StaticPod's
current state.
items:
description: StaticPodCondition describes the state of a StaticPodCondition
at a certain point.
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status
to another.
format: date-time
type: string
message:
description: A human-readable message indicating details about
the transition.
type: string
reason:
description: The reason for the condition's last transition.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of StaticPod condition.
type: string
type: object
type: array
desiredNumber:
description: The number of static pods that should be upgraded.
format: int32
type: integer
totalNumber:
description: The total number of static pods
format: int32
type: integer
upgradedNumber:
description: The number of static pods that have been upgraded.
format: int32
type: integer
required:
- desiredNumber
- totalNumber
- upgradedNumber
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down Expand Up @@ -42,6 +196,32 @@ rules:
- patch
- update
- watch
- apiGroups:
- apps.openyurt.io
resources:
- staticpods
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps.openyurt.io
resources:
- staticpods/finalizers
verbs:
- update
- apiGroups:
- apps.openyurt.io
resources:
- staticpods/status
verbs:
- get
- patch
- update
- apiGroups:
- coordination.k8s.io
resources:
Expand All @@ -54,6 +234,18 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand All @@ -66,6 +258,28 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- pods
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand All @@ -78,3 +292,59 @@ rules:
- patch
- update
- watch
---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
creationTimestamp: null
name: yurt-manager-mutating-webhook-configuration
webhooks:
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: kube-system
path: /mutate-apps-openyurt-io-v1alpha1-staticpod
failurePolicy: Fail
name: mutate.apps.v1alpha1.staticpod.openyurt.io
rules:
- apiGroups:
- apps.openyurt.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- staticpods
sideEffects: None
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
creationTimestamp: null
name: yurt-manager-validating-webhook-configuration
webhooks:
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: kube-system
path: /validate-apps-openyurt-io-v1alpha1-staticpod
failurePolicy: Fail
name: validate.apps.v1alpha1.staticpod.openyurt.io
rules:
- apiGroups:
- apps.openyurt.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- staticpods
sideEffects: None
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ require (
k8s.io/api v0.22.3
k8s.io/apimachinery v0.22.3
k8s.io/apiserver v0.22.3
k8s.io/cli-runtime v0.22.3
k8s.io/client-go v0.22.3
k8s.io/cluster-bootstrap v0.22.3
k8s.io/component-base v0.22.3
Expand Down Expand Up @@ -75,6 +76,7 @@ require (
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.2 // indirect
Expand Down
Loading

0 comments on commit 9f7b309

Please sign in to comment.