diff --git a/Makefile b/Makefile index 335a60bc..b7aa481e 100644 --- a/Makefile +++ b/Makefile @@ -173,7 +173,7 @@ CONTROLLER_IMAGE_VERSION ?= $(shell git describe --abbrev=0 2>/dev/null) # Release RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null) PREVIOUS_TAG ?= $(shell git describe --abbrev=0 --exclude $(RELEASE_TAG) 2>/dev/null) -HELM_CHART_TAG := $(shell echo $(RELEASE_TAG) | cut -c 2-) +HELM_CHART_TAG := $(shell echo $(RELEASE_TAG) | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+') RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF) CHART_DIR := charts/rancher-turtles RELEASE_DIR ?= out diff --git a/charts/rancher-turtles/templates/rancher-turtles-exp-etcdrestore-components.yaml b/charts/rancher-turtles/templates/rancher-turtles-exp-etcdrestore-components.yaml index 093e74c6..709be9a7 100644 --- a/charts/rancher-turtles/templates/rancher-turtles-exp-etcdrestore-components.yaml +++ b/charts/rancher-turtles/templates/rancher-turtles-exp-etcdrestore-components.yaml @@ -46,18 +46,7 @@ spec: clusterName: type: string configRef: - description: |- - LocalObjectReference contains enough information to let you locate the - referenced object inside the same namespace. - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic + type: string location: type: string machineName: @@ -369,18 +358,7 @@ spec: endpoint: type: string endpointCAsecret: - description: |- - LocalObjectReference contains enough information to let you locate the - referenced object inside the same namespace. - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic + type: string folder: type: string insecure: @@ -390,18 +368,7 @@ spec: region: type: string s3CredentialSecret: - description: |- - LocalObjectReference contains enough information to let you locate the - referenced object inside the same namespace. - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic + type: string skipSSLVerify: type: boolean type: object diff --git a/exp/etcdrestore/api/v1alpha1/etcdmachinesnapshot_types.go b/exp/etcdrestore/api/v1alpha1/etcdmachinesnapshot_types.go index 4eea1d7e..1285db6c 100644 --- a/exp/etcdrestore/api/v1alpha1/etcdmachinesnapshot_types.go +++ b/exp/etcdrestore/api/v1alpha1/etcdmachinesnapshot_types.go @@ -19,7 +19,6 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - corev1 "k8s.io/api/core/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" ) @@ -42,11 +41,11 @@ const ( // EtcdMachineSnapshotSpec defines the desired state of EtcdMachineSnapshot type EtcdMachineSnapshotSpec struct { - ClusterName string `json:"clusterName"` - MachineName string `json:"machineName"` - ConfigRef corev1.LocalObjectReference `json:"configRef"` - Manual bool `json:"manual"` - Location string `json:"location"` + ClusterName string `json:"clusterName"` + MachineName string `json:"machineName"` + ConfigRef string `json:"configRef"` + Manual bool `json:"manual"` + Location string `json:"location"` } // EtcdSnapshotRestoreStatus defines observed state of EtcdSnapshotRestore diff --git a/exp/etcdrestore/api/v1alpha1/etcdmachinesnapshotconfig_types.go b/exp/etcdrestore/api/v1alpha1/etcdmachinesnapshotconfig_types.go index b60a9429..841c1c36 100644 --- a/exp/etcdrestore/api/v1alpha1/etcdmachinesnapshotconfig_types.go +++ b/exp/etcdrestore/api/v1alpha1/etcdmachinesnapshotconfig_types.go @@ -17,7 +17,6 @@ limitations under the License. package v1alpha1 import ( - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -32,15 +31,15 @@ type LocalConfig struct { } type S3Config struct { - Endpoint string `json:"endpoint,omitempty"` - EndpointCASecret *corev1.LocalObjectReference `json:"endpointCAsecret,omitempty"` - SkipSSLVerify bool `json:"skipSSLVerify,omitempty"` - S3CredentialSecret *corev1.LocalObjectReference `json:"s3CredentialSecret,omitempty"` - Bucket string `json:"bucket,omitempty"` - Region string `json:"region,omitempty"` - Folder string `json:"folder,omitempty"` - Insecure bool `json:"insecure,omitempty"` - Location string `json:"location,omitempty"` + Endpoint string `json:"endpoint,omitempty"` + EndpointCASecret string `json:"endpointCAsecret,omitempty"` + SkipSSLVerify bool `json:"skipSSLVerify,omitempty"` + S3CredentialSecret string `json:"s3CredentialSecret,omitempty"` + Bucket string `json:"bucket,omitempty"` + Region string `json:"region,omitempty"` + Folder string `json:"folder,omitempty"` + Insecure bool `json:"insecure,omitempty"` + Location string `json:"location,omitempty"` } // RKE2EtcdMachineSnapshotConfig is the schema for the snapshot config. diff --git a/exp/etcdrestore/api/v1alpha1/zz_generated.deepcopy.go b/exp/etcdrestore/api/v1alpha1/zz_generated.deepcopy.go index 11060da5..060ca1f6 100644 --- a/exp/etcdrestore/api/v1alpha1/zz_generated.deepcopy.go +++ b/exp/etcdrestore/api/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,6 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/cluster-api/api/v1beta1" ) @@ -88,7 +87,6 @@ func (in *EtcdMachineSnapshotList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EtcdMachineSnapshotSpec) DeepCopyInto(out *EtcdMachineSnapshotSpec) { *out = *in - out.ConfigRef = in.ConfigRef } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdMachineSnapshotSpec. @@ -240,7 +238,7 @@ func (in *RKE2EtcdMachineSnapshotConfig) DeepCopyInto(out *RKE2EtcdMachineSnapsh *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) + out.Spec = in.Spec } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RKE2EtcdMachineSnapshotConfig. @@ -296,7 +294,7 @@ func (in *RKE2EtcdMachineSnapshotConfigList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RKE2EtcdMachineSnapshotConfigSpec) DeepCopyInto(out *RKE2EtcdMachineSnapshotConfigSpec) { *out = *in - in.S3.DeepCopyInto(&out.S3) + out.S3 = in.S3 out.Local = in.Local } @@ -313,16 +311,6 @@ func (in *RKE2EtcdMachineSnapshotConfigSpec) DeepCopy() *RKE2EtcdMachineSnapshot // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *S3Config) DeepCopyInto(out *S3Config) { *out = *in - if in.EndpointCASecret != nil { - in, out := &in.EndpointCASecret, &out.EndpointCASecret - *out = new(v1.LocalObjectReference) - **out = **in - } - if in.S3CredentialSecret != nil { - in, out := &in.S3CredentialSecret, &out.S3CredentialSecret - *out = new(v1.LocalObjectReference) - **out = **in - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S3Config. diff --git a/exp/etcdrestore/config/crd/bases/turtles-capi.cattle.io_etcdmachinesnapshots.yaml b/exp/etcdrestore/config/crd/bases/turtles-capi.cattle.io_etcdmachinesnapshots.yaml index afb14b16..6fcd1ef6 100644 --- a/exp/etcdrestore/config/crd/bases/turtles-capi.cattle.io_etcdmachinesnapshots.yaml +++ b/exp/etcdrestore/config/crd/bases/turtles-capi.cattle.io_etcdmachinesnapshots.yaml @@ -43,18 +43,7 @@ spec: clusterName: type: string configRef: - description: |- - LocalObjectReference contains enough information to let you locate the - referenced object inside the same namespace. - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic + type: string location: type: string machineName: diff --git a/exp/etcdrestore/config/crd/bases/turtles-capi.cattle.io_rke2etcdmachinesnapshotconfigs.yaml b/exp/etcdrestore/config/crd/bases/turtles-capi.cattle.io_rke2etcdmachinesnapshotconfigs.yaml index aafa28f7..f7b409a4 100644 --- a/exp/etcdrestore/config/crd/bases/turtles-capi.cattle.io_rke2etcdmachinesnapshotconfigs.yaml +++ b/exp/etcdrestore/config/crd/bases/turtles-capi.cattle.io_rke2etcdmachinesnapshotconfigs.yaml @@ -55,18 +55,7 @@ spec: endpoint: type: string endpointCAsecret: - description: |- - LocalObjectReference contains enough information to let you locate the - referenced object inside the same namespace. - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic + type: string folder: type: string insecure: @@ -76,18 +65,7 @@ spec: region: type: string s3CredentialSecret: - description: |- - LocalObjectReference contains enough information to let you locate the - referenced object inside the same namespace. - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic + type: string skipSSLVerify: type: boolean type: object diff --git a/exp/etcdrestore/controllers/snapshotters/rke2snapshotter.go b/exp/etcdrestore/controllers/snapshotters/rke2snapshotter.go index 6759188f..89e86f8b 100644 --- a/exp/etcdrestore/controllers/snapshotters/rke2snapshotter.go +++ b/exp/etcdrestore/controllers/snapshotters/rke2snapshotter.go @@ -99,15 +99,13 @@ func (s *RKE2Snapshotter) Sync(ctx context.Context) error { } rke2EtcdMachineSnapshotConfig.Spec.S3 = snapshotrestorev1.S3Config{ - Endpoint: snapshotFile.Spec.S3.Endpoint, - EndpointCASecret: &corev1.LocalObjectReference{ - Name: s3EndpointCASecret.Name, - }, - SkipSSLVerify: snapshotFile.Spec.S3.SkipSSLVerify, - Bucket: snapshotFile.Spec.S3.Bucket, - Region: snapshotFile.Spec.S3.Region, - Insecure: snapshotFile.Spec.S3.Insecure, - Location: snapshotFile.Spec.Location, + Endpoint: snapshotFile.Spec.S3.Endpoint, + EndpointCASecret: s3EndpointCASecret.Name, + SkipSSLVerify: snapshotFile.Spec.S3.SkipSSLVerify, + Bucket: snapshotFile.Spec.S3.Bucket, + Region: snapshotFile.Spec.S3.Region, + Insecure: snapshotFile.Spec.S3.Insecure, + Location: snapshotFile.Spec.Location, } } else { rke2EtcdMachineSnapshotConfig.Spec.Local = snapshotrestorev1.LocalConfig{ @@ -131,9 +129,7 @@ func (s *RKE2Snapshotter) Sync(ctx context.Context) error { Spec: snapshotrestorev1.EtcdMachineSnapshotSpec{ ClusterName: s.cluster.Name, MachineName: machineName, - ConfigRef: corev1.LocalObjectReference{ - Name: snapshotFile.Name, - }, + ConfigRef: snapshotFile.Name, }, }