Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace LocalObjectReference usage with strings in exp/etcdrestore API #735

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions exp/etcdrestore/api/v1alpha1/etcdmachinesnapshot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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
Expand Down
19 changes: 9 additions & 10 deletions exp/etcdrestore/api/v1alpha1/etcdmachinesnapshotconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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.
Expand Down
16 changes: 2 additions & 14 deletions exp/etcdrestore/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
20 changes: 8 additions & 12 deletions exp/etcdrestore/controllers/snapshotters/rke2snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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,
},
}

Expand Down