penguin/monok8s

k8s image for Mono Gateway Dev Kit

clitools/pkg/templates/templates.go

raw ยท 2105 bytes

package templates

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	types "undecided.project/monok8s/pkg/apis/monok8s/v1alpha1"
	buildinfo "undecided.project/monok8s/pkg/buildinfo"
)

func DefaultMonoKSConfig() types.MonoKSConfig {
	return types.MonoKSConfig{
		TypeMeta: metav1.TypeMeta{
			APIVersion: "monok8s.io/v1alpha1",
			Kind:       "MonoKSConfig",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name:      "example",
			Namespace: "kube-system",
		},
		Spec: types.MonoKSConfigSpec{
			KubernetesVersion: buildinfo.Version,
			NodeName:          "monok8s-master-1",

			ClusterRole:      "control-plane",
			InitControlPlane: true,

			ClusterName:   "monok8s",
			ClusterDomain: "cluster.local",

			PodSubnet:     "10.244.0.0/16",
			ServiceSubnet: "10.96.0.0/12",

			APIServerAdvertiseAddress: "10.0.0.10",
			APIServerEndpoint:         "10.0.0.10:6443",

			ContainerRuntimeEndpoint: "unix:///var/run/crio/crio.sock",

			CNIPlugin: "default",

			AllowSchedulingOnControlPlane: true,
			SkipImageCheck:                false,

			KubeProxyNodePortAddresses: []string{
				"primary",
			},

			SubjectAltNames: []string{
				"10.0.0.10",
			},

			NodeLabels: map[string]string{
				"node-role.kubernetes.io/control-plane": "",
			},

			NodeAnnotations: map[string]string{},

			Network: types.NetworkSpec{
				Hostname:        "monok8s-master-1",
				ManagementIface: "eth0",
				ManagementCIDR:  "10.0.0.10/24",
				ManagementGW:    "10.0.0.1",
				DNSNameservers: []string{
					"1.1.1.1",
					"8.8.8.8",
				},
				DNSSearchDomains: []string{
					"lan",
				},
			},
		},
	}
}

func DefaultOSUpgrade() types.OSUpgrade {
	return types.OSUpgrade{
		TypeMeta: metav1.TypeMeta{
			APIVersion: "monok8s.io/v1alpha1",
			Kind:       "OSUpgrade",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name:      "example",
			Namespace: "kube-system",
		},
		Spec: types.OSUpgradeSpec{
			Version:         "v0.0.1",
			ImageURL:        "https://example.invalid/images/monok8s-v0.0.1.img.zst",
			TargetPartition: "B",
			NodeSelector: []string{
				"monok8s-master-1",
			},
			Force: false,
		},
	}
}