diff --git a/internal/test/envtest/environment.go b/internal/test/envtest/environment.go index af385c8809136..2427707301777 100644 --- a/internal/test/envtest/environment.go +++ b/internal/test/envtest/environment.go @@ -9,10 +9,10 @@ import ( "strings" "testing" + rufiov1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" eksdv1alpha1 "github.com/aws/eks-distro-build-tooling/release/api/v1alpha1" etcdv1 "github.com/aws/etcdadm-controller/api/v1beta1" tinkerbellv1 "github.com/tinkerbell/cluster-api-provider-tinkerbell/api/v1beta1" - rufiov1alpha1 "github.com/tinkerbell/rufio/api/v1alpha1" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" admissionv1beta1 "k8s.io/api/admission/v1beta1" corev1 "k8s.io/api/core/v1" diff --git a/manager/main.go b/manager/main.go index 40075458e4b61..c033d7cc244da 100644 --- a/manager/main.go +++ b/manager/main.go @@ -5,13 +5,13 @@ import ( "flag" "os" + rufiov1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" eksdv1alpha1 "github.com/aws/eks-distro-build-tooling/release/api/v1alpha1" etcdv1 "github.com/aws/etcdadm-controller/api/v1beta1" "github.com/go-logr/logr" nutanixv1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1" "github.com/spf13/pflag" tinkerbellv1 "github.com/tinkerbell/cluster-api-provider-tinkerbell/api/v1beta1" - rufiov1alpha1 "github.com/tinkerbell/rufio/api/v1alpha1" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" diff --git a/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio/machine.go b/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio/machine.go new file mode 100644 index 0000000000000..ad6da73081144 --- /dev/null +++ b/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio/machine.go @@ -0,0 +1,208 @@ +// +kubebuilder:object:generate=true +package rufio + +/* +Copyright 2022 Tinkerbell. + +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. +*/ + +// These types are the Rufio v1alpha1 APIs/types copied from https://github.com/tinkerbell/rufio/tree/main/api/v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects. + GroupVersion = schema.GroupVersion{Group: "bmc.tinkerbell.org", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme. + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) + +// PowerState represents power state of a Machine. +type PowerState string + +const ( + On PowerState = "on" + Off PowerState = "off" + Unknown PowerState = "unknown" + PXE string = "pxe" +) + +// MachineConditionType represents the condition of the Machine. +type MachineConditionType string + +const ( + // Contactable defines that a connection can be made to the Machine. + Contactable MachineConditionType = "Contactable" +) + +// ConditionStatus represents the status of a Condition. +type ConditionStatus string + +const ( + ConditionTrue ConditionStatus = "True" + ConditionFalse ConditionStatus = "False" +) + +// MachineSpec defines desired machine state. +type MachineSpec struct { + // Connection contains connection data for a Baseboard Management Controller. + Connection Connection `json:"connection"` +} + +type ProviderOptions struct { + // IntelAMT contains the options to customize the IntelAMT provider. + // +optional + IntelAMT *IntelAMTOptions `json:"intelAMT"` + + // IPMITOOL contains the options to customize the Ipmitool provider. + // +optional + IPMITOOL *IPMITOOLOptions `json:"ipmitool"` + + // Redfish contains the options to customize the Redfish provider. + // +optional + Redfish *RedfishOptions `json:"redfish"` + + // RPC contains the options to customize the RPC provider. + // +optional + RPC *RPCOptions `json:"rpc"` +} + +// Connection contains connection data for a Baseboard Management Controller. +type Connection struct { + // Host is the host IP address or hostname of the Machine. + // +kubebuilder:validation:MinLength=1 + Host string `json:"host"` + + // Port is the port number for connecting with the Machine. + // +kubebuilder:default:=623 + // +optional + Port int `json:"port"` + + // AuthSecretRef is the SecretReference that contains authentication information of the Machine. + // The Secret must contain username and password keys. This is optional as it is not required when using + // the RPC provider. + // +optional + AuthSecretRef corev1.SecretReference `json:"authSecretRef"` + + // InsecureTLS specifies trusted TLS connections. + InsecureTLS bool `json:"insecureTLS"` + + // ProviderOptions contains provider specific options. + // +optional + ProviderOptions *ProviderOptions `json:"providerOptions,omitempty"` +} + +// MachineStatus defines the observed state of Machine. +type MachineStatus struct { + // Power is the current power state of the Machine. + // +kubebuilder:validation:Enum=on;off;unknown + // +optional + Power PowerState `json:"powerState,omitempty"` + + // Conditions represents the latest available observations of an object's current state. + // +optional + Conditions []MachineCondition `json:"conditions,omitempty"` +} + +// MachineCondition defines an observed condition of a Machine. +type MachineCondition struct { + // Type of the Machine condition. + Type MachineConditionType `json:"type"` + + // Status of the condition. + Status ConditionStatus `json:"status"` + + // LastUpdateTime of the condition. + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` + + // Message is a human readable message indicating with details of the last transition. + // +optional + Message string `json:"message,omitempty"` +} + +// +kubebuilder:object:generate=false +type MachineSetConditionOption func(*MachineCondition) + +// SetCondition applies the cType condition to bm. If the condition already exists, +// it is updated. +func (bm *Machine) SetCondition(cType MachineConditionType, status ConditionStatus, opts ...MachineSetConditionOption) { + var condition *MachineCondition + + // Check if there's an existing condition. + for i, c := range bm.Status.Conditions { + if c.Type == cType { + condition = &bm.Status.Conditions[i] + break + } + } + + // We didn't find an existing condition so create a new one and append it. + if condition == nil { + bm.Status.Conditions = append(bm.Status.Conditions, MachineCondition{ + Type: cType, + }) + condition = &bm.Status.Conditions[len(bm.Status.Conditions)-1] + } + + if condition.Status != status { + condition.Status = status + condition.LastUpdateTime = metav1.Now() + } + + for _, opt := range opts { + opt(condition) + } +} + +// WithMachineConditionMessage sets message m to the MachineCondition. +func WithMachineConditionMessage(m string) MachineSetConditionOption { + return func(c *MachineCondition) { + c.Message = m + } +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:resource:path=machines,scope=Namespaced,categories=tinkerbell,singular=machine + +// Machine is the Schema for the machines API. +type Machine struct { + metav1.TypeMeta `json:""` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineSpec `json:"spec,omitempty"` + Status MachineStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// MachineList contains a list of Machines. +type MachineList struct { + metav1.TypeMeta `json:""` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Machine `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Machine{}, &MachineList{}) +} diff --git a/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio/opts.go b/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio/opts.go new file mode 100644 index 0000000000000..faa2764f031ae --- /dev/null +++ b/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio/opts.go @@ -0,0 +1,113 @@ +package rufio + +import ( + "net/http" + + corev1 "k8s.io/api/core/v1" +) + +// RedfishOptions contains the redfish provider specific options. +type RedfishOptions struct { + // Port that redfish will use for calls. + Port int `json:"port"` +} + +// IPMITOOLOptions contains the ipmitool provider specific options. +type IPMITOOLOptions struct { + // Port that ipmitool will use for calls. + // +optional + Port int `json:"port"` + // CipherSuite that ipmitool will use for calls. + // +optional + CipherSuite string `json:"cipherSuite"` +} + +// IntelAMTOptions contains the intelAMT provider specific options. +type IntelAMTOptions struct { + // Port that intelAMT will use for calls. + Port int `json:"port"` +} + +// HMACAlgorithm is a type for HMAC algorithms. +type HMACAlgorithm string + +// HMACSecrets holds per Algorithm slice secrets. +// These secrets will be used to create HMAC signatures. +type HMACSecrets map[HMACAlgorithm][]corev1.SecretReference + +// RPCOptions defines the configurable options to use when sending rpc notifications. +type RPCOptions struct { + // ConsumerURL is the URL where an rpc consumer/listener is running + // and to which we will send and receive all notifications. + ConsumerURL string `json:"consumerURL"` + // LogNotificationsDisabled determines whether responses from rpc consumer/listeners will be logged or not. + // +optional + LogNotificationsDisabled bool `json:"logNotificationsDisabled"` + // Request is the options used to create the rpc HTTP request. + // +optional + Request RequestOpts `json:"request"` + // Signature is the options used for adding an HMAC signature to an HTTP request. + // +optional + Signature SignatureOpts `json:"signature"` + // HMAC is the options used to create a HMAC signature. + // +optional + HMAC HMACOpts `json:"hmac"` + // Experimental options. + // +optional + Experimental ExperimentalOpts `json:"experimental"` +} + +// RequestOpts are the options used when creating an HTTP request. +type RequestOpts struct { + // HTTPContentType is the content type to use for the rpc request notification. + // +optional + HTTPContentType string `json:"httpContentType"` + // HTTPMethod is the HTTP method to use for the rpc request notification. + // +optional + HTTPMethod string `json:"httpMethod"` + // StaticHeaders are predefined headers that will be added to every request. + // +optional + StaticHeaders http.Header `json:"staticHeaders"` + // TimestampFormat is the time format for the timestamp header. + // +optional + TimestampFormat string `json:"timestampFormat"` + // TimestampHeader is the header name that should contain the timestamp. Example: X-BMCLIB-Timestamp + // +optional + TimestampHeader string `json:"timestampHeader"` +} + +// SignatureOpts are the options used for adding an HMAC signature to an HTTP request. +type SignatureOpts struct { + // HeaderName is the header name that should contain the signature(s). Example: X-BMCLIB-Signature + // +optional + HeaderName string `json:"headerName"` + // AppendAlgoToHeaderDisabled decides whether to append the algorithm to the signature header or not. + // Example: X-BMCLIB-Signature becomes X-BMCLIB-Signature-256 + // When set to true, a header will be added for each algorithm. Example: X-BMCLIB-Signature-256 and X-BMCLIB-Signature-512 + // +optional + AppendAlgoToHeaderDisabled bool `json:"appendAlgoToHeaderDisabled"` + // IncludedPayloadHeaders are headers whose values will be included in the signature payload. Example: X-BMCLIB-My-Custom-Header + // All headers will be deduplicated. + // +optional + IncludedPayloadHeaders []string `json:"includedPayloadHeaders"` +} + +// HMACOpts are the options used to create an HMAC signature. +type HMACOpts struct { + // PrefixSigDisabled determines whether the algorithm will be prefixed to the signature. Example: sha256=abc123 + // +optional + PrefixSigDisabled bool `json:"prefixSigDisabled"` + // Secrets are a map of algorithms to secrets used for signing. + // +optional + Secrets HMACSecrets `json:"secrets"` +} + +// ExperimentalOpts are options we're still learning about and should be used carefully. +type ExperimentalOpts struct { + // CustomRequestPayload must be in json. + // +optional + CustomRequestPayload string `json:"customRequestPayload"` + // DotPath is the path to the json object where the bmclib RequestPayload{} struct will be embedded. For example: object.data.body + // +optional + DotPath string `json:"dotPath"` +} diff --git a/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio/zz_generated.deepcopy.go b/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio/zz_generated.deepcopy.go new file mode 100644 index 0000000000000..e959b8e80fcd3 --- /dev/null +++ b/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio/zz_generated.deepcopy.go @@ -0,0 +1,383 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package rufio + +import ( + "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + "net/http" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Connection) DeepCopyInto(out *Connection) { + *out = *in + out.AuthSecretRef = in.AuthSecretRef + if in.ProviderOptions != nil { + in, out := &in.ProviderOptions, &out.ProviderOptions + *out = new(ProviderOptions) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Connection. +func (in *Connection) DeepCopy() *Connection { + if in == nil { + return nil + } + out := new(Connection) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExperimentalOpts) DeepCopyInto(out *ExperimentalOpts) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExperimentalOpts. +func (in *ExperimentalOpts) DeepCopy() *ExperimentalOpts { + if in == nil { + return nil + } + out := new(ExperimentalOpts) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HMACOpts) DeepCopyInto(out *HMACOpts) { + *out = *in + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make(HMACSecrets, len(*in)) + for key, val := range *in { + var outVal []v1.SecretReference + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make([]v1.SecretReference, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMACOpts. +func (in *HMACOpts) DeepCopy() *HMACOpts { + if in == nil { + return nil + } + out := new(HMACOpts) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in HMACSecrets) DeepCopyInto(out *HMACSecrets) { + { + in := &in + *out = make(HMACSecrets, len(*in)) + for key, val := range *in { + var outVal []v1.SecretReference + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make([]v1.SecretReference, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMACSecrets. +func (in HMACSecrets) DeepCopy() HMACSecrets { + if in == nil { + return nil + } + out := new(HMACSecrets) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPMITOOLOptions) DeepCopyInto(out *IPMITOOLOptions) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPMITOOLOptions. +func (in *IPMITOOLOptions) DeepCopy() *IPMITOOLOptions { + if in == nil { + return nil + } + out := new(IPMITOOLOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IntelAMTOptions) DeepCopyInto(out *IntelAMTOptions) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IntelAMTOptions. +func (in *IntelAMTOptions) DeepCopy() *IntelAMTOptions { + if in == nil { + return nil + } + out := new(IntelAMTOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Machine) DeepCopyInto(out *Machine) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Machine. +func (in *Machine) DeepCopy() *Machine { + if in == nil { + return nil + } + out := new(Machine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Machine) 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 *MachineCondition) DeepCopyInto(out *MachineCondition) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineCondition. +func (in *MachineCondition) DeepCopy() *MachineCondition { + if in == nil { + return nil + } + out := new(MachineCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineList) DeepCopyInto(out *MachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Machine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineList. +func (in *MachineList) DeepCopy() *MachineList { + if in == nil { + return nil + } + out := new(MachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineList) 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 *MachineSpec) DeepCopyInto(out *MachineSpec) { + *out = *in + in.Connection.DeepCopyInto(&out.Connection) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSpec. +func (in *MachineSpec) DeepCopy() *MachineSpec { + if in == nil { + return nil + } + out := new(MachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]MachineCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineStatus. +func (in *MachineStatus) DeepCopy() *MachineStatus { + if in == nil { + return nil + } + out := new(MachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderOptions) DeepCopyInto(out *ProviderOptions) { + *out = *in + if in.IntelAMT != nil { + in, out := &in.IntelAMT, &out.IntelAMT + *out = new(IntelAMTOptions) + **out = **in + } + if in.IPMITOOL != nil { + in, out := &in.IPMITOOL, &out.IPMITOOL + *out = new(IPMITOOLOptions) + **out = **in + } + if in.Redfish != nil { + in, out := &in.Redfish, &out.Redfish + *out = new(RedfishOptions) + **out = **in + } + if in.RPC != nil { + in, out := &in.RPC, &out.RPC + *out = new(RPCOptions) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderOptions. +func (in *ProviderOptions) DeepCopy() *ProviderOptions { + if in == nil { + return nil + } + out := new(ProviderOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RPCOptions) DeepCopyInto(out *RPCOptions) { + *out = *in + in.Request.DeepCopyInto(&out.Request) + in.Signature.DeepCopyInto(&out.Signature) + in.HMAC.DeepCopyInto(&out.HMAC) + out.Experimental = in.Experimental +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RPCOptions. +func (in *RPCOptions) DeepCopy() *RPCOptions { + if in == nil { + return nil + } + out := new(RPCOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RedfishOptions) DeepCopyInto(out *RedfishOptions) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedfishOptions. +func (in *RedfishOptions) DeepCopy() *RedfishOptions { + if in == nil { + return nil + } + out := new(RedfishOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequestOpts) DeepCopyInto(out *RequestOpts) { + *out = *in + if in.StaticHeaders != nil { + in, out := &in.StaticHeaders, &out.StaticHeaders + *out = make(http.Header, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestOpts. +func (in *RequestOpts) DeepCopy() *RequestOpts { + if in == nil { + return nil + } + out := new(RequestOpts) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SignatureOpts) DeepCopyInto(out *SignatureOpts) { + *out = *in + if in.IncludedPayloadHeaders != nil { + in, out := &in.IncludedPayloadHeaders, &out.IncludedPayloadHeaders + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SignatureOpts. +func (in *SignatureOpts) DeepCopy() *SignatureOpts { + if in == nil { + return nil + } + out := new(SignatureOpts) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/api/v1alpha1/thirdparty/tinkerbell/workflow_types.go b/pkg/api/v1alpha1/thirdparty/tinkerbell/workflow_types.go index ece70a3fe0615..c39556c242bae 100644 --- a/pkg/api/v1alpha1/thirdparty/tinkerbell/workflow_types.go +++ b/pkg/api/v1alpha1/thirdparty/tinkerbell/workflow_types.go @@ -1,7 +1,10 @@ -// Package represents https://pkg.go.dev/github.com/tinkerbell/tink@v0.6.0/workflow#pkg-types with json tags. +// Package tinkerbell represents APIs and types copied from the tinkerbell/tink repo. // +kubebuilder:object:generate=true package tinkerbell +// Workflow, Task, and Action are copied from https://pkg.go.dev/github.com/tinkerbell/tink@v0.8.0/workflow#pkg-types. +// json tags have been added. + // Workflow represents a workflow to be executed. type Workflow struct { Version string `json:"version"` diff --git a/pkg/executables/kubectl.go b/pkg/executables/kubectl.go index 923648be3c94a..9d1e0fc3ef59a 100644 --- a/pkg/executables/kubectl.go +++ b/pkg/executables/kubectl.go @@ -16,7 +16,7 @@ import ( eksdv1alpha1 "github.com/aws/eks-distro-build-tooling/release/api/v1alpha1" etcdv1 "github.com/aws/etcdadm-controller/api/v1beta1" "github.com/pkg/errors" - rufiov1alpha1 "github.com/tinkerbell/rufio/api/v1alpha1" + rufiov1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" diff --git a/pkg/providers/tinkerbell/hardware/catalogue.go b/pkg/providers/tinkerbell/hardware/catalogue.go index 64007d1f46fe9..1518b6aebb422 100644 --- a/pkg/providers/tinkerbell/hardware/catalogue.go +++ b/pkg/providers/tinkerbell/hardware/catalogue.go @@ -7,7 +7,7 @@ import ( "io" "os" - rufiov1alpha1 "github.com/tinkerbell/rufio/api/v1alpha1" + rufiov1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" diff --git a/pkg/providers/tinkerbell/hardware/catalogue_bmc.go b/pkg/providers/tinkerbell/hardware/catalogue_bmc.go index 2875761831ade..f5d3ea8947d4d 100644 --- a/pkg/providers/tinkerbell/hardware/catalogue_bmc.go +++ b/pkg/providers/tinkerbell/hardware/catalogue_bmc.go @@ -1,7 +1,7 @@ package hardware import ( - "github.com/tinkerbell/rufio/api/v1alpha1" + v1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/providers/tinkerbell/hardware/catalogue_bmc_test.go b/pkg/providers/tinkerbell/hardware/catalogue_bmc_test.go index 061093f5a0ad7..0a8f65fb39e8d 100644 --- a/pkg/providers/tinkerbell/hardware/catalogue_bmc_test.go +++ b/pkg/providers/tinkerbell/hardware/catalogue_bmc_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/onsi/gomega" - "github.com/tinkerbell/rufio/api/v1alpha1" + v1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/aws/eks-anywhere/pkg/providers/tinkerbell/hardware" diff --git a/pkg/providers/tinkerbell/hardware/kubereader.go b/pkg/providers/tinkerbell/hardware/kubereader.go index d0a16aa0de263..65613ce42840b 100644 --- a/pkg/providers/tinkerbell/hardware/kubereader.go +++ b/pkg/providers/tinkerbell/hardware/kubereader.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - rufiov1alpha1 "github.com/tinkerbell/rufio/api/v1alpha1" + rufiov1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/pkg/providers/tinkerbell/hardware/kubereader_test.go b/pkg/providers/tinkerbell/hardware/kubereader_test.go index 56cbb403addf9..2a5c89856e43d 100644 --- a/pkg/providers/tinkerbell/hardware/kubereader_test.go +++ b/pkg/providers/tinkerbell/hardware/kubereader_test.go @@ -5,7 +5,7 @@ import ( "testing" . "github.com/onsi/gomega" - rufiov1alpha1 "github.com/tinkerbell/rufio/api/v1alpha1" + rufiov1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/providers/tinkerbell/hardware/yaml_test.go b/pkg/providers/tinkerbell/hardware/yaml_test.go index 0e042307b4efb..23cf3e7a7b528 100644 --- a/pkg/providers/tinkerbell/hardware/yaml_test.go +++ b/pkg/providers/tinkerbell/hardware/yaml_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/onsi/gomega" - rufiov1alpha1 "github.com/tinkerbell/rufio/api/v1alpha1" + rufiov1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" corev1 "k8s.io/api/core/v1" apimachineryyaml "k8s.io/apimachinery/pkg/util/yaml" diff --git a/pkg/providers/tinkerbell/reconciler/reconciler.go b/pkg/providers/tinkerbell/reconciler/reconciler.go index 7cd48064004da..c6b26e0817519 100644 --- a/pkg/providers/tinkerbell/reconciler/reconciler.go +++ b/pkg/providers/tinkerbell/reconciler/reconciler.go @@ -8,7 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/pkg/errors" tinkerbellv1 "github.com/tinkerbell/cluster-api-provider-tinkerbell/api/v1beta1" - rufiov1alpha1 "github.com/tinkerbell/rufio/api/v1alpha1" + rufiov1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" diff --git a/pkg/providers/tinkerbell/reconciler/reconciler_test.go b/pkg/providers/tinkerbell/reconciler/reconciler_test.go index 2ad0b2fef5ef8..2b9953aa434aa 100644 --- a/pkg/providers/tinkerbell/reconciler/reconciler_test.go +++ b/pkg/providers/tinkerbell/reconciler/reconciler_test.go @@ -8,7 +8,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" tinkerbellv1 "github.com/tinkerbell/cluster-api-provider-tinkerbell/api/v1beta1" - rufiov1alpha1 "github.com/tinkerbell/rufio/api/v1alpha1" + rufiov1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/providers/tinkerbell/upgrade.go b/pkg/providers/tinkerbell/upgrade.go index bd8fe3ca2f79f..d3f1095d0c675 100644 --- a/pkg/providers/tinkerbell/upgrade.go +++ b/pkg/providers/tinkerbell/upgrade.go @@ -6,7 +6,7 @@ import ( "fmt" "reflect" - rufiov1 "github.com/tinkerbell/rufio/api/v1alpha1" + rufiov1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kerrors "k8s.io/apimachinery/pkg/util/errors" diff --git a/pkg/providers/tinkerbell/upgrade_test.go b/pkg/providers/tinkerbell/upgrade_test.go index c5e05f44c04ea..3ebe0d24fb61b 100644 --- a/pkg/providers/tinkerbell/upgrade_test.go +++ b/pkg/providers/tinkerbell/upgrade_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/golang/mock/gomock" - rufiov1 "github.com/tinkerbell/rufio/api/v1alpha1" + rufiov1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" tinkv1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" corev1 "k8s.io/api/core/v1" diff --git a/test/framework/cluster.go b/test/framework/cluster.go index b5d7fb611b19b..0c0ea42040bbc 100644 --- a/test/framework/cluster.go +++ b/test/framework/cluster.go @@ -19,7 +19,7 @@ import ( "testing" "time" - rapi "github.com/tinkerbell/rufio/api/v1alpha1" + rapi "github.com/aws/eks-anywhere/pkg/api/v1alpha1/thirdparty/tinkerbell/rufio" rctrl "github.com/tinkerbell/rufio/controllers" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors"