rancher/k3k

Possible wrong data of virtual and shared configuration

クローズ

#229 opened on 2025/02/04

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Go (77 件のフォーク)auto 404
good first issueteam/collie

Repository metrics

Stars
 (886 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Since we are using a simple fmt.Sprintf to create the configration yaml for the virtual and shared agents, without checking the values this could lead to some possible misconfiguration:

func virtualAgentData(serviceIP, token string) string {
	return fmt.Sprintf(`server: https://%s:6443
token: %s
with-node-id: true`, serviceIP, token)
}

func sharedAgentData(cluster *v1alpha1.Cluster, serviceName, token, ip string) string {
	version := cluster.Spec.Version
	if cluster.Spec.Version == "" {
		version = cluster.Status.HostVersion
	}
	return fmt.Sprintf(`clusterName: %s
clusterNamespace: %s
serverIP: %s
serviceName: %s
token: %s
version: %s`,
		cluster.Name, cluster.Namespace, ip, serviceName, token, version)
}

コントリビューターガイド