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

Refactor controller role to use variables for hostname and host index #3206

Merged
merged 1 commit into from
Feb 8, 2018

Conversation

dubee
Copy link
Member

@dubee dubee commented Jan 19, 2018

  • Define variables for frequently referenced operations in controller role
  • Move controller.jmxremote.jvmArgs to deploy.yml

@dubee dubee requested a review from cbickel January 19, 2018 19:10
@dubee dubee changed the title Refactor controller role to user variables for hostname and host index Refactor controller role to use variables for hostname and host index Jan 19, 2018
@dubee dubee added the review Review for this PR has been requested and yet needs to be done. label Jan 19, 2018
@dubee
Copy link
Member Author

dubee commented Jan 25, 2018

@cbickel, can you look at this one when you have a chance? It's just refactoring the controller deployment scripts to make them easier to manage/read.

@@ -48,17 +56,17 @@

- name: prepare controller ports
set_fact:
ports_to_expose: ["{{ controller.basePort + groups['controllers'].index(inventory_hostname) }}:8080", "{{ controller.akka.cluster.basePort + groups['controllers'].index(inventory_hostname) }}:{{ controller.akka.cluster.bindPort }}"]
ports_to_expose: ["{{ controller.basePort + (controller_index | int) }}:8080", "{{ controller.akka.cluster.basePort + (controller_index | int) }}:{{ controller.akka.cluster.bindPort }}"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to do the int conversation already on defining the variable? Or would this result in issues on gernerating the name-String?

Copy link
Member Author

Choose a reason for hiding this comment

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

@cbickel, unfortunately defining the controller_index as an int results in the variable type being unicode. See below.

Define controller_index as an int:

- name: get controller index
  set_fact:
    controller_index: "{{ groups['controllers'].index(inventory_hostname) | int }}"

Attempting to add controller_index to an int:

{{ controller.basePort + controller_index }}

Results in this error:

fatal: [192.168.99.100]: FAILED! => {"failed": true, "msg": "Unexpected templating type error occurred on ({{ controller.basePort + controller_index }}:8080): unsupported operand type(s) for +: 'int' and 'unicode'"}

Apparently using set_fact always produces a string: ansible/ansible#4170.

- Define variables for frequently referenced operations controller role
- Move controller.jmxremote.jvmArgs to deploy.yml
@dubee
Copy link
Member Author

dubee commented Feb 8, 2018

PG3 1821 👍

@dubee
Copy link
Member Author

dubee commented Feb 8, 2018

@cbickel, PG looks good.

Copy link
Contributor

@cbickel cbickel left a comment

Choose a reason for hiding this comment

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

LGTM

@cbickel cbickel merged commit 674b26c into apache:master Feb 8, 2018
BillZong pushed a commit to BillZong/openwhisk that referenced this pull request Nov 18, 2019
…x. (apache#3206)

- Define variables for frequently referenced operations controller role
- Move controller.jmxremote.jvmArgs to deploy.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
controller deployment review Review for this PR has been requested and yet needs to be done.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants