Divide hypervisor/vapp details over secret/configmap;Add filter plugin;Retain newlines in template;Add vApp properties
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
1794b24998
commit
a67ef0e1bd
@ -0,0 +1,14 @@
|
||||
import netaddr
|
||||
|
||||
def netaddr_iter_iprange(ip_start, ip_end):
|
||||
return [str(ip) for ip in netaddr.iter_iprange(ip_start, ip_end)]
|
||||
|
||||
class FilterModule(object):
|
||||
''' Ansible filter. Interface to netaddr methods.
|
||||
https://pypi.org/project/netaddr/
|
||||
'''
|
||||
|
||||
def filters(self):
|
||||
return {
|
||||
'netaddr_iter_iprange': netaddr_iter_iprange
|
||||
}
|
@ -7,15 +7,20 @@
|
||||
kubeconfig: "{{ kubeconfig.path }}"
|
||||
# values: "{{ components.sealedsecrets.chart_values }}"
|
||||
|
||||
- name: Store hypervisor details in secret
|
||||
- name: Store hypervisor details in configmap/secret
|
||||
kubernetes.core.k8s:
|
||||
state: present
|
||||
template: secret.j2
|
||||
template: "{{ item.kind }}.j2"
|
||||
kubeconfig: "{{ kubeconfig.path }}"
|
||||
vars:
|
||||
_template:
|
||||
name: hypervisor-credentials
|
||||
name: "{{ item.name }}"
|
||||
namespace: "{{ item.namespace }}"
|
||||
data: "{{ item.data }}"
|
||||
loop:
|
||||
- name: hypervisor-credentials
|
||||
namespace: kube-system
|
||||
kind: secret
|
||||
data:
|
||||
- key: HV_FQDN
|
||||
value: "{{ vapp['hv.fqdn'] | b64encode }}"
|
||||
@ -23,3 +28,21 @@
|
||||
value: "{{ vapp['hv.username'] | b64encode }}"
|
||||
- key: HV_PASSWORD
|
||||
value: "{{ vapp['hv.password'] | b64encode }}"
|
||||
- name: hypervisor-ippool
|
||||
namespace: kube-system
|
||||
kind: configmap
|
||||
data:
|
||||
- key: VAPP_MOREF
|
||||
value: "{{ moref_id }}"
|
||||
- key: VAPP_IPPOOL_NETWORK
|
||||
value: "{{ (vapp['guestinfo.ipaddress'] + '/' + vapp['guestinfo.prefixlength']) | ansible.utils.ipaddr('network') }}"
|
||||
- key: VAPP_IPPOOL_NETMASK
|
||||
value: "{{ (vapp['guestinfo.ipaddress'] + '/' + vapp['guestinfo.prefixlength']) | ansible.utils.ipaddr('netmask') }}"
|
||||
- key: VAPP_IPPOOL_DNSSERVER
|
||||
value: "{{ vapp['guestinfo.dnsserver'] }}"
|
||||
- key: VAPP_IPPOOL_GATEWAY
|
||||
value: "{{ vapp['guestinfo.gateway'] }}"
|
||||
- key: VAPP_IPPOOL_RANGE
|
||||
value: "{{ vapp['ippool.startip'] + '#' + (vapp['ippool.startip'] | netaddr_iter_iprange(vapp['ippool.endip']) | length | string) }}"
|
||||
loop_control:
|
||||
label: "{{ item.kind + '/' + item.name + ' (' + item.namespace + ')' }}"
|
@ -9,5 +9,6 @@ metadata:
|
||||
{{ _template.labels }}
|
||||
data:
|
||||
{% for kv_pair in _template.data %}
|
||||
"{{ kv_pair.key }}": "{{ kv_pair.value }}"
|
||||
"{{ kv_pair.key }}": |
|
||||
{{ kv_pair.value | indent(width=4, first=True) }}
|
||||
{% endfor %}
|
||||
|
@ -39,8 +39,24 @@ PropertyCategories:
|
||||
- Key: metacluster.fqdn
|
||||
Type: string(1..)
|
||||
Label: Appliance FQDN*
|
||||
Description: 'Respective subdomains will be available for each component (e.g. storage.example.org); this address should already be configured as a wildcard record within your DNS zone.'
|
||||
DefaultValue: 'meta.k8s.cluster'
|
||||
Description: Respective subdomains will be available for each component (e.g. storage.example.org); this address should already be configured as a wildcard record within your DNS zone.
|
||||
DefaultValue: meta.k8s.cluster
|
||||
Configurations: '*'
|
||||
UserConfigurable: true
|
||||
|
||||
- Key: ippool.startip
|
||||
Type: ip
|
||||
Label: IP-pool start IP*
|
||||
Description: All nodes for the workload cluster will be provisioned within this IP pool
|
||||
DefaultValue: ''
|
||||
Configurations: '*'
|
||||
UserConfigurable: true
|
||||
|
||||
- Key: ippool.endip
|
||||
Type: ip
|
||||
Label: IP-pool end IP*
|
||||
Description: All nodes for the workload cluster will be provisioned within this IP pool
|
||||
DefaultValue: ''
|
||||
Configurations: '*'
|
||||
UserConfigurable: true
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user