Matches ctl version to upstream

This commit is contained in:
2026-03-28 20:28:22 +08:00
parent 848daefffe
commit ecceff225f
25 changed files with 591 additions and 159 deletions

View File

@@ -1,54 +1,93 @@
package templates
const MonoKSConfigYAML = `apiVersion: monok8s.io/v1alpha1
kind: MonoKSConfig
metadata:
name: example
namespace: kube-system
spec:
kubernetesVersion: v1.35.3
nodeName: monok8s-master-1
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
bootstrapMode: init
joinKind: worker
cniPlugin: none
allowSchedulingOnControlPlane: true
skipImageCheck: false
kubeProxyNodePortAddresses:
- primary
subjectAltNames:
- 10.0.0.10
nodeLabels:
node-role.kubernetes.io/control-plane: ""
nodeAnnotations: {}
network:
hostname: monok8s-master-1
managementIface: eth0
managementCIDR: 10.0.0.10/24
managementGateway: 10.0.0.1
dnsNameservers:
- 1.1.1.1
- 8.8.8.8
dnsSearchDomains:
- lan
`
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "undecided.project/monok8s/pkg/apis/monok8s/v1alpha1"
buildinfo "undecided.project/monok8s/pkg/buildinfo"
)
const OSUpgradeYAML = `apiVersion: monok8s.io/v1alpha1
kind: OSUpgrade
metadata:
name: example
namespace: kube-system
spec:
version: v0.0.1
imageURL: https://example.invalid/images/monok8s-v0.0.1.img.zst
targetPartition: B
nodeSelector:
- monok8s-master-1
force: false
`
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,
},
}
}