Skip to content

Commit

Permalink
feat: Add default values to template
Browse files Browse the repository at this point in the history
  • Loading branch information
fengye87 committed Jul 15, 2022
1 parent ca4752c commit 25fb0ed
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 270 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ jobs:
infrastructure-components.yaml
metadata.yaml
templates/cluster-template.yaml
templates/cluster-template-external.yaml
templates/cluster-template-mhc.yaml
templates/cluster-template-internal.yaml
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@ providers:
Except for the [common variables](https://cluster-api.sigs.k8s.io/clusterctl/provider-contract.html#common-variables) provided by Cluster API, you can further customize your workload cluster on Virtink with following environment variables:
| Variable name | Note |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| VIRTINK_INFRA_CLUSTER_SECRET_NAME | The name of secret in the management cluster that contains the kubeconfig of the Virtink infrastructure cluster |
| VIRTINK_INFRA_CLUSTER_SECRET_NAMESPACE | The namespace of secret in the management cluster that contains the kubeconfig of the Virtink infrastructure cluster |
| VIRTINK_POD_NETWORK_CIDR | The pod network CIDR to use for the workload cluster (default `10.17.0.0/16`) |
| VIRTINK_SERVICE_CIDR | The service network CIDR to use for the workload cluster (default `10.112.0.0/12`) |
| VIRTINK_MACHINE_CPU_COUNT | The number of VM vCPUs (default `2`) |
| VIRTINK_MACHINE_MEMORY_SIZE | The memory size of VM (default `2Gi`) |
| VIRTINK_MACHINE_KERNEL_IMAGE | The kernel image of VM (default `smartxworks/capch-kernel-5.15.12`) |
| VIRTINK_MACHINE_ROOTFS_IMAGE | The rootfs image of VM (default `smartxworks/capch-rootfs-1.24.0`) |
| VIRTINK_MACHINE_ROOTFS_SIZE | The rootfs size of VM (default `4Gi`) |
| Variable name | Note |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
| VIRTINK_INFRA_CLUSTER_SECRET_NAME | The name of secret in the management cluster that contains the kubeconfig of the Virtink infrastructure cluster |
| VIRTINK_INFRA_CLUSTER_SECRET_NAMESPACE | The namespace of secret in the management cluster that contains the kubeconfig of the Virtink infrastructure cluster |
| POD_NETWORK_CIDR | Range of IP addresses for the pod network (default `192.168.0.0/16`) |
| SERVICE_CIDR | Range of IP address for service VIPs (default `10.96.0.0/12`) |
| VIRTINK_CONTROL_PLANE_SERVICE_TYPE | The type of control plane service (default `NodePort`) |
| VIRTINK_CONTROL_PLANE_MACHINE_CPU_CORES | The CPU cores of each control plane machine (default `2`) |
| VIRTINK_CONTROL_PLANE_MACHINE_MEMORY_SIZE | The memory size of each control plane machine (default `4Gi`) |
| VIRTINK_CONTROL_PLANE_MACHINE_KERNEL_IMAGE | The kernel image of control plane machine (default `smartxworks/capch-kernel-5.15.12`) |
| VIRTINK_CONTROL_PLANE_MACHINE_ROOTFS_IMAGE | The rootfs image of control plane machine (default `smartxworks/capch-rootfs-1.24.0`) |
| VIRTINK_CONTROL_PLANE_MACHINE_ROOTFS_SIZE | The rootfs size of each control plane machine (default `4Gi`) |
| VIRTINK_WORKER_MACHINE_CPU_CORES | The CPU cores of each worker machine (default `2`) |
| VIRTINK_WORKER_MACHINE_MEMORY_SIZE | The memory size of each worker machine (default `4Gi`) |
| VIRTINK_WORKER_MACHINE_KERNEL_IMAGE | The kernel image of worker machine (default `smartxworks/capch-kernel-5.15.12`) |
| VIRTINK_WORKER_MACHINE_ROOTFS_IMAGE | The rootfs image of worker machine (default `smartxworks/capch-rootfs-1.24.0`) |
| VIRTINK_WORKER_MACHINE_ROOTFS_SIZE | The rootfs size of each worker machine (default `4Gi`) |

## License

Expand Down
13 changes: 6 additions & 7 deletions controllers/virtinkcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,8 @@ func buildInfraClusterClient(ctx context.Context, c client.Client, infraClusterS
}

func (r *VirtinkClusterReconciler) buildControlPlaneService(ctx context.Context, cluster *infrastructurev1beta1.VirtinkCluster, ownerCluster *capiv1beta1.Cluster) (*corev1.Service, error) {
serviceType := corev1.ServiceTypeNodePort
if cluster.Spec.ControlPlaneServiceType != nil {
serviceType = *cluster.Spec.ControlPlaneServiceType
}
return &corev1.Service{
service := &corev1.Service{
Spec: corev1.ServiceSpec{
Type: serviceType,
Selector: map[string]string{
capiv1beta1.ClusterLabelName: ownerCluster.Name,
capiv1beta1.MachineControlPlaneLabelName: "",
Expand All @@ -214,7 +209,11 @@ func (r *VirtinkClusterReconciler) buildControlPlaneService(ctx context.Context,
TargetPort: intstr.FromInt(6443),
}},
},
}, nil
}
if cluster.Spec.ControlPlaneServiceType != nil {
service.Spec.Type = *cluster.Spec.ControlPlaneServiceType
}
return service, nil
}

// SetupWithManager sets up the controller with the Manager.
Expand Down
157 changes: 0 additions & 157 deletions templates/cluster-template-external.yaml

This file was deleted.

Loading

0 comments on commit 25fb0ed

Please sign in to comment.