gardener-attic / landscape-setup2

[DEPRECATED] Scripts for setting up a Gardener landscape
https://github.com/gardener/garden-setup
Other
12 stars 8 forks source link

Error when running ./deploy_kubify.sh #19

Closed micahlmartin closed 6 years ago

micahlmartin commented 6 years ago

Here are the contents of my landscape.yaml file

authentication:
  variant_aws:
    aws_access_key: .....
    aws_availability_zone: b
    aws_region: us-east-1
    aws_secret_key: ....
  variant_openstack:
    os_auth_url: <openstack v3 api endpoint>
    os_az: <availability zone>
    os_domain_name: <domain name>
    os_password: <openstack password>
    os_region: <region name>
    os_tenant_name: <tenant/project name>
    os_user_name: <openstack username>
charts:
- name: gardener
- connectors:
  - config:
      clientID: ....
      clientSecret: ....
      redirectURI: https://test.gardener.mydomain.net/dex/callback
    id: github
    name: GitHub
    type: github
  name: identity
  staticPasswords:
  - email: micahlmartin@gmail.com
    hash: $2a$10$zCiHlA8/eThSwVPZ122FEuIGNGzOxesV864iJ5Apgs4A2ggJTDJxK
    username: admin
  values: null
- email: micahlmartin@gmail.com
  name: certmanager
cloud:
  variant: aws
clusters:
  dns:
    access_key: ....
    domain_name: gardener
    hosted_zone_id: mydomain.net
    secret_key: ....
  master:
    count: 3
    volume_size: 50
  name: test
  worker:
    count: 3
    volume_size: 50
etcd_backup:
  region: us-east-1
  storage_type: s3
misc:
  variant_all:
    dashboard_creds: password
  variant_openstack:
    os_fip_pool_name: <floating ip pool name>
seed_config:
  variant_aws:
    image: ami-928885ed
    region: us-east-1
    zones:
    - us-east-1a
    - us-east-1b
    - us-east-1c
  variant_openstack:
    image: <image name>
    region: <region name>
    zones:
    - <zone1>
    - <zone2>
    - <...>

when I run ./deploy_kubify.sh I get this error:

root@fd90dec57562:/landscape/setup# ./deploy_kubify.sh
┌───────────
│ Component: kubify
│      Exec: setup/components/kubify/deploy kubify
└───────────
Filling template from landscape.yaml ...

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mako/cmd.py", line 61, in cmdline
    print(template.render(**kw))
  File "/usr/lib/python2.7/dist-packages/mako/template.py", line 445, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 829, in _render
    **_kwargs_for_callable(callable_, data))
  File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 864, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 890, in _exec_template
    callable_(context, *args, **kwargs)
  File "base.template", line 10, in render_body
    <%include file="terraform.tfvars.${profileName}.template" args="config=config, profileName=profileName, utils=utils" />
  File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 752, in _include_file
    callable_(ctx, **_kwargs_for_include(callable_, context._data, **kwargs))
  File "terraform.tfvars.aws.template", line 2, in render_body
    <%
KeyError: 'addons'

Any idea what might be causing this?

Diaphteiros commented 6 years ago

Hm, how did you create your landscape.yaml file? It looks like you filled in and renamed landscape_config.yaml, because there are some parts of the landscape_base.yaml file missing, including the "addons" section, which causes your error. After you filled in the landscape_config.yaml file, the landscape.yaml file should be automatically created when entering the docker container. It is a merge of landscape_base.yaml and landscape_config.yaml, including configurations from both files. You can also generate it manually from inside the docker container by calling the build_landscape_yaml.sh script (starting the docker container via docker_run.sh won't overwrite it if it already exists).

micahlmartin commented 6 years ago

Here is the gist of my landscape_config.yaml which was used to generate the landscape.yaml https://gist.github.com/micahlmartin/5c8c77b3ee4c841ddf087ea69f565932

micahlmartin commented 6 years ago

I managed to get past the issue. I think part of the problem is that if you run ./docker_run.sh before modifying your landscape_config.yaml file it doesn't set the environment variables up properly like what happens here:

https://github.com/gardener/landscape-setup/blob/master/init.sh#L58-L63

# set cloud variant
if [ -f $LANDSCAPE_CONFIG ]; then
    export CLOUD_VARIANT="$(yaml2json < $LANDSCAPE_CONFIG | jq -r .cloud.variant)"
    export LANDSCAPE_NAME="$(grep -m 1 -F "domain_name:" "$LANDSCAPE_CONFIG" | awk '{ print $2 }')"
else
    echo "WARNING: $LANDSCAPE_CONFIG not found! Did you provide $LANDSCAPE_HOME/landscape_config.yaml so that it can be created?"
fi

The example landscape_config.yaml exists when you clone the repository so the else case essentially never happens.

Diaphteiros commented 6 years ago

Ah, yes, I've also had problems with some environment variables not being set properly when changing the landscape files after the docker container is already started. Maybe I should have a look at this some time.

micahlmartin commented 6 years ago

@Diaphteiros perhaps it's just a matter of always running source ./init.sh at the end of the build_landscape_yaml.sh script?

Diaphteiros commented 6 years ago

@micahlmartin Hm, that is actually a nice idea. I've added it to my current pull request.