BootConfiguration struct for Bootstrap Container

Adding BootConfiguration structure in preparation for the implementation
of Bootstrap Container / Ephemeral Cluster through "phase/executor".

Change-Id: I0239e9c975784703dd6abacbb17b5e15744f3924
This commit is contained in:
Sidney Shiba 2020-10-21 13:40:57 -05:00
parent f164c97e6a
commit e528a89a73
4 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# Generating *zz_generated.deepcopy.go* in api/v1alpha1
This directory contains the data types needed by *airshipctl phase run* command.
When you add a new data structure in this directory you will need to generate the file *zz_generated.deepcopy.go*.
To generate this file you will need the tool *controller-gen" executable.
If you don't have *controller-gen* in your machine, clone the following repository and compile it.
```bash
git clone https://github.com/kubernetes-sigs/controller-tools.git
cd controller-tools/cmd/controller-gen
go build -o controller-gen
```
Now you can generate the *zz_generated.deepcopy.go* using *controller-gen* as follow:
```bash
/path/to/controller-gen object paths=/path/to/airshipctl/pkg/api/v1alpha1/
```
At this point you should have a newly generated *zz_generated.deepcopy.go*.
Just check if your data structure has been added to this file and you are good to go.
>TODO: Add this task in the Makefile

View File

@ -0,0 +1,48 @@
/*
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.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EphemeralCluster structure contains the data for the ephemeral cluster
type EphemeralCluster struct {
BootstrapCommand string `json:"bootstrapCommand,omitempty"`
ConfigFilename string `json:"configFilename,omitempty"`
}
// BootstrapContainer structure contains the data for the bootstrap container
type BootstrapContainer struct {
ContainerRuntime string `json:"containerRuntime,omitempty"`
Image string `json:"image,omitempty"`
Volume string `json:"volume,omitempty"`
Kubeconfig string `json:"kubeconfig,omitempty"`
}
// BootConfiguration structure is inherited from apimachinery TypeMeta and ObjectMeta and is a top level
// configuration structure for the bootstrap container
type BootConfiguration struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
BootstrapContainer BootstrapContainer `json:"bootstrapContainer"`
EphemeralCluster EphemeralCluster `json:"ephemeralCluster"`
}
// DefaultBootConfiguration can be used to safely unmarshal BootConfiguration object without nil pointers
func DefaultBootConfiguration() *BootConfiguration {
return &BootConfiguration{}
}

View File

@ -51,6 +51,7 @@ func init() {
&ClusterMap{},
&ReplacementTransformer{},
&Templater{},
&BootConfiguration{},
)
_ = AddToScheme(Scheme) //nolint:errcheck
}

View File

@ -56,6 +56,48 @@ func (in *ApplyWaitOptions) DeepCopy() *ApplyWaitOptions {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BootConfiguration) DeepCopyInto(out *BootConfiguration) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.BootstrapContainer = in.BootstrapContainer
out.EphemeralCluster = in.EphemeralCluster
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootConfiguration.
func (in *BootConfiguration) DeepCopy() *BootConfiguration {
if in == nil {
return nil
}
out := new(BootConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *BootConfiguration) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BootstrapContainer) DeepCopyInto(out *BootstrapContainer) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapContainer.
func (in *BootstrapContainer) DeepCopy() *BootstrapContainer {
if in == nil {
return nil
}
out := new(BootstrapContainer)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Builder) DeepCopyInto(out *Builder) {
*out = *in
@ -194,6 +236,21 @@ func (in *Container) DeepCopy() *Container {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EphemeralCluster) DeepCopyInto(out *EphemeralCluster) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EphemeralCluster.
func (in *EphemeralCluster) DeepCopy() *EphemeralCluster {
if in == nil {
return nil
}
out := new(EphemeralCluster)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImageConfiguration) DeepCopyInto(out *ImageConfiguration) {
*out = *in