Skip to content

Commit

Permalink
Merge pull request openshift#21 from flaper87/openshift
Browse files Browse the repository at this point in the history
Rebase upstream
  • Loading branch information
openshift-merge-robot authored Feb 25, 2019
2 parents 3deb7df + 79b6922 commit c2d845b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Participation in the Kubernetes community is governed by the [Kubernetes Code of
- `region_name`
- `auth_url`
- `password`
- `auth_url`

You **will need** to make changes to the generated files to create a working cluster.
You can find some guidance on what needs to be edited, and how to create some of the
Expand Down
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To succesfully run a kubernetes cluster in openstack, you will need to configure

## Machines YAML

After running the `generate-yaml.sh`, the file `cmd/clusterct/examples/openstack/out/machines.yaml` will be created at that location. This file stores information on what openstack elements to use to create the cluster on, and which cluster components to create. We provide you with a template to create one master and one worker node, however the template is incomplete and needs to be filled in. It looks like this:
After running the `generate-yaml.sh`, the file `cmd/clusterctl/examples/openstack/out/machines.yaml` will be created at that location. This file stores information on what openstack elements to use to create the cluster on, and which cluster components to create. We provide you with a template to create one master and one worker node, however the template is incomplete and needs to be filled in. It looks like this:

```yaml
items:
Expand Down
10 changes: 8 additions & 2 deletions pkg/cloud/openstack/machine/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ import (
const (
CloudConfigPath = "/etc/cloud/cloud_config.yaml"

UserDataKey = "userData"
UserDataKey = "userData"
DisableTemplatingKey = "disableTemplating"

TimeoutInstanceCreate = 5 * time.Minute
TimeoutInstanceDelete = 5 * time.Minute
Expand Down Expand Up @@ -96,6 +97,7 @@ func (oc *OpenstackClient) Create(ctx context.Context, cluster *machinev1.Cluste

// get machine startup script
var ok bool
var disableTemplating bool
userData := []byte{}
if providerSpec.UserDataSecret != nil {
namespace := providerSpec.UserDataSecret.Namespace
Expand All @@ -116,10 +118,12 @@ func (oc *OpenstackClient) Create(ctx context.Context, cluster *machinev1.Cluste
if !ok {
return fmt.Errorf("Machine's userdata secret %v in namespace %v did not contain key %v", providerSpec.UserDataSecret.Name, namespace, UserDataKey)
}

_, disableTemplating = userDataSecret.Data[DisableTemplatingKey]
}

var userDataRendered string
if len(userData) > 0 {
if len(userData) > 0 && !disableTemplating {
if machine.Spec.Versions.ControlPlane != "" {
userDataRendered, err = masterStartupScript(cluster, machine, string(userData))
if err != nil {
Expand All @@ -139,6 +143,8 @@ func (oc *OpenstackClient) Create(ctx context.Context, cluster *machinev1.Cluste
"error creating Openstack instance: %v", err))
}
}
} else {
userDataRendered = string(userData)
}

instance, err = machineService.InstanceCreate(fmt.Sprintf("%s/%s", cluster.ObjectMeta.Namespace, cluster.Name), machine.Name, providerSpec, userDataRendered, providerSpec.KeyName)
Expand Down

0 comments on commit c2d845b

Please sign in to comment.