Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add config.nodeName to joiner #50

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

Yu-Jack
Copy link
Contributor

@Yu-Jack Yu-Jack commented Feb 26, 2025

Description

Currently, when we create the first node, we can give the customized node name (config.noddeName) here.

func ToBootstrapFile(config *config.Config, path string) (*applyinator.File, error) {
nodeName := config.NodeName
if nodeName == "" {
hostname, err := os.Hostname()
if err != nil {
return nil, fmt.Errorf("looking up hostname: %w", err)
}
nodeName = strings.Split(hostname, ".")[0]
}

But, for the joiner, we don't have a chance to give the config.nodeName to it.

var env []string
env = addEnv(env, "CATTLE_SERVER", config.Server)
env = addEnv(env, "CATTLE_TOKEN", config.Token)
env = addEnv(env, "CATTLE_CA_CHECKSUM", caChecksum)
env = addEnv(env, "CATTLE_ADDRESS", config.Address)
env = addEnv(env, "CATTLE_INTERNAL_ADDRESS", config.InternalAddress)
env = addEnv(env, "CATTLE_LABELS", strings.Join(config.Labels, ","))
env = addEnv(env, "CATTLE_TAINTS", strings.Join(config.Taints, ","))
env = addEnv(env, "CATTLE_ROLE_ETCD", fmt.Sprint(etcd))
env = addEnv(env, "CATTLE_ROLE_CONTROLPLANE", fmt.Sprint(controlPlane))
env = addEnv(env, "CATTLE_ROLE_WORKER", fmt.Sprint(worker))
return &applyinator.Instruction{

Solution

Add new env CATTLE_NODE_NAME for the joiner if config.nodeName is set.

Related Issue

harvester/harvester#7312

@FrankYang0529 FrankYang0529 merged commit ddb854e into rancher:harvester-dev Feb 26, 2025
1 check passed
@Yu-Jack Yu-Jack deleted the HARV-7312 branch February 26, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants