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

Use custom spec.api.port to check controller state #186

Merged
merged 4 commits into from
Aug 11, 2021

Conversation

erdii
Copy link
Contributor

@erdii erdii commented Aug 10, 2021

Signed-off-by: erdii me@erdii.engineering

@kke kke added the bug Something isn't working label Aug 10, 2021
@kke kke changed the title fix custom apiserver port by passing port values Use custom spec.api.port to check controller state Aug 10, 2021
@kke
Copy link
Contributor

kke commented Aug 10, 2021

Looks like something is broken FATA[0015] PANIC: interface conversion: interface {} is nil, not int

Copy link
Contributor

@kke kke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need typecasting

@@ -79,6 +79,10 @@ func (p *InstallControllers) Run() error {
}

func (p *InstallControllers) waitJoined(h *cluster.Host) error {
port := p.Config.Spec.K0s.Config.Dig("spec", "api", "port").(int)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs something like:

port := 6443
if p, ok := p.Config.Spec.K0s.Config.Dig("spec", "api", "port").(int); ok {
  port = p
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gives FATA[0015] PANIC: interface conversion: interface {} is nil, not int when spec.api.port not set otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my bad! You are 💯% spot on.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this fixed in the commits leading to 83dc9b3? if so, this is also failing with that error (which I don't known if its because this particular line that I'm commenting on):

# k0sctl kubeconfig --config /vagrant/shared/k0sctl.yaml
FATA PANIC: interface conversion: interface {} is nil, not int 

@@ -63,7 +63,11 @@ func (p *UpgradeControllers) Run() error {
if err := h.WaitK0sServiceRunning(); err != nil {
return err
}
if err := h.WaitKubeAPIReady(); err != nil {
port := p.Config.Spec.K0s.Config.Dig("spec", "api", "port").(int)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as in install_controllers.go

@erdii erdii force-pushed the allow-alternative-apiserver-port branch from dac48ad to 105df2e Compare August 10, 2021 13:44
for proper handling of nil values

Signed-off-by: erdii <me@erdii.engineering>
@erdii erdii force-pushed the allow-alternative-apiserver-port branch from 105df2e to ee73a12 Compare August 10, 2021 13:48
@erdii erdii requested a review from kke August 10, 2021 13:49
@kke kke merged commit f6074e9 into k0sproject:main Aug 11, 2021
@erdii erdii deleted the allow-alternative-apiserver-port branch August 20, 2021 09:22
rgl added a commit to rgl/k0sctl that referenced this pull request Aug 29, 2021
@rgl rgl mentioned this pull request Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants