Moved all custom naming into one place

This commit is contained in:
2026-04-03 01:48:07 +08:00
parent 3c0df319d7
commit 1ce15e9ac5
27 changed files with 87 additions and 103 deletions

View File

@@ -14,14 +14,14 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
"undecided.project/monok8s/pkg/crds"
"undecided.project/monok8s/pkg/kube"
templates "undecided.project/monok8s/pkg/templates"
monov1alpha1 "example.com/monok8s/pkg/apis/monok8s/v1alpha1"
"example.com/monok8s/pkg/crds"
"example.com/monok8s/pkg/kube"
templates "example.com/monok8s/pkg/templates"
)
const (
controlAgentName = "control-agent"
controlAgentNodeSelectorKey = "monok8s.io/control-agent"
controlAgentNodeSelectorValue = "true"
controlAgentImage = "localhost/monok8s/control-agent:dev"
kubeconfig = "/etc/kubernetes/admin.conf"
@@ -152,12 +152,12 @@ func applyControlAgentServiceAccount(ctx context.Context, kubeClient kubernetes.
func applyControlAgentClusterRole(ctx context.Context, kubeClient kubernetes.Interface, labels map[string]string) error {
wantRules := []rbacv1.PolicyRule{
{
APIGroups: []string{"monok8s.io"},
APIGroups: []string{monov1alpha1.Group},
Resources: []string{"osupgrades"},
Verbs: []string{"get", "list", "watch"},
},
{
APIGroups: []string{"monok8s.io"},
APIGroups: []string{monov1alpha1.Group},
Resources: []string{"osupgrades/status"},
Verbs: []string{"get", "patch", "update"},
},
@@ -290,7 +290,7 @@ func applyControlAgentDaemonSet(ctx context.Context, kubeClient kubernetes.Inter
HostPID: true,
DNSPolicy: corev1.DNSClusterFirstWithHostNet,
NodeSelector: map[string]string{
controlAgentNodeSelectorKey: controlAgentNodeSelectorValue,
monov1alpha1.ControlAgentKey: controlAgentNodeSelectorValue,
},
Tolerations: []corev1.Toleration{
{Operator: corev1.TolerationOpExists},