-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Support using external infra cluster #4
Conversation
bf83b08
to
a817ebe
Compare
a817ebe
to
fc10090
Compare
vm.Spec.Instance.Disks = append(vm.Spec.Instance.Disks, virtv1alpha1.Disk{ | ||
Name: "cloud-init", | ||
}) | ||
vm.Spec.Volumes = append(vm.Spec.Volumes, virtv1alpha1.Volume{ | ||
Name: "cloud-init", | ||
VolumeSource: virtv1alpha1.VolumeSource{ | ||
CloudInit: &virtv1alpha1.CloudInitVolumeSource{ | ||
UserDataSecretName: *ownerMachine.Spec.Bootstrap.DataSecretName, | ||
UserData: string(secret.Data["value"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better we base64 encode it?
7e0b7bc
to
46f7987
Compare
@@ -67,65 +71,136 @@ func (r *VirtinkClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reque | |||
} | |||
|
|||
func (r *VirtinkClusterReconciler) reconcile(ctx context.Context, cluster *infrastructurev1beta1.VirtinkCluster) error { | |||
if !cluster.DeletionTimestamp.IsZero() { | |||
if !controllerutil.ContainsFinalizer(cluster, finalizer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should only add finalizer when object is not deleted. See https://book.kubebuilder.io/reference/using-finalizers.html
@@ -67,7 +69,8 @@ func (r *VirtinkMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reque | |||
} | |||
|
|||
func (r *VirtinkMachineReconciler) reconcile(ctx context.Context, machine *infrastructurev1beta1.VirtinkMachine) error { | |||
if !machine.DeletionTimestamp.IsZero() { | |||
if !controllerutil.ContainsFinalizer(machine, finalizer) { | |||
controllerutil.AddFinalizer(machine, finalizer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, see https://book.kubebuilder.io/reference/using-finalizers.html
46f7987
to
c4ee1b1
Compare
Steps to use external cluster for infrastructure
kubectl create secret generic <secret-name> --from-file=kubeconfig=<kubeconfig-file-path>
VirtinkCluster.Spec.InfraClusterSecretRef
. When nil, the management cluster will be used for infrastructure.VirtinkCluster.Spec.ConrolPlaneServiceType
toLoadBalancer
. You can set this filed toNodePort
orLoadBalancer
(nil for NodePort). When using external cluster,LoadBalancer
is required and its external IP should be reachable in management cluster.