Skip to content

Commit

Permalink
freeipa certificate issuer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tcharl committed Aug 19, 2023
1 parent 81b0a7a commit 4c0998f
Show file tree
Hide file tree
Showing 29 changed files with 411 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
path: tcharl.freeipa_server
path: tcharl.kube_certmanager
- name: install prereq
run: |
cd tcharl.freeipa_server
cd tcharl.kube_certmanager
ansible-galaxy role install -r requirements-standalone.yml
ansible-galaxy collection install -r requirements-collections.yml
lint:
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ install:

script:
- mv ../kube_certmanager ../tcharl.kube_cert_manager
- travis_wait 50 tox -e test-exec -- --scenario-name kvm
- travis_wait 70 tox -e test-exec -- --scenario-name kvm
branches:
only:
- master
- master
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

kube_firewall_zone: 'public'
cert_manager_chart_version: 'v1.12.1'
13 changes: 13 additions & 0 deletions files/cert-manager-values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
installCRDs: true
webhook:
hostNetwork: true
securePort: 10260
volumeMounts:
- name: ca-bundle
mountPath: /etc/pki/tls/certs/ca-bundle.crt
subPath: ca-bundle.crt
readOnly: false
volumes:
- name: ca-bundle
configMap:
name: ca-bundle
8 changes: 7 additions & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
---
- name: Converge master
hosts: master.osgiliath.test
hosts:
- ipaservers
- kube_master
vars:
secure_logs: False
# preferred_nic: "eth1"
kube_firewall_zone: 'public'
master_preferred_nic: "eth1"
preferred_nic: "eth1"
reset_kube: True
standalone_role: False
company_domain: osgiliath.test
company_realm_password: '123ADMin'
company_ad_password: '123ADmPass'
nfs_mountpoints: # Mountpoints should be configured by the tcharl.ansible_volume (nfs mounts) on the server and client side to be mounted on each node before kubernetes comes in
- host: master.osgiliath.test
mountpoints:
Expand Down
24 changes: 18 additions & 6 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ dependency:
enabled: ${DEPENDENCY_ENABLED:-True}
options:
role-file: ${REQUIREMENTS_PATH:-requirements-standalone.yml}
roles-path: ${MOLECULE_PROJECT_DIRECTORY}/../community
requirements-file: requirements-collections.yml
collections-path: ${MOLECULE_PROJECT_DIRECTORY}/../community-collections
driver:
name: vagrant
provider:
Expand All @@ -15,8 +13,8 @@ platforms:
- name: master.osgiliath.test
box: ${TESTBOX:-fedora/38-cloud-base}
provider_options:
cpus: 4
memory: 5120
cpus: 2
memory: 2048
interfaces:
- type: dhcp
# ip: "192.168.56.5"
Expand All @@ -25,14 +23,28 @@ platforms:
virtualbox__intnet: "internalnetwork"
groups:
- kube_master
- ipaclients
- name: ipa.osgiliath.test
box: ${TESTBOX:-fedora/38-cloud-base}
provider_options:
cpus: 2
memory: 2048
interfaces:
- type: dhcp
# ip: "192.168.56.5"
auto_config: true
network_name: private_network
virtualbox__intnet: "internalnetwork"
groups:
- ipaservers
- name: node1.osgiliath.test
box: ${TESTBOX:-fedora/38-cloud-base}
provider_options:
cpus: 2
memory: 5120
memory: 2048
groups:
- kube_node
- ipaclients
interfaces:
- type: dhcp
# ip: "192.168.56.5"
Expand Down Expand Up @@ -71,4 +83,4 @@ scenario:
- side_effect
- verify
- cleanup
- destroy
- destroy
6 changes: 4 additions & 2 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

- name: Prepare
hosts:
- kube_master
- kube_node
- all
tasks:
- include_role:
name: tcharl.kube_certmanager
tasks_from: requirements.yml
vars:
secure_logs: False
preferred_nic: "eth1"
idm_preferred_nic: "eth1"
master_preferred_nic: "eth1"
kube_firewall_zone: 'public'
company_domain: osgiliath.test
company_realm_password: '123ADMin'
company_ad_password: '123ADmPass'
Expand Down
37 changes: 37 additions & 0 deletions molecule/default/tests/test_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,40 @@ def test_cert_manager_pods_running(host):
with host.sudo():
cmd = host.run(command)
assert int(cmd.stdout) > 0


# def test_cert_manager_user_exists(host):
# command = r"""set -o pipefail && echo '123ADMin'| \
# kinit admin > /dev/null && \
# ipa user-find cert-manager-sa | \
# grep -c 'First name: Cert'"""
# cmd = host.run(command)
# assert '1' in cmd.stdout


# def test_freeipa_issuer_pods_running(host):
# command = r"""
# kubectl get pods -n freeipa-issuer-system | \
# grep Running | \
# wc -l"""
# with host.sudo():
# cmd = host.run(command)
# assert int(cmd.stdout) > 0

def test_certmanager_config_cabundle(host):
command = r"""
kubectl get cm ca-bundle -n cert-manager | \
wc -l"""
with host.sudo():
cmd = host.run(command)
assert int(cmd.stdout) > 0


def test_certmanager_config_cabundle_content_ca(host):
command = r"""
kubectl get cm ca-bundle -n cert-manager -o yaml | \
grep 'BEGIN CERTIFICATE' | \
wc -l"""
with host.sudo():
cmd = host.run(command)
assert int(cmd.stdout) > 0
11 changes: 9 additions & 2 deletions molecule/kvm/converge.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
---
- name: Converge master
hosts: master.osgiliath.test
hosts:
- ipaservers
- kube_master
vars:
secure_logs: False
preferred_nic: "eth1"
master_preferred_nic: "eth1"
idm_preferred_nic: "eth1"
kube_firewall_zone: 'public'
standalone_role: False
reset_kube: True
preferred_nic: "eth1"
company_domain: osgiliath.test
company_realm_password: '123ADMin'
company_ad_password: '123ADmPass'
nfs_mountpoints: # Mountpoints should be configured by the tcharl.ansible_volume (nfs mounts) on the server and client side to be mounted on each node before kubernetes comes in
- host: master.osgiliath.test
mountpoints:
Expand Down
29 changes: 22 additions & 7 deletions molecule/kvm/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ dependency:
enabled: ${DEPENDENCY_ENABLED:-True}
options:
role-file: ${REQUIREMENTS_PATH:-requirements-standalone.yml}
roles-path: ${MOLECULE_PROJECT_DIRECTORY}/../community
requirements-file: requirements-collections.yml
collections-path: ${MOLECULE_PROJECT_DIRECTORY}/../community-collections
driver:
name: vagrant
provider:
Expand All @@ -17,28 +15,45 @@ platforms:
provider_options:
driver: "kvm"
cpus: 2
memory: 5120
memory: 3000
qemu_use_session: false
interfaces:
- auto_config: true
network_name: private_network
ip: "192.168.50.4"
type: dhcp
# ip: "192.168.50.4"
groups:
- kube_master
- ipaclients
- name: ipa.osgiliath.test
box: ${TESTBOX:-fedora/38-cloud-base}
provider_options:
driver: "kvm"
cpus: 2
memory: 3000
qemu_use_session: false
interfaces:
- auto_config: true
network_name: private_network
type: dhcp
# ip: "192.168.50.6"
groups:
- ipaservers
- name: node1.osgiliath.test
box: ${TESTBOX:-fedora/38-cloud-base}
provider_options:
driver: "kvm"
cpus: 2
memory: 5120
memory: 3000
qemu_use_session: false
interfaces:
- auto_config: true
network_name: private_network
ip: "192.168.50.5"
type: dhcp
# ip: "192.168.50.5"
groups:
- kube_node
- ipaclients
provisioner:
name: ansible
# config_options:
Expand Down Expand Up @@ -67,4 +82,4 @@ scenario:
- side_effect
- verify
- cleanup
- destroy
- destroy
7 changes: 4 additions & 3 deletions molecule/kvm/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

- name: Prepare
hosts:
- kube_master
- kube_node
- all
tasks:
- include_role:
name: tcharl.kube_certmanager
tasks_from: requirements.yml
vars:
secure_logs: False
preferred_nic: "eth1"
idm_preferred_nic: "eth1"
master_preferred_nic: "eth1"
kube_firewall_zone: 'public'
company_domain: osgiliath.test
company_realm_password: '123ADMin'
company_ad_password: '123ADmPass'
standalone_role: True
kubernetes_allow_pods_on_master: Yes
13 changes: 11 additions & 2 deletions molecule/parallels/converge.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
---
- name: Converge master
hosts: master.osgiliath.test
hosts:
- ipaservers
- kube_master
vars:
secure_logs: False
preferred_nic: "eth1"
idm_preferred_nic: "eth1"
master_preferred_nic: "eth1"
kubernetes_allow_pods_on_master: False
kube_firewall_zone: 'public'
standalone_role: False
company_domain: osgiliath.test
company_realm_password: '123ADMin'
company_ad_password: '123ADmPass'
reset_kube: True
# preferred_nic: "eth1"
nfs_mountpoints: # Mountpoints should be configured by the tcharl.ansible_volume (nfs mounts) on the server and client side to be mounted on each node before kubernetes comes in
- host: master.osgiliath.test
mountpoints:
Expand Down
16 changes: 13 additions & 3 deletions molecule/parallels/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ dependency:
enabled: ${DEPENDENCY_ENABLED:-True}
options:
role-file: ${REQUIREMENTS_PATH:-requirements-standalone.yml}
roles-path: ${MOLECULE_PROJECT_DIRECTORY}/../community
requirements-file: requirements-collections.yml
collections-path: ${MOLECULE_PROJECT_DIRECTORY}/../community-collections
driver:
name: vagrant
provider:
Expand All @@ -23,6 +21,17 @@ platforms:
network_name: private_network
groups:
- kube_master
- ipaclients
- name: ipa.osgiliath.test
box: ${TESTBOX:-bento/fedora-38-arm64}
provider_options:
cpus: 2
memory: 5120
interfaces:
- type: dhcp
auto_config: true
network_name: private_network
groups:
- ipaservers
- name: node1.osgiliath.test
box: ${TESTBOX:-bento/fedora-38-arm64}
Expand All @@ -35,6 +44,7 @@ platforms:
network_name: private_network
groups:
- kube_node
- ipaclients
provisioner:
name: ansible
# config_options:
Expand Down Expand Up @@ -63,4 +73,4 @@ scenario:
- side_effect
- verify
- cleanup
- destroy
- destroy
7 changes: 4 additions & 3 deletions molecule/parallels/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

- name: Prepare
hosts:
- kube_master
- kube_node
- all
tasks:
- include_role:
name: tcharl.kube_certmanager
tasks_from: requirements.yml
vars:
secure_logs: False
preferred_nic: "eth1"
idm_preferred_nic: "eth1"
master_preferred_nic: "eth1"
kube_firewall_zone: 'public'
company_domain: osgiliath.test
company_realm_password: '123ADMin'
company_ad_password: '123ADmPass'
standalone_role: True
kubernetes_allow_pods_on_master: False
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tcharl.kube_certmanager"
version = "0.1.0"
version = "2.1.0"
description = "Installs cert-manager on Kubernetes"
authors = ["Charlie Mordant <[email protected]>"]
license = "Apache2"
Expand Down
Loading

0 comments on commit 4c0998f

Please sign in to comment.