Move CRDs to apiextensions.k8s.io/v1

Also updates the vino sample CR to pass validation by removing
some invalid fields.

Closes: #6
Signed-off-by: Sean Eagan <seaneagan1@gmail.com>
Change-Id: I07c41fc3a4f7bf195189032332cf5334d3414b4f
This commit is contained in:
Sean Eagan 2021-04-21 12:46:18 -05:00
parent 31f5e96402
commit 334f2de4aa
7 changed files with 394 additions and 401 deletions

View File

@ -1,5 +1,5 @@
# Build the manager binary
FROM gcr.io/gcp-runtimes/go1-builder:1.13 as builder
FROM gcr.io/gcp-runtimes/go1-builder:1.14 as builder
ENV PATH "/usr/local/go/bin:$PATH"

View File

@ -3,8 +3,8 @@
CONTROLLER_IMG ?= quay.io/airshipit/vino
NODE_LABELER_IMG ?= quay.io/airshipit/nodelabeler
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
# Produce CRDs that work back to Kubernetes 1.16
CRD_OPTIONS ?= crd:crdVersions=v1
TOOLBINDIR := tools/bin

View File

@ -1,6 +1,6 @@
---
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
@ -15,7 +15,9 @@ spec:
plural: ippools
singular: ippool
scope: Namespaced
validation:
versions:
- name: v1
schema:
openAPIV3Schema:
description: IPPool is the Schema for the ippools API
properties:
@ -32,10 +34,10 @@ spec:
metadata:
type: object
spec:
description: IPPoolSpec tracks allocation ranges and statuses within a specific
subnet IPv4 or IPv6 subnet. It has a set of ranges of IPs within the
subnet from which IPs can be allocated by IPAM, and a set of IPs that
are currently allocated already.
description: IPPoolSpec tracks allocation ranges and statuses within a
specific subnet IPv4 or IPv6 subnet. It has a set of ranges of IPs
within the subnet from which IPs can be allocated by IPAM, and a set
of IPs that are currently allocated already.
properties:
allocatedIPs:
items:
@ -57,8 +59,8 @@ spec:
description: MACPrefix defines the MAC prefix to use for VM mac addresses
type: string
nextMAC:
description: NextMAC indicates the next MAC address (in sequence) that
will be provisioned to a VM in this Subnet
description: NextMAC indicates the next MAC address (in sequence)
that will be provisioned to a VM in this Subnet
type: string
ranges:
items:
@ -87,9 +89,6 @@ spec:
description: IPPoolStatus defines the observed state of IPPool
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true
status:

View File

@ -1,6 +1,6 @@
---
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
@ -15,9 +15,9 @@ spec:
plural: vinoes
singular: vino
scope: Namespaced
subresources:
status: {}
validation:
versions:
- name: v1
schema:
openAPIV3Schema:
description: Vino is the Schema for the vinoes API
properties:
@ -37,9 +37,9 @@ spec:
description: VinoSpec defines the desired state of Vino
properties:
bmcCredentials:
description: BMCCredentials contain credentials that will be used to
create BMH nodes sushy tools will use these credentials as well, to
set up authentication
description: BMCCredentials contain credentials that will be used
to create BMH nodes sushy tools will use these credentials as well,
to set up authentication
properties:
password:
type: string
@ -91,11 +91,11 @@ spec:
type: string
type: array
macPrefix:
description: MACPrefix defines the zero-padded MAC prefix to use
for VM mac addresses, and is the first address that will be
allocated sequentially to VMs in this network. If omitted, a
default private MAC prefix will be used. The prefix should be
specified in full MAC notation, e.g. 06:42:42:00:00:00
description: MACPrefix defines the zero-padded MAC prefix to
use for VM mac addresses, and is the first address that will
be allocated sequentially to VMs in this network. If omitted,
a default private MAC prefix will be used. The prefix should
be specified in full MAC notation, e.g. 06:42:42:00:00:00
type: string
name:
description: Network Parameter defined
@ -144,12 +144,12 @@ spec:
additionalProperties:
type: string
description: BMHLabels labels will be copied directly to BMHs
that will be created These labels will override keys from k8s
node, that are specified in vino.NodeLabelKeysToCopy
that will be created These labels will override keys from
k8s node, that are specified in vino.NodeLabelKeysToCopy
type: object
bootInterfaceName:
description: BootInterfaceName references the interface name in
the list of NetworkInterfaces Vino will take this interface
description: BootInterfaceName references the interface name
in the list of NetworkInterfaces Vino will take this interface
find its mac address and use it as bootMACAddress for BMH
type: string
count:
@ -215,8 +215,8 @@ spec:
type: object
type: array
vmBridge:
description: VMBridge defines the single interface name to be used as
a bridge for VMs
description: VMBridge defines the single interface name to be used
as a bridge for VMs
type: string
required:
- bmcCredentials
@ -230,10 +230,10 @@ spec:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a foo's
current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type //
+patchStrategy=merge // +listType=map // +listMapKey=type
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
@ -246,8 +246,8 @@ spec:
format: date-time
type: string
message:
description: message is a human readable message indicating details
about the transition. This may be an empty string.
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
@ -261,11 +261,11 @@ spec:
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers of
specific condition types may define expected values and meanings
for this field, and whether the values are considered a guaranteed
API. The value should be a CamelCase string. This field may
not be empty.
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
@ -296,44 +296,45 @@ spec:
type: array
configMapRef:
description: 'ObjectReference contains enough information to let you
inspect or modify the referred object. --- New uses of this type are
discouraged because of difficulty describing its usage when embedded
in APIs. 1. Ignored fields. It includes many fields which are not
generally honored. For instance, ResourceVersion and FieldPath are
both very rarely valid in actual usage. 2. Invalid usage help. It
inspect or modify the referred object. --- New uses of this type
are discouraged because of difficulty describing its usage when
embedded in APIs. 1. Ignored fields. It includes many fields which
are not generally honored. For instance, ResourceVersion and FieldPath
are both very rarely valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual usage. In most
embedded usages, there are particular restrictions like, "must
refer only to types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when embedded. 3.
Inconsistent validation. Because the usages are different, the validation
rules are different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the dependency
is on the group,resource tuple and the version of the actual struct
is irrelevant. 5. We cannot easily change it. Because this type
is embedded in many locations, updates to this type will affect
numerous schemas. Don''t make new APIs embed an underspecified API
type they do not control. Instead of using this type, create a locally
provided and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
refer only to types A and B" or "UID not honored" or "name must
be restricted". Those cannot be well described when embedded. 3.
Inconsistent validation. Because the usages are different, the
validation rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a URL. This
can produce ambiguity during interpretation and require a REST
mapping. In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in many
locations, updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used type
that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of an
entire object, this string should contain a valid JSON/Go field
access statement, such as desiredState.manifest.containers[2].
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen only
to have some well-defined way of referencing a part of an object.
TODO: this design is not final and this field is subject to change
in the future.'
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
@ -345,8 +346,8 @@ spec:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference is
made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
@ -354,11 +355,10 @@ spec:
type: object
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""

View File

@ -43,8 +43,6 @@ spec:
networkDataTemplate:
name: "test-template"
namespace: "default"
labels:
vmFlavor: master
bootInterfaceName: pxe
networkInterfaces:
- name: vm-infra

View File

@ -43,8 +43,6 @@ spec:
networkDataTemplate:
name: "test-template"
namespace: "default"
labels:
vmFlavor: master
bootInterfaceName: pxe
networkInterfaces:
- name: vm-infra
@ -62,8 +60,6 @@ spec:
networkDataTemplate:
name: "test-template"
namespace: "default"
labels:
vmFlavor: worker
bootInterfaceName: pxe
networkInterfaces:
- name: vm-infra

2
go.mod
View File

@ -1,6 +1,6 @@
module vino
go 1.13
go 1.14
require (
github.com/Masterminds/goutils v1.1.1 // indirect