From cbc558194bafb9ee5178435ab574bd9f4c8cabd1 Mon Sep 17 00:00:00 2001 From: Nick Sieger Date: Mon, 30 Jan 2023 11:53:03 -0600 Subject: [PATCH] k3dv1alpha4: add HostAliases to config (#270) Signed-off-by: Nick Sieger --- pkg/api/k3dv1alpha4/types.go | 6 +++++ pkg/api/k3dv1alpha4/zz_generated.deepcopy.go | 28 ++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/pkg/api/k3dv1alpha4/types.go b/pkg/api/k3dv1alpha4/types.go index dcdf96e..2269b29 100644 --- a/pkg/api/k3dv1alpha4/types.go +++ b/pkg/api/k3dv1alpha4/types.go @@ -95,6 +95,11 @@ type SimpleConfigRegistries struct { Config string `mapstructure:"config" yaml:"config,omitempty" json:"config,omitempty"` // registries.yaml (k3s config for containerd registry override) } +type SimpleConfigHostAlias struct { + IP string `mapstructure:"ip" yaml:"ip" json:"ip"` + Hostnames []string `mapstructure:"hostnames" yaml:"hostnames" json:"hostnames"` +} + // SimpleConfig describes the toplevel k3d configuration file. type SimpleConfig struct { TypeMeta `yaml:",inline"` @@ -111,6 +116,7 @@ type SimpleConfig struct { Options SimpleConfigOptions `mapstructure:"options" yaml:"options,omitempty" json:"options,omitempty"` Env []EnvVarWithNodeFilters `mapstructure:"env" yaml:"env,omitempty" json:"env,omitempty"` Registries SimpleConfigRegistries `mapstructure:"registries" yaml:"registries,omitempty" json:"registries,omitempty"` + HostAliases []SimpleConfigHostAlias `mapstructure:"hostAliases" yaml:"hostAliases,omitempty" json:"hostAliases,omitempty"` } // SimpleExposureOpts provides a simplified syntax compared to the original k3d.ExposureOpts diff --git a/pkg/api/k3dv1alpha4/zz_generated.deepcopy.go b/pkg/api/k3dv1alpha4/zz_generated.deepcopy.go index 908aaa9..e931fc5 100644 --- a/pkg/api/k3dv1alpha4/zz_generated.deepcopy.go +++ b/pkg/api/k3dv1alpha4/zz_generated.deepcopy.go @@ -150,6 +150,13 @@ func (in *SimpleConfig) DeepCopyInto(out *SimpleConfig) { } } in.Registries.DeepCopyInto(&out.Registries) + if in.HostAliases != nil { + in, out := &in.HostAliases, &out.HostAliases + *out = make([]SimpleConfigHostAlias, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -163,6 +170,27 @@ func (in *SimpleConfig) DeepCopy() *SimpleConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SimpleConfigHostAlias) DeepCopyInto(out *SimpleConfigHostAlias) { + *out = *in + if in.Hostnames != nil { + in, out := &in.Hostnames, &out.Hostnames + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SimpleConfigHostAlias. +func (in *SimpleConfigHostAlias) DeepCopy() *SimpleConfigHostAlias { + if in == nil { + return nil + } + out := new(SimpleConfigHostAlias) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SimpleConfigOptions) DeepCopyInto(out *SimpleConfigOptions) { *out = *in