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

Openstack Provider password with hashtag not parsed properly #987

Closed
brudnyhenry opened this issue Oct 25, 2018 · 8 comments
Closed

Openstack Provider password with hashtag not parsed properly #987

brudnyhenry opened this issue Oct 25, 2018 · 8 comments
Assignees
Labels
Milestone

Comments

@brudnyhenry
Copy link

brudnyhenry commented Oct 25, 2018

RKE version:
0.1.1
Docker version: (docker version,docker info preferred)
17.0.3
Operating system and kernel: (cat /etc/os-release, uname -r preferred)
Ubuntu 16.0.4
Type/provider of hosts: (VirtualBox/Bare-metal/AWS/GCE/DO)
Openstack
cluster.yml file:
ssh_key_path: "/deploy/conf/kubernetes-kp.pem"

cloud_provider:
    name: openstack
    openstackCloudProvider:
      global:
        username: "user"
        password: "hsz#gl7@ApP5"
......

After rke up command, generated /etc/kubernetes/cloud-config includes extra ` signs

 cat /etc/kubernetes/cloud-config 
[Global]
username  = user
password  = `hsz#gl7@ApP5`
.....

Those additional ` chars are breaking the deployment - Kubernetes fails to authenticate in Openstack.

failed to run Kubelet: could not init cloud provider \\\"openstack\\\": Authentication failed\""],

When there are no hashtags in password then everything deploys fine.

Steps to Reproduce:

Try to provision Kubernetes cluster while adding openstack provider credentials containing # in password

Results:

rke up fails with error ailed to run Kubelet: could not init cloud provider \\\"openstack\\\": Authentication failed\""

@leafty
Copy link

leafty commented Nov 27, 2018

We just had this yesterday.

The proper set of quote to use is " (maybe ' works too but haven't tried that). Manually editing the cloud-config file allows kubelet to start.

@deniseschannon
Copy link

@brudnyhenry @leafty per the docs, we aren't expecting quotes or ```.

https://rancher.com/docs/rke/latest/en/config-options/cloud-providers/openstack/

if that doesn't work, please open a new issue.

@vincent99
Copy link
Contributor

It's a YAML file that goes through a regular YAML parser, password: foo and password: "foo" are going to be equivalent

@vincent99 vincent99 reopened this Apr 8, 2019
@deniseschannon deniseschannon added this to the v0.2.x milestone Apr 8, 2019
@deniseschannon deniseschannon modified the milestones: v0.2.x, v0.3.0 Apr 15, 2019
@brudnyhenry
Copy link
Author

Hi,
The point is that if password contains # then rke up will wrap it with single quotation mark which are not allowed in cloud-config, thus it produces error
failed to run Kubelet: could not init cloud provider \\\"openstack\\\": Authentication failed\""],

@brudnyhenry
Copy link
Author

Hi,
I tracked down that this is behavior of github.com/go-ini/ini

package main

import (
	"bytes"
	"fmt"
	"log"

	"github.com/go-ini/ini"
)

type Password struct {
	Pass string `ini:"password,omitempty" norman:"type=password"`
}

func main() {
	a := &Password{"hsz#gl7@ApP5"}
	cfg := ini.Empty()
	_ = ini.ReflectFrom(cfg, a)
	buf := new(bytes.Buffer)
	if _, err := cfg.WriteTo(buf); err != nil {
		log.Println(err)
	}
	fmt.Println(buf.String())
}

Will produce below output:

password = `hsz#gl7@ApP5`

And without hashtag:

package main

import (
	"bytes"
	"fmt"
	"log"

	"github.com/go-ini/ini"
)

type Password struct {
	Pass string `ini:"password,omitempty" norman:"type=password"`
}

func main() {
	a := &Password{"hszgl7@ApP5"}
	cfg := ini.Empty()
	_ = ini.ReflectFrom(cfg, a)
	buf := new(bytes.Buffer)
	if _, err := cfg.WriteTo(buf); err != nil {
		log.Println(err)
	}
	fmt.Println(buf.String())
}

Output is correct:

password = hszgl7@ApP5

@deniseschannon
Copy link

Available with RKE v0.2.7. It was missed moving to test in previous releases.

@deniseschannon
Copy link

We should test with RKE v0.2.7 and v0.3.0-rc6.

@bmdepesa
Copy link
Member

Tested with rke 0.2.7 and rke 0.3.0-rc6

cluster.yml includes:

cloud_provider:
    name: openstack
    openstackCloudProvider:
      global:
        username: "user"
        password: "hsz#gl7@ApP5"

rke 0.2.7

0.2.7 does not have the quotes removed from the cloud config password

> sudo cat /etc/kubernetes/cloud-config
[Global]
username = user
password = `hsz#gl7@ApP5`

rke 0.3.0-rc6

0.3.0-rc6 does have the quotes removed from the cloud config password

> sudo cat /etc/kubernetes/cloud-config
[Global]
username = user
password = hsz#gl7@ApP5

@zube zube bot removed the [zube]: Done label Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants