Generate additional CRDs from API types

'make manifests' attempts to generate all airshipctl API types,
but several types throw errors and the resulting CRDs can't be
properly generated. This change:

- updates the controller-gen version to pull in a bug fix for the
  error 'map values must be a named type, not *ast.StarExpr'
- modifies the Templater type's Values member to be of type JSON
  since controller-gen does not support map[string]interface{},
  and unmarshals it separately in the templater itself
- adds 'image_repositories' to the VersionsCatalogueSpec struct
  to ensure it doesn't get deleted from the schema when manifests
  get regenerated
- checks in generated copies of all CRDs from airshipctl's API
  types, not just catalogues, to be used for validation

Closes: #574
Change-Id: I89a12cfd307a08da9aaec9773eac01169ea43ace
This commit is contained in:
Matthew Fuller 2021-06-21 22:12:49 +00:00
parent 3728b6c0ce
commit 52c5aedc63
22 changed files with 1702 additions and 23 deletions

View File

@ -328,7 +328,7 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.5 ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.1 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen

View File

@ -0,0 +1,93 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: baremetalmanagers.airshipit.org
spec:
group: airshipit.org
names:
kind: BaremetalManager
listKind: BaremetalManagerList
plural: baremetalmanagers
singular: baremetalmanager
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: BaremetalManager allows execution of control operations against
baremetal hosts
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: BaremetalManagerSpec holds configuration for baremetal manager
properties:
hostSelector:
description: BaremetalHostSelector allows to select a host by label
selector, by name and namespace
properties:
labelSelector:
type: string
name:
type: string
namespace:
type: string
required:
- labelSelector
- name
- namespace
type: object
operation:
description: BaremetalOperation defines an operation to be performed
against baremetal host
type: string
operationOptions:
description: BaremetalOperationOptions hold operation options
properties:
remoteDirect:
description: RemoteDirectOptions holds configuration for remote
direct operation
properties:
isoURL:
type: string
required:
- isoURL
type: object
required:
- remoteDirect
type: object
timeout:
description: Timeout in seconds
type: integer
required:
- hostSelector
- operation
- operationOptions
- timeout
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,71 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: bootconfigurations.airshipit.org
spec:
group: airshipit.org
names:
kind: BootConfiguration
listKind: BootConfigurationList
plural: bootconfigurations
singular: bootconfiguration
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: BootConfiguration structure is inherited from apimachinery TypeMeta
and ObjectMeta and is a top level configuration structure for the bootstrap
container
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
bootstrapContainer:
description: BootstrapContainer structure contains the data for the bootstrap
container
properties:
containerRuntime:
type: string
image:
type: string
saveKubeconfigFileName:
type: string
volume:
type: string
type: object
ephemeralCluster:
description: EphemeralCluster structure contains the data for the ephemeral
cluster
properties:
bootstrapCommand:
type: string
configFilename:
type: string
type: object
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
required:
- bootstrapContainer
- ephemeralCluster
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,174 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: clusterctls.airshipit.org
spec:
group: airshipit.org
names:
kind: Clusterctl
listKind: ClusterctlList
plural: clusterctls
singular: clusterctl
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Clusterctl provides information about clusterctl components
properties:
action:
description: ActionType for clusterctl
type: string
additional-vars:
additionalProperties:
type: string
description: AdditionalComponentVariables are variables that will be available
to clusterctl when reading provider components
type: object
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
env-vars:
description: EnvVars if set to true, allows to source variables for cluster-api
components for environment variables.
type: boolean
images:
additionalProperties:
description: ImageMeta is part of clusterctl config
properties:
repository:
type: string
tag:
type: string
type: object
type: object
init-options:
description: InitOptions container with exposed clusterctl InitOptions
properties:
bootstrap-providers:
description: BootstrapProviders and versions (e.g. kubeadm:v0.3.0)
to add to the management cluster. If unspecified, the kubeadm bootstrap
provider's latest release is used.
items:
type: string
type: array
control-plane-providers:
description: ControlPlaneProviders and versions (e.g. kubeadm:v0.3.0)
to add to the management cluster. If unspecified, the kubeadm control
plane provider latest release is used.
items:
type: string
type: array
core-provider:
description: CoreProvider version (e.g. cluster-api:v0.3.0) to add
to the management cluster. If unspecified, the cluster-api core
provider's latest release is used.
type: string
infrastructure-providers:
description: InfrastructureProviders and versions (e.g. aws:v0.5.0)
to add to the management cluster.
items:
type: string
type: array
kubeConfigRef:
description: KubeConfigRef reference to KubeConfig document
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].
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.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
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'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
type: object
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
move-options:
description: MoveOptions carries the options supported by move.
properties:
namespace:
description: The namespace where the workload cluster is hosted. If
unspecified, the target context's namespace is used.
type: string
type: object
providers:
items:
description: Provider is part of clusterctl config
properties:
clusterctl-repository:
description: IsClusterctlRepository if set to true, clusterctl provider's
repository implementation will be used if omitted or set to false,
airshipctl repository implementation will be used.
type: boolean
name:
type: string
type:
type: string
url:
type: string
variable-substitution:
description: VariableSubstitution indicates weather you want to
substitute variables in the cluster-api manifests if set to true,
variables will be substituted only if they are defined either
in Environment or in AdditionalComponentVariables, if not they
will be left as is.
type: boolean
versions:
additionalProperties:
type: string
description: Map of versions where each key is a version and value
is path relative to target path of the manifest ignored if IsClusterctlRepository
is set to true
type: object
required:
- name
- type
type: object
type: array
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,102 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: clustermaps.airshipit.org
spec:
group: airshipit.org
names:
kind: ClusterMap
listKind: ClusterMapList
plural: clustermaps
singular: clustermap
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ClusterMap represents cluster defined for this manifest
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
map:
additionalProperties:
description: Cluster uniquely identifies a cluster and its parent cluster
properties:
kubeconfigSources:
description: KubeconfigContext is the context in kubeconfig, default
is equals to clusterMap key
items:
description: KubeconfigSource describes source of the kubeconfig
properties:
bundle:
description: KubeconfigSourceBundle get kubeconfig from bundle
properties:
contextName:
type: string
type: object
clusterAPI:
description: KubeconfigSourceClusterAPI get kubeconfig from
clusterAPI parent cluster
properties:
clusterNamespacedName:
description: NamespacedName is a name combined with namespace
to uniquely identify objects
properties:
name:
type: string
namespace:
type: string
type: object
timeout:
type: string
type: object
filesystem:
description: KubeconfigSourceFilesystem get kubeconfig from
filesystem path
properties:
contextName:
type: string
path:
type: string
type: object
type:
description: KubeconfigSourceType type of source
type: string
required:
- type
type: object
type: array
parent:
description: Parent is a key in ClusterMap.Map that identifies the
name of the parent(management) cluster
type: string
required:
- kubeconfigSources
type: object
description: Keys in this map MUST correspond to context names in kubeconfigs
provided
type: object
metadata:
type: object
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,164 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: genericcontainers.airshipit.org
spec:
group: airshipit.org
names:
kind: GenericContainer
listKind: GenericContainerList
plural: genericcontainers
singular: genericcontainer
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: GenericContainer provides info about generic container
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
config:
description: Config will be passed to stdin of the container together
with other objects more information on easy ways to consume the config
can be found here https://googlecontainertools.github.io/kpt/guides/producer/functions/golang/
type: string
configRef:
description: Reference is a reference to a configuration object, that
must reside in the same bundle as this GenericContainer object, if specified,
Config string will be ignored and referenced object in ConfigRef will
be used into the Config string instead and passed further into the container
stdin
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]. 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.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
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'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
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: Holds container configuration
properties:
airship:
description: Airship container spec
properties:
cmd:
description: Cmd to run inside the container, `["/my-command",
"arg"]`
items:
type: string
type: array
containerRuntime:
description: ContainerRuntime currently supported and default
runtime is "docker"
type: string
privileged:
description: Privileged identifies if the container is to be run
in a Privileged mode
type: boolean
type: object
envVars:
description: EnvVars is a slice of env string that will be exposed
to container ["MY_VAR=my-value, "MY_VAR1=my-value1"] if passed in
format ["MY_ENV"] this env variable will be exported the container
items:
type: string
type: array
hostNetwork:
description: HostNetwork defines network specific configuration
type: boolean
image:
description: Image is the container image to run
type: string
krm:
description: KRM container function spec
type: object
mounts:
description: Mounts are the storage or directories to mount into the
container
items:
description: StorageMount represents a container's mounted storage
option(s) copy from https://github.com/kubernetes-sigs/kustomize
to avoid imports in this package
properties:
dst:
description: The path where the file or directory is mounted
in the container.
type: string
rw:
description: Mount in ReadWrite mode if it's explicitly configured
See https://docs.docker.com/storage/bind-mounts/#use-a-read-only-bind-mount
type: boolean
src:
description: 'Source for the storage to be mounted. For named
volumes, this is the name of the volume. For anonymous volumes,
this field is omitted (empty string). For bind mounts, this
is the path to the file or directory on the host. If provided
path is relative, it will be expanded to absolute one by following
patterns: - if starts with ''~/'' or contains only ''~'' :
$HOME + Src - in other cases : TargetPath + Src'
type: string
type:
description: Type of mount e.g. bind mount, local volume, etc.
type: string
type: object
type: array
sinkOutputDir:
description: Executor will write output using kustomize sink if this
parameter is specified. Else it will write output to STDOUT. This
path relative to current site root.
type: string
type:
description: Supported types are "airship" and "krm"
type: string
type: object
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,138 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: isoconfigurations.airshipit.org
spec:
group: airshipit.org
names:
kind: IsoConfiguration
listKind: IsoConfigurationList
plural: isoconfigurations
singular: isoconfiguration
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: IsoConfiguration structure is inherited from apimachinery TypeMeta
and ObjectMeta and is a top level configuration structure for building image
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
builder:
description: Isogen structure defines document selection criteria for
cloud-init metadata
properties:
networkConfigKey:
description: Cloud init network config will be retrieved from this
document key
type: string
networkConfigSelector:
description: Cloud Init network config will be retrieved from the
doc matching this object
properties:
selector:
description: Selector specifies a set of resources. Any resource
that matches intersection of all conditions is included in this
set.
properties:
annotationSelector:
description: AnnotationSelector is a string that follows the
label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource annotations.
type: string
group:
type: string
kind:
type: string
labelSelector:
description: LabelSelector is a string that follows the label
selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource labels.
type: string
name:
type: string
namespace:
type: string
version:
type: string
type: object
type: object
outputFileName:
description: File name to use for the output image that will be written
to the container volume root
type: string
userDataKey:
description: Cloud init user data will be retrieved from this document
key
type: string
userDataSelector:
description: Cloud Init user data will be retrieved from the doc matching
this object
properties:
selector:
description: Selector specifies a set of resources. Any resource
that matches intersection of all conditions is included in this
set.
properties:
annotationSelector:
description: AnnotationSelector is a string that follows the
label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource annotations.
type: string
group:
type: string
kind:
type: string
labelSelector:
description: LabelSelector is a string that follows the label
selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource labels.
type: string
name:
type: string
namespace:
type: string
version:
type: string
type: object
type: object
type: object
container:
description: IsoContainer structure contains parameters related to Docker
runtime, used for building image
properties:
containerRuntime:
description: Container Runtime Interface driver
type: string
image:
description: ISO generator container image URL
type: string
volume:
description: Container volume directory binding.
type: string
type: object
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
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,358 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: kubeconfigs.airshipit.org
spec:
group: airshipit.org
names:
kind: KubeConfig
listKind: KubeConfigList
plural: kubeconfigs
singular: kubeconfig
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: KubeConfig object for k8s client
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
config:
description: Config holds the information needed to build connect to remote
kubernetes clusters as a given user
properties:
apiVersion:
description: 'Legacy field from pkg/api/types.go TypeMeta. TODO(jlowdermilk):
remove this after eliminating downstream dependencies.'
type: string
clusters:
description: Clusters is a map of referencable names to cluster configs
items:
description: NamedCluster relates nicknames to cluster information
properties:
cluster:
description: Cluster holds the cluster information
properties:
certificate-authority:
description: CertificateAuthority is the path to a cert
file for the certificate authority.
type: string
certificate-authority-data:
description: CertificateAuthorityData contains PEM-encoded
certificate authority certificates. Overrides CertificateAuthority
format: byte
type: string
extensions:
description: Extensions holds additional information. This
is useful for extenders so that reads and writes don't
clobber unknown fields
items:
description: NamedExtension relates nicknames to extension
information
properties:
extension:
description: Extension holds the extension information
type: object
name:
description: Name is the nickname for this Extension
type: string
required:
- extension
- name
type: object
type: array
insecure-skip-tls-verify:
description: InsecureSkipTLSVerify skips the validity check
for the server's certificate. This will make your HTTPS
connections insecure.
type: boolean
server:
description: Server is the address of the kubernetes cluster
(https://hostname:port).
type: string
required:
- server
type: object
name:
description: Name is the nickname for this Cluster
type: string
required:
- cluster
- name
type: object
type: array
contexts:
description: Contexts is a map of referencable names to context configs
items:
description: NamedContext relates nicknames to context information
properties:
context:
description: Context holds the context information
properties:
cluster:
description: Cluster is the name of the cluster for this
context
type: string
extensions:
description: Extensions holds additional information. This
is useful for extenders so that reads and writes don't
clobber unknown fields
items:
description: NamedExtension relates nicknames to extension
information
properties:
extension:
description: Extension holds the extension information
type: object
name:
description: Name is the nickname for this Extension
type: string
required:
- extension
- name
type: object
type: array
namespace:
description: Namespace is the default namespace to use on
unspecified requests
type: string
user:
description: AuthInfo is the name of the authInfo for this
context
type: string
required:
- cluster
- user
type: object
name:
description: Name is the nickname for this Context
type: string
required:
- context
- name
type: object
type: array
current-context:
description: CurrentContext is the name of the context that you would
like to use by default
type: string
extensions:
description: Extensions holds additional information. This is useful
for extenders so that reads and writes don't clobber unknown fields
items:
description: NamedExtension relates nicknames to extension information
properties:
extension:
description: Extension holds the extension information
type: object
name:
description: Name is the nickname for this Extension
type: string
required:
- extension
- name
type: object
type: array
kind:
description: 'Legacy field from pkg/api/types.go TypeMeta. TODO(jlowdermilk):
remove this after eliminating downstream dependencies.'
type: string
preferences:
description: Preferences holds general information to be use for cli
interactions
properties:
colors:
type: boolean
extensions:
description: Extensions holds additional information. This is
useful for extenders so that reads and writes don't clobber
unknown fields
items:
description: NamedExtension relates nicknames to extension information
properties:
extension:
description: Extension holds the extension information
type: object
name:
description: Name is the nickname for this Extension
type: string
required:
- extension
- name
type: object
type: array
type: object
users:
description: AuthInfos is a map of referencable names to user configs
items:
description: NamedAuthInfo relates nicknames to auth information
properties:
name:
description: Name is the nickname for this AuthInfo
type: string
user:
description: AuthInfo holds the auth information
properties:
as:
description: Impersonate is the username to imperonate. The
name matches the flag.
type: string
as-groups:
description: ImpersonateGroups is the groups to imperonate.
items:
type: string
type: array
as-user-extra:
additionalProperties:
items:
type: string
type: array
description: ImpersonateUserExtra contains additional information
for impersonated user.
type: object
auth-provider:
description: AuthProvider specifies a custom authentication
plugin for the kubernetes cluster.
properties:
config:
additionalProperties:
type: string
type: object
name:
type: string
required:
- config
- name
type: object
client-certificate:
description: ClientCertificate is the path to a client cert
file for TLS.
type: string
client-certificate-data:
description: ClientCertificateData contains PEM-encoded
data from a client cert file for TLS. Overrides ClientCertificate
format: byte
type: string
client-key:
description: ClientKey is the path to a client key file
for TLS.
type: string
client-key-data:
description: ClientKeyData contains PEM-encoded data from
a client key file for TLS. Overrides ClientKey
format: byte
type: string
exec:
description: Exec specifies a custom exec-based authentication
plugin for the kubernetes cluster.
properties:
apiVersion:
description: Preferred input version of the ExecInfo.
The returned ExecCredentials MUST use the same encoding
version as the input.
type: string
args:
description: Arguments to pass to the command when executing
it.
items:
type: string
type: array
command:
description: Command to execute.
type: string
env:
description: Env defines additional environment variables
to expose to the process. These are unioned with the
host's environment, as well as variables client-go
uses to pass argument to the plugin.
items:
description: ExecEnvVar is used for setting environment
variables when executing an exec-based credential
plugin.
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: object
type: array
required:
- command
type: object
extensions:
description: Extensions holds additional information. This
is useful for extenders so that reads and writes don't
clobber unknown fields
items:
description: NamedExtension relates nicknames to extension
information
properties:
extension:
description: Extension holds the extension information
type: object
name:
description: Name is the nickname for this Extension
type: string
required:
- extension
- name
type: object
type: array
password:
description: Password is the password for basic authentication
to the kubernetes cluster.
type: string
token:
description: Token is the bearer token for authentication
to the kubernetes cluster.
type: string
tokenFile:
description: TokenFile is a pointer to a file that contains
a bearer token (as described above). If both Token and
TokenFile are present, Token takes precedence.
type: string
username:
description: Username is the username for basic authentication
to the kubernetes cluster.
type: string
type: object
required:
- name
- user
type: object
type: array
required:
- clusters
- contexts
- current-context
- preferences
- users
type: object
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
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,65 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: kubernetesapplies.airshipit.org
spec:
group: airshipit.org
names:
kind: KubernetesApply
listKind: KubernetesApplyList
plural: kubernetesapplies
singular: kubernetesapply
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: KubernetesApply provides instructions on how to apply resources
to kubernetes cluster
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
config:
description: ApplyConfig provides instructions on how to apply resources
to kubernetes cluster
properties:
pruneOptions:
description: ApplyPruneOptions provides instructions how to prune
for kubernetes resources
properties:
prune:
type: boolean
type: object
waitOptions:
description: ApplyWaitOptions provides instructions how to wait for
kubernetes resources
properties:
timeout:
description: Timeout in seconds
type: integer
type: object
type: object
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
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,66 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: manifestmetadata.airshipit.org
spec:
group: airshipit.org
names:
kind: ManifestMetadata
listKind: ManifestMetadataList
plural: manifestmetadata
singular: manifestmetadata
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ManifestMetadata defines site specific metadata like inventory
and phase path
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
inventory:
description: InventorySpec contains the path to the host inventory
properties:
path:
type: string
required:
- path
type: object
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
phase:
description: PhaseSpec represents configuration for a particular phase.
It contains a reference to the site specific manifest path and doument
entry prefix
properties:
documentEntryPointPrefix:
type: string
path:
type: string
required:
- documentEntryPointPrefix
- path
type: object
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: networkcatalogues.airshipit.org
spec:

View File

@ -0,0 +1,91 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: phaseplans.airshipit.org
spec:
group: airshipit.org
names:
kind: PhasePlan
listKind: PhasePlanList
plural: phaseplans
singular: phaseplan
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: PhasePlan object represents phase execution sequence
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
description:
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
phases:
items:
description: PhaseStep represents phase (or step) within a phase plan
properties:
name:
type: string
namespace:
type: string
type: object
type: array
validation:
description: ValidationConfig represents configuration needed for static
validation
properties:
crdList:
description: CRDList defines list of kustomize entrypoints located
in "TARGET_PATH" where to find additional CRD
items:
type: string
type: array
ignoreMissingSchemas:
description: IgnoreMissingSchemas skips validation for resource definitions
without a schema.
type: boolean
kindsToSkip:
description: KindsToSkip defines Kinds which will be skipped during
validation
items:
type: string
type: array
kubernetesVersion:
description: KubernetesVersion is the version of Kubernetes to validate
against (default "1.18.6").
type: string
schemaLocation:
description: SchemaLocation is the base URL from which to search for
schemas. It can be either a remote location or a local directory
type: string
strict:
description: Strict disallows additional properties not in schema
if set
type: boolean
type: object
required:
- validation
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,128 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: phases.airshipit.org
spec:
group: airshipit.org
names:
kind: Phase
listKind: PhaseList
plural: phases
singular: phase
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Phase object to control deployment steps
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
config:
description: PhaseConfig represents configuration for a particular phase.
It contains a reference to phase runner object which should contain
runner configuration and validation configuration
properties:
documentEntryPoint:
type: string
executorRef:
description: ObjectReference contains enough information to let you
inspect or modify the referred object.
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].
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.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
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'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
siteWideKubeconfig:
type: boolean
validation:
description: ValidationConfig represents configuration needed for
static validation
properties:
crdList:
description: CRDList defines list of kustomize entrypoints located
in "TARGET_PATH" where to find additional CRD
items:
type: string
type: array
ignoreMissingSchemas:
description: IgnoreMissingSchemas skips validation for resource
definitions without a schema.
type: boolean
kindsToSkip:
description: KindsToSkip defines Kinds which will be skipped during
validation
items:
type: string
type: array
kubernetesVersion:
description: KubernetesVersion is the version of Kubernetes to
validate against (default "1.18.6").
type: string
schemaLocation:
description: SchemaLocation is the base URL from which to search
for schemas. It can be either a remote location or a local directory
type: string
strict:
description: Strict disallows additional properties not in schema
if set
type: boolean
type: object
required:
- documentEntryPoint
- executorRef
- validation
type: object
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
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,158 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: replacementtransformers.airshipit.org
spec:
group: airshipit.org
names:
kind: ReplacementTransformer
listKind: ReplacementTransformerList
plural: replacementtransformers
singular: replacementtransformer
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ReplacementTransformer plugin configuration for airship document
model
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
replacements:
description: Replacements list of source and target field to do a replacement
items:
description: Replacement defines how to perform a substitution where
it is from and where it is to.
properties:
source:
description: ReplSource defines where a substitution is from It
can from two different kinds of sources - from a field of one
resource - from a string
properties:
fieldref:
type: string
objref:
description: Target refers to a kubernetes object by Group,
Version, Kind and Name gvk.Gvk contains Group, Version and
Kind APIVersion is added to keep the backward compatibility
of using ObjectReference for Var.ObjRef
properties:
apiVersion:
type: string
group:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
version:
type: string
required:
- name
type: object
value:
type: string
type: object
target:
description: ReplTarget defines where a substitution is to.
properties:
fieldrefs:
items:
type: string
type: array
objref:
description: Selector specifies a set of resources. Any resource
that matches intersection of all conditions is included in
this set.
properties:
annotationSelector:
description: AnnotationSelector is a string that follows
the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource annotations.
type: string
group:
type: string
kind:
type: string
labelSelector:
description: LabelSelector is a string that follows the
label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource labels.
type: string
name:
type: string
namespace:
type: string
version:
type: string
type: object
type: object
targets:
items:
description: ReplTarget defines where a substitution is to.
properties:
fieldrefs:
items:
type: string
type: array
objref:
description: Selector specifies a set of resources. Any resource
that matches intersection of all conditions is included
in this set.
properties:
annotationSelector:
description: AnnotationSelector is a string that follows
the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource annotations.
type: string
group:
type: string
kind:
type: string
labelSelector:
description: LabelSelector is a string that follows the
label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource labels.
type: string
name:
type: string
namespace:
type: string
version:
type: string
type: object
type: object
type: array
required:
- source
- target
- targets
type: object
type: array
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,51 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: templaters.airshipit.org
spec:
group: airshipit.org
names:
kind: Templater
listKind: TemplaterList
plural: templaters
singular: templater
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Templater plugin configuration for airship document model
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
template:
description: Template field is used to specify actual go-template which
is going to be used to render the object defined in Spec field
type: string
values:
description: Values contains map with object parameters to render
x-kubernetes-preserve-unknown-fields: true
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
controller-gen.kubebuilder.io/version: v0.6.1
creationTimestamp: null
name: versionscatalogues.airshipit.org
spec:
@ -195,6 +195,9 @@ spec:
such as "repository" and "tag". Images in this section of the catalog
are grouped by airshipctl function -> images in function.
type: object
image_repositories:
description: Allows for the specification of the image repositories
type: string
images:
additionalProperties:
additionalProperties:
@ -227,10 +230,6 @@ spec:
description: Allows for the specification of the kubernetes version
being used.
type: string
image_repositories:
description: Allows for the specification of the image repositories
being used.
type: string
type: object
type: object
served: true

View File

@ -119,6 +119,6 @@ func DefaultClusterctl() *Clusterctl {
InitOptions: &InitOptions{},
MoveOptions: &MoveOptions{},
Providers: make([]*Provider, 0),
ImageMetas: make(map[string]ImageMeta, 0),
ImageMetas: make(map[string]ImageMeta),
}
}

View File

@ -15,8 +15,8 @@
package v1alpha1
import (
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// +kubebuilder:object:root=true
@ -26,19 +26,14 @@ type Templater struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// NOTE: controller-gen doesn't support map[string]interface{},
// so we'll need to allow arbitrary JSON here and unmarshal it
// in the templater
// Values contains map with object parameters to render
Values map[string]interface{} `json:"values,omitempty"`
Values *v1.JSON `json:"values,omitempty"`
// Template field is used to specify actual go-template which is going
// to be used to render the object defined in Spec field
Template string `json:"template,omitempty"`
}
// NOTE map[string]interface is not supported by controller gen
// DeepCopyInto is copying the receiver, writing into out. in must be non-nil.
func (in *Templater) DeepCopyInto(out *Templater) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Values = runtime.DeepCopyJSON(in.Values)
}

View File

@ -163,6 +163,9 @@ type VersionsCatalogueSpec struct {
// Allows for the specification of the kubernetes version being used.
Kubernetes string `json:"kubernetes,omitempty"`
// Allows for the specification of the image repositories
ImageRepositories string `json:"image_repositories,omitempty"`
}
// +kubebuilder:object:root=true

View File

@ -20,6 +20,7 @@ package v1alpha1
import (
"k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/kustomize/api/types"
)
@ -1624,6 +1625,18 @@ func (in *StorageMount) DeepCopy() *StorageMount {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Templater) DeepCopyInto(out *Templater) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
if in.Values != nil {
in, out := &in.Values, &out.Values
*out = new(apiextensionsv1.JSON)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Templater.
func (in *Templater) DeepCopy() *Templater {
if in == nil {

View File

@ -16,6 +16,7 @@ package templater
import (
"bytes"
"encoding/json"
"fmt"
"text/template"
@ -52,7 +53,7 @@ func funcMapAppend(fma, fmb template.FuncMap) template.FuncMap {
for k, v := range fmb {
_, ok := fma[k]
if ok {
panic(fmt.Errorf("Trying to redefine function %s that already exists", k))
panic(fmt.Errorf("trying to redefine function %s that already exists", k))
}
fma[k] = v
}
@ -70,7 +71,16 @@ func (t *plugin) Filter(items []*yaml.RNode) ([]*yaml.RNode, error) {
if err != nil {
return nil, err
}
if err = tmpl.Execute(out, t.Values); err != nil {
var values interface{}
if t.Values != nil {
if err = json.Unmarshal(t.Values.Raw, &values); err != nil {
return nil, err
}
}
if err = tmpl.Execute(out, values); err != nil {
return nil, err
}

View File

@ -27,7 +27,7 @@ import (
// Selector provides abstraction layer in front of kustomize selector
type Selector struct {
types.Selector
types.Selector `json:"selector,omitempty"`
}
// NewSelector returns instance of Selector container