commit
e3c8b230a0
6 changed files with 1 additions and 142 deletions
|
@ -123,7 +123,6 @@ The following tags are defined in playbooks:
|
||||||
| hyperkube | Manipulations with K8s hyperkube image
|
| hyperkube | Manipulations with K8s hyperkube image
|
||||||
| k8s-pre-upgrade | Upgrading K8s cluster
|
| k8s-pre-upgrade | Upgrading K8s cluster
|
||||||
| k8s-secrets | Configuring K8s certs/keys
|
| k8s-secrets | Configuring K8s certs/keys
|
||||||
| kpm | Installing K8s apps definitions with KPM
|
|
||||||
| kube-apiserver | Configuring static pod kube-apiserver
|
| kube-apiserver | Configuring static pod kube-apiserver
|
||||||
| kube-controller-manager | Configuring static pod kube-controller-manager
|
| kube-controller-manager | Configuring static pod kube-controller-manager
|
||||||
| kubectl | Installing kubectl and bash completion
|
| kubectl | Installing kubectl and bash completion
|
||||||
|
|
|
@ -9,7 +9,7 @@ Kubespray's roadmap
|
||||||
### Self deployment (pull-mode) [#320](https://github.com/kubespray/kubespray/issues/320)
|
### Self deployment (pull-mode) [#320](https://github.com/kubespray/kubespray/issues/320)
|
||||||
- the playbook would install and configure docker/rkt and the etcd cluster
|
- the playbook would install and configure docker/rkt and the etcd cluster
|
||||||
- the following data would be inserted into etcd: certs,tokens,users,inventory,group_vars.
|
- the following data would be inserted into etcd: certs,tokens,users,inventory,group_vars.
|
||||||
- a "kubespray" container would be deployed (kubespray-cli, ansible-playbook, kpm)
|
- a "kubespray" container would be deployed (kubespray-cli, ansible-playbook)
|
||||||
- to be discussed, a way to provide the inventory
|
- to be discussed, a way to provide the inventory
|
||||||
- **self deployment** of the node from inside a container [#321](https://github.com/kubespray/kubespray/issues/321)
|
- **self deployment** of the node from inside a container [#321](https://github.com/kubespray/kubespray/issues/321)
|
||||||
|
|
||||||
|
|
|
@ -110,10 +110,6 @@ bin_dir: /usr/local/bin
|
||||||
# Uncomment this if you have more than 3 nameservers, then we'll only use the first 3.
|
# Uncomment this if you have more than 3 nameservers, then we'll only use the first 3.
|
||||||
#docker_dns_servers_strict: false
|
#docker_dns_servers_strict: false
|
||||||
|
|
||||||
## Default packages to install within the cluster, f.e:
|
|
||||||
#kpm_packages:
|
|
||||||
# - name: kube-system/grafana
|
|
||||||
|
|
||||||
## Certificate Management
|
## Certificate Management
|
||||||
## This setting determines whether certs are generated via scripts or whether a
|
## This setting determines whether certs are generated via scripts or whether a
|
||||||
## cluster of Hashicorp's Vault is started to issue certificates (using etcd
|
## cluster of Hashicorp's Vault is started to issue certificates (using etcd
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import kpm.deploy
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
DOCUMENTATION = """
|
|
||||||
---
|
|
||||||
module: kpm
|
|
||||||
short_description: Application deployment on kubernetes with kpm registry
|
|
||||||
description:
|
|
||||||
- Create, remove, and update resources within a Kubernetes Cluster
|
|
||||||
version_added: "2.0"
|
|
||||||
options:
|
|
||||||
name:
|
|
||||||
required: true
|
|
||||||
default: null
|
|
||||||
description:
|
|
||||||
- The name of the kpm package
|
|
||||||
namespace:
|
|
||||||
required: false
|
|
||||||
default: 'default'
|
|
||||||
description:
|
|
||||||
- The namespace to deploy package. It will be created if doesn't exist
|
|
||||||
force:
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
description:
|
|
||||||
- A flag to indicate to force delete, replace.
|
|
||||||
registry:
|
|
||||||
required: false
|
|
||||||
default: 'https://api.kpm.sh'
|
|
||||||
description:
|
|
||||||
- The registry url to fetch packages
|
|
||||||
version:
|
|
||||||
required: false
|
|
||||||
default: 'None'
|
|
||||||
description:
|
|
||||||
- The package version
|
|
||||||
variables:
|
|
||||||
required: false
|
|
||||||
default: 'None'
|
|
||||||
description:
|
|
||||||
- Set package variables
|
|
||||||
state:
|
|
||||||
required: false
|
|
||||||
choices: ['present', 'absent']
|
|
||||||
default: present
|
|
||||||
description:
|
|
||||||
- present handles checking existence or creating resources,
|
|
||||||
absent handles deleting resource(s).
|
|
||||||
requirements:
|
|
||||||
- kubectl
|
|
||||||
- kpm
|
|
||||||
author: "Antoine Legrand (ant31_2t@msn.com)"
|
|
||||||
"""
|
|
||||||
|
|
||||||
EXAMPLES = """
|
|
||||||
- name: check presence or install ghost
|
|
||||||
kpm: name=ghost/ghost state=present
|
|
||||||
|
|
||||||
- name: check absence or remove rocketchat
|
|
||||||
kpm: name=ant31/rocketchat state=absent
|
|
||||||
"""
|
|
||||||
|
|
||||||
RETURN = """
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def check_changed(result, state='present'):
|
|
||||||
no_change = ["ok", 'protected', 'absent']
|
|
||||||
for r in result:
|
|
||||||
if r['status'] not in no_change:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
module = AnsibleModule(
|
|
||||||
supports_check_mode=True,
|
|
||||||
argument_spec = dict(
|
|
||||||
version = dict(default=None, required=False),
|
|
||||||
state = dict(default='present', choices=['present', 'absent']),
|
|
||||||
name = dict(required=True),
|
|
||||||
force = dict(required=False, default=False, type='bool'),
|
|
||||||
variables = dict(required=False, default=None, type='dict'),
|
|
||||||
registry = dict(required=False, default="https://api.kpm.sh"),
|
|
||||||
namespace=dict(default='default', required=False)))
|
|
||||||
|
|
||||||
params = {"version": module.params.get("version"),
|
|
||||||
"namespace": module.params.get('namespace'),
|
|
||||||
"variables": module.params.get('variables'),
|
|
||||||
"endpoint": module.params.get('registry'),
|
|
||||||
"dry": module.check_mode,
|
|
||||||
"proxy": None,
|
|
||||||
"fmt": "json"}
|
|
||||||
state = module.params.get("state")
|
|
||||||
try:
|
|
||||||
if state == 'present':
|
|
||||||
r = kpm.deploy.deploy(module.params.get('name'), **params)
|
|
||||||
elif state == 'absent':
|
|
||||||
r = kpm.deploy.delete(module.params.get('name'), **params)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=e.message)
|
|
||||||
res = {}
|
|
||||||
res['kpm'] = r
|
|
||||||
res['changed'] = check_changed(r, state)
|
|
||||||
module.exit_json(**res)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,20 +0,0 @@
|
||||||
---
|
|
||||||
- name: install kpm
|
|
||||||
pip:
|
|
||||||
name: "kpm"
|
|
||||||
state: "present"
|
|
||||||
version: "0.16.1"
|
|
||||||
when: kpm_packages|default([])| length > 0
|
|
||||||
|
|
||||||
- name: manage kubernetes applications
|
|
||||||
kpm:
|
|
||||||
namespace: "{{item.namespace | default(kpm_namespace | default('default'))}}"
|
|
||||||
registry: "{{item.registry | default(kpm_registry | default('https://api.kpm.sh'))}}"
|
|
||||||
state: "{{item.state | default(omit)}}"
|
|
||||||
version: "{{item.version | default(omit)}}"
|
|
||||||
variables: "{{item.variables | default(omit)}}"
|
|
||||||
name: "{{item.name}}"
|
|
||||||
with_items: "{{kpm_packages|default([])}}"
|
|
||||||
register: kpmresults
|
|
||||||
environment:
|
|
||||||
PATH: "{{ ansible_env.PATH }}:{{ bin_dir }}"
|
|
|
@ -4,11 +4,6 @@ dependencies:
|
||||||
tags:
|
tags:
|
||||||
- apps
|
- apps
|
||||||
|
|
||||||
- role: kubernetes-apps/kpm
|
|
||||||
tags:
|
|
||||||
- apps
|
|
||||||
- kpm
|
|
||||||
|
|
||||||
- role: kubernetes-apps/efk
|
- role: kubernetes-apps/efk
|
||||||
when: efk_enabled
|
when: efk_enabled
|
||||||
tags:
|
tags:
|
||||||
|
|
Loading…
Reference in a new issue