Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

apps.openyurt.io/v1beta1 NodePool #104

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions charts/yurt-app-manager/crds/apps.openyurt.io_nodepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
deprecated: true
deprecationWarning: apps.openyurt.io/v1alpha1 NodePool is deprecated in v1.0.0+,
unavailable in v1.2.0+; use apps.openyurt.io/v1beta1 NodePool
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -165,6 +168,151 @@ spec:
storage: true
subresources:
status: {}
- additionalPrinterColumns:
- description: The type of nodepool
jsonPath: .spec.type
name: Type
type: string
- description: The number of ready nodes in the pool
jsonPath: .status.readyNodeNum
name: ReadyNodes
type: integer
- jsonPath: .status.unreadyNodeNum
name: NotReadyNodes
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: NodePool is the Schema for the nodepools 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: NodePoolSpec defines the desired state of NodePool
properties:
annotations:
additionalProperties:
type: string
description: 'If specified, the Annotations will be added to all nodes.
NOTE: existing labels with samy keys on the nodes will be overwritten.'
type: object
labels:
additionalProperties:
type: string
description: 'If specified, the Labels will be added to all nodes.
NOTE: existing labels with samy keys on the nodes will be overwritten.'
type: object
selector:
description: A label query over nodes to consider for adding to the
pool
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
taints:
description: If specified, the Taints will be added to all nodes.
items:
description: The node this Taint is attached to has the "effect"
on any pod that does not tolerate the Taint.
properties:
effect:
description: Required. The effect of the taint on pods that
do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule
and NoExecute.
type: string
key:
description: Required. The taint key to be applied to a node.
type: string
timeAdded:
description: TimeAdded represents the time at which the taint
was added. It is only written for NoExecute taints.
format: date-time
type: string
value:
description: The taint value corresponding to the taint key.
type: string
required:
- effect
- key
type: object
type: array
type:
description: The type of the NodePool
type: string
type: object
status:
description: NodePoolStatus defines the observed state of NodePool
properties:
nodes:
description: The list of nodes' names in the pool
items:
type: string
type: array
readyNodeNum:
description: Total number of ready nodes in the pool.
format: int32
type: integer
unreadyNodeNum:
description: Total number of unready nodes in the pool.
format: int32
type: integer
type: object
type: object
served: true
storage: false
subresources:
status: {}
status:
acceptedNames:
kind: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ spec:
- --namespace={{ .Release.Namespace }}
- --secret-name={{ template "yurt-app-manager.fullname" . }}-admission
- --patch-failure-policy={{ .Values.admissionWebhooks.failurePolicy }}
- --crds={"name":"nodepools.apps.openyurt.io","conversion":{"strategy":"Webhook","webhook":{"clientConfig":{"service":{"name":"{{ template "yurt-app-manager.name" . }}-webhook","namespace":"{{ .Release.Namespace }}","path":"/convert","port":443}},"conversionReviewVersions":["v1beta1","v1alpha1"]}}}
- --patch-mutating=true
- --patch-validating=true
- --log-level=trace
Expand Down
5 changes: 4 additions & 1 deletion cmd/yurt-app-manager/app/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/openyurtio/yurt-app-manager/cmd/yurt-app-manager/options"
"github.com/openyurtio/yurt-app-manager/pkg/projectinfo"
appsv1alpha1 "github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/apis/apps/v1alpha1"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/apis/apps/v1beta1"
extclient "github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/client"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/constant"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/controller"
Expand All @@ -55,9 +56,11 @@ var (

func init() {
_ = clientgoscheme.AddToScheme(scheme)
_ = appsv1alpha1.AddToScheme(scheme)
_ = v1beta1.AddToScheme(scheme)

_ = appsv1alpha1.AddToScheme(clientgoscheme.Scheme)

_ = appsv1alpha1.AddToScheme(scheme)
// +kubebuilder:scaffold:scheme
}

Expand Down
148 changes: 148 additions & 0 deletions config/yurt-app-manager/crd/bases/apps.openyurt.io_nodepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
deprecated: true
deprecationWarning: apps.openyurt.io/v1alpha1 NodePool is deprecated in v1.0.0+,
unavailable in v1.2.0+; use apps.openyurt.io/v1beta1 NodePool
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -165,6 +168,151 @@ spec:
storage: true
subresources:
status: {}
- additionalPrinterColumns:
- description: The type of nodepool
jsonPath: .spec.type
name: Type
type: string
- description: The number of ready nodes in the pool
jsonPath: .status.readyNodeNum
name: ReadyNodes
type: integer
- jsonPath: .status.unreadyNodeNum
name: NotReadyNodes
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: NodePool is the Schema for the nodepools 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: NodePoolSpec defines the desired state of NodePool
properties:
annotations:
additionalProperties:
type: string
description: 'If specified, the Annotations will be added to all nodes.
NOTE: existing labels with samy keys on the nodes will be overwritten.'
type: object
labels:
additionalProperties:
type: string
description: 'If specified, the Labels will be added to all nodes.
NOTE: existing labels with samy keys on the nodes will be overwritten.'
type: object
selector:
description: A label query over nodes to consider for adding to the
pool
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
taints:
description: If specified, the Taints will be added to all nodes.
items:
description: The node this Taint is attached to has the "effect"
on any pod that does not tolerate the Taint.
properties:
effect:
description: Required. The effect of the taint on pods that
do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule
and NoExecute.
type: string
key:
description: Required. The taint key to be applied to a node.
type: string
timeAdded:
description: TimeAdded represents the time at which the taint
was added. It is only written for NoExecute taints.
format: date-time
type: string
value:
description: The taint value corresponding to the taint key.
type: string
required:
- effect
- key
type: object
type: array
type:
description: The type of the NodePool
type: string
type: object
status:
description: NodePoolStatus defines the observed state of NodePool
properties:
nodes:
description: The list of nodes' names in the pool
items:
type: string
type: array
readyNodeNum:
description: Total number of ready nodes in the pool.
format: int32
type: integer
unreadyNodeNum:
description: Total number of unready nodes in the pool.
format: int32
type: integer
type: object
type: object
served: true
storage: false
subresources:
status: {}
status:
acceptedNames:
kind: ""
Expand Down
3 changes: 2 additions & 1 deletion pkg/yurtappmanager/apis/addtoscheme_apps_v1alpha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ package apis

import (
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/apis/apps/v1alpha1"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/apis/apps/v1beta1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme)
AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme, v1beta1.SchemeBuilder.AddToScheme)
}
27 changes: 27 additions & 0 deletions pkg/yurtappmanager/apis/apps/v1alpha1/nodepool_conversion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2022 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.
*/
// +kubebuilder:docs-gen:collapse=Apache License

package v1alpha1

/*
Implementing the hub method is pretty easy -- we just have to add an empty
method called `Hub()` to serve as a
[marker](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/conversion?tab=doc#Hub).
*/

// Hub marks this type as a conversion hub.
func (*NodePool) Hub() {}
Loading