-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
up: copy configs to remote host #19383
Conversation
@@ -133,6 +134,7 @@ func (c *ClusterUpConfig) StartSelfHosted(out io.Writer) error { | |||
return err | |||
} | |||
|
|||
clientConfig.Host = c.ServerIP + ":8443" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deads2k not sure if this is needed, but without this I was not able to get the --public-hostname
to work. In order to bind the cluster up on the VM, I had to specify the VM IP address...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deads2k also I think I saw somebody on IRC reporting that --public-hostname is broken
@@ -282,7 +334,7 @@ func (c *ClusterUpConfig) makeMasterConfig() (string, error) { | |||
container.MasterImage = c.openshiftImage() | |||
container.Args = []string{ | |||
"--write-config=/var/lib/origin/openshift.local.config", | |||
"--master=127.0.0.1", | |||
fmt.Sprintf("--master=%s", c.ServerIP), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deads2k not sure if this fixes the comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deads2k not sure if this fixes the comment above.
You had to change this because you needed to serve from a different nic
/hold Need to also handle volumes, right now the directory is created into |
if err != nil { | ||
return nil, err | ||
} | ||
configs.openshiftControllerConfigDir, err = c.copyToRemote(configs.openshiftControllerConfigDir, kubeapiserver.OpenShiftControllerManagerDirName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deads2k the reason I have to do this after every step is that some steps depend on files produced by previous step...
14f13b6
to
67d0c86
Compare
problem with volume and data dir solved. /hold cancel |
pkg/oc/bootstrap/clusteradd/cmd.go
Outdated
@@ -111,7 +111,9 @@ func NewCmdAdd(name, fullName string, out, errout io.Writer) *cobra.Command { | |||
// Start runs the start tasks ensuring that they are executed in sequence | |||
func (c *ClusterAddConfig) Run() error { | |||
componentsToInstall := []componentinstall.Component{} | |||
installContext, err := componentinstall.NewComponentInstallContext(c.openshiftImage(), c.imageFormat(), c.BaseDir, c.ServerLogLevel) | |||
dockerHelper := dockerhelper.NewHelper(c.dockerClient) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't want this in the context. Can't we continue passing it through the install step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 fixed.
pkg/oc/bootstrap/docker/host/host.go
Outdated
@@ -17,24 +20,25 @@ nsenter --mount=/rootfs/proc/1/ns/mnt mkdir -p %[1]s | |||
grep -F %[1]s /rootfs/proc/1/mountinfo || nsenter --mount=/rootfs/proc/1/ns/mnt mount -o bind %[1]s %[1]s | |||
grep -F %[1]s /rootfs/proc/1/mountinfo | grep shared || nsenter --mount=/rootfs/proc/1/ns/mnt mount --make-shared %[1]s | |||
` | |||
|
|||
// RemoteHostOriginDir is a directory on the remote machine that runs Docker | |||
RemoteHostOriginDir = "/var/lib/origin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary. Can't you just make the filesystem match the user filesystem. This was the source of a lot of ugly before and this is going to cause conflicts when you try to run with two different configs in two different CWDs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per IRC, I reworked this to be RemoteHostOriginDir + baseDir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I really don't want to mess up with SELinux or something similar when mirroring the OSX filesystem tree)
@@ -48,7 +50,13 @@ func (r *RegistryComponentOptions) Install(dockerClient dockerhelper.Interface, | |||
return err | |||
} | |||
|
|||
masterConfigDir := path.Join(r.InstallContext.BaseDir(), kubeapiserver.KubeAPIServerDirName) | |||
// If docker is on remote host, the base dir is different. | |||
baseDir := r.InstallContext.BaseDir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need the isntallcontext to list a different basedir perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the baseDir should be the same, if you are talking to remote host, you just need to prefix
// the Docker host master config dir. | ||
if len(os.Getenv("DOCKER_HOST")) > 0 { | ||
hostHelper := host.NewHostHelper(c.InstallContext.DockerHelper(), c.InstallContext.ClientImage()) | ||
remoteMasterConfigDir := path.Join(host.RemoteHostOriginDir, kubeapiserver.KubeAPIServerDirName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should not be copying into this destination. The add on components don't get to mess with the running kube/openshift control plane. Copy to the remote host if you must, but this should be a different directory off the basedir. Perhaps I didn't notice when I was fixing the rest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was pre-existing (we generated the cert in the master config dir)... I can move this somewhere else.
if _, err := os.Stat(configLocations.openshiftAPIServerConfigDir); os.IsNotExist(err) { | ||
_, err = c.makeOpenShiftAPIServerConfig(configLocations.masterConfigDir) | ||
if c.isRemoteDocker { | ||
configs.masterConfigDir, err = c.copyToRemote(configs.masterConfigDir, kubeapiserver.KubeAPIServerDirName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this value gets overwritten to be something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it will become the remote host dir
_, err = c.makeOpenShiftControllerConfig(configLocations.masterConfigDir) | ||
|
||
if _, err := os.Stat(configs.nodeConfigDir); os.IsNotExist(err) { | ||
_, err = c.makeNodeConfig(configs.masterConfigDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this one get the remote master config dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it ran in container on remote host? (so it needs the remote masterConfigDir to get admin.kubeconfig (if I remember this one)
@deads2k added support for multiple CWD (will use baseDir as part of remote host path), removed the docker helper from context. |
/retest (centos mirrors are down, again) |
Well, it's nasty. All installers are ugly. If you want it, I can deal with it, but hopefully we don't have to touch it much. /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, mfojtik The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
Worked for me, thanks!
…On Tue, Apr 17, 2018 at 6:46 AM, OpenShift CI Robot < ***@***.***> wrote:
[APPROVALNOTIFIER] This PR is *APPROVED*
This pull-request has been approved by: *mfojtik
<#19383#>*
The full list of commands accepted by this bot can be found here
<https://go.k8s.io/bot-commands>.
The pull request process is described here
<https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process>
Needs approval from an approver in each of these files:
- pkg/oc/bootstrap/OWNERS
<https://github.com/openshift/origin/blob/master/pkg/oc/bootstrap/OWNERS>
[mfojtik]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#19383 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p3w2coWQG2H5BJFrK9H7Jr7A1aZWks5tpcgPgaJpZM4TYEJE>
.
|
WARNING: Crazy ahead.
This is will enable the cluster up case where the Docker is running on a remote host (a
DOCKER_HOST
is used), which is typically a case on Windows and OSX (if not DockerForMac is used).The way this works is that we are copying the generated configs to remote host via privileged Docker container.
Current cluster up code assumes that every config live on the host, this PR will make it less obvious and you will have to be careful which path you want to use. I spend a lot of time and a lot of cluster up runs to tweak all places where we generate the local files and need to copy them into host. This might even less obvious for the components and we will have to be careful on adding components to not forget copy the files they generate to remote...
I tested this code on OSX where I run the centos7 VM and exposing the Docker from that VM via
DOCKER_HOST
./cc @smarterclayton @praveenkumar
@deads2k I don't like this, but I can't think of a better way to do this :-(
Fixes: #19360
Fixes: #19154