mirror of
https://github.com/rancher/k3k.git
synced 2026-03-04 18:54:14 +00:00
* Include init containers in token translation Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Fix kubernetes.defaul service DNS translation Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Add skip test var to dapper Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Add kubelet version and image pull policy to the shared agent Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * fixes Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> --------- Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
29 lines
781 B
Go
29 lines
781 B
Go
package agent
|
|
|
|
import (
|
|
"github.com/rancher/k3k/pkg/apis/k3k.io/v1alpha1"
|
|
"github.com/rancher/k3k/pkg/controller"
|
|
ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client"
|
|
)
|
|
|
|
const (
|
|
configName = "agent-config"
|
|
)
|
|
|
|
type Agent interface {
|
|
Name() string
|
|
Config() ctrlruntimeclient.Object
|
|
Resources() ([]ctrlruntimeclient.Object, error)
|
|
}
|
|
|
|
func New(cluster *v1alpha1.Cluster, serviceIP, sharedAgentImage, sharedAgentImagePullPolicy, token string) Agent {
|
|
if cluster.Spec.Mode == VirtualNodeMode {
|
|
return NewVirtualAgent(cluster, serviceIP, token)
|
|
}
|
|
return NewSharedAgent(cluster, serviceIP, sharedAgentImage, sharedAgentImagePullPolicy, token)
|
|
}
|
|
|
|
func configSecretName(clusterName string) string {
|
|
return controller.SafeConcatNameWithPrefix(clusterName, configName)
|
|
}
|