CRD: Move scaling items into scaler, change scope to namespaced (#587)

* Move scaling items into scaler, change scope to namespaced

* added short name nnc
This commit is contained in:
Matthew Long 2020-06-24 10:44:59 -07:00 коммит произвёл GitHub
Родитель 9f82c3f526
Коммит e0cc672ff7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 140 добавлений и 6 удалений

Просмотреть файл

@ -7,4 +7,10 @@ generate: $(GOFILES) controller-gen
.PHONY: controller-gen
controller-gen:
@(cd && GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0)
@(cd && GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0)
.PHONY: manifests
manifests: controller-gen
mkdir -p manifests
controller-gen crd:trivialVersions=true paths="./..." output:crd:artifacts:config=manifests/

Просмотреть файл

@ -25,7 +25,8 @@ import (
// +kubebuilder:object:root=true
// NodeNetworkConfig is the Schema for the nodenetworkconfigs API
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:resource:scope=Namespaced
// +kubebuilder:resource:shortName=nnc
// +kubebuilder:subresource:status
type NodeNetworkConfig struct {
metav1.TypeMeta `json:",inline"`
@ -52,10 +53,15 @@ type NodeNetworkConfigSpec struct {
// NodeNetworkConfigStatus defines the observed state of NetworkConfig
type NodeNetworkConfigStatus struct {
BatchSize int64 `json:"batchSize,omitempty"`
ReleaseThresholdPercent int64 `json:"releaseThresholdPercent,omitempty"`
RequestThresholdPercent int64 `json:"requestThresholdPercent,omitempty"`
NetworkContainers []NetworkContainer `json:"networkContainers,omitempty"`
Scaler Scaler `json:"scaler,omitempty"`
NetworkContainers []NetworkContainer `json:"networkContainers,omitempty"`
}
// Scaler groups IP request params together
type Scaler struct {
BatchSize int64 `json:"batchSize,omitempty"`
ReleaseThresholdPercent int64 `json:"releaseThresholdPercent,omitempty"`
RequestThresholdPercent int64 `json:"requestThresholdPercent,omitempty"`
}
// NetworkContainer defines the structure of a Network Container as found in NetworkConfigStatus

Просмотреть файл

@ -141,6 +141,7 @@ func (in *NodeNetworkConfigSpec) DeepCopy() *NodeNetworkConfigSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeNetworkConfigStatus) DeepCopyInto(out *NodeNetworkConfigStatus) {
*out = *in
out.Scaler = in.Scaler
if in.NetworkContainers != nil {
in, out := &in.NetworkContainers, &out.NetworkContainers
*out = make([]NetworkContainer, len(*in))
@ -159,3 +160,18 @@ func (in *NodeNetworkConfigStatus) DeepCopy() *NodeNetworkConfigStatus {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Scaler) DeepCopyInto(out *Scaler) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Scaler.
func (in *Scaler) DeepCopy() *Scaler {
if in == nil {
return nil
}
out := new(Scaler)
in.DeepCopyInto(out)
return out
}

Просмотреть файл

@ -0,0 +1,106 @@
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: nodenetworkconfigs.acn.azure.com
spec:
group: acn.azure.com
names:
kind: NodeNetworkConfig
listKind: NodeNetworkConfigList
plural: nodenetworkconfigs
shortNames:
- nnc
singular: nodenetworkconfig
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: NodeNetworkConfig is the Schema for the nodenetworkconfigs 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: NodeNetworkConfigSpec defines the desired state of NetworkConfig
properties:
iPsNotInUse:
items:
type: string
type: array
requestedIPCount:
format: int64
type: integer
type: object
status:
description: NodeNetworkConfigStatus defines the observed state of NetworkConfig
properties:
networkContainers:
items:
description: NetworkContainer defines the structure of a Network Container
as found in NetworkConfigStatus
properties:
defaultGateway:
type: string
iPAssignments:
items:
description: IPAssignment groups an IP address and Name. Name
is a UUID set by the the IP address assigner.
properties:
iP:
type: string
name:
type: string
type: object
type: array
id:
type: string
netmask:
description: Netmask for the subnet represented by this NC's SubnetID
type: string
primaryIP:
type: string
subnetID:
type: string
type: object
type: array
scaler:
description: Scaler groups IP request params together
properties:
batchSize:
format: int64
type: integer
releaseThresholdPercent:
format: int64
type: integer
requestThresholdPercent:
format: int64
type: integer
type: object
type: object
type: object
version: v1alpha
versions:
- name: v1alpha
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []