Skip to content

Commit

Permalink
Merge pull request #3 from ppofuk/feature/nginx-ingress
Browse files Browse the repository at this point in the history
add: nginx-ingress controller configuration
  • Loading branch information
ppofuk authored Sep 22, 2024
2 parents 0bd292f + 5efd500 commit 06b6bc4
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/configure-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:

- name: Setup kubelogin
uses: azure/use-kubelogin@v1
with:
kubelogin-version: 'v0.1.4'

- name: Set Cluster Context
uses: azure/aks-set-context@v3
Expand All @@ -55,6 +57,7 @@ jobs:
cluster-name: wp06cluster
admin: true

- name: List all pods
- name: Execute Ansible Playbooks
run: |
kubectl get pods --all-namespaces
ansible-playbook -v playbook.yml
15 changes: 15 additions & 0 deletions playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Deploy multiple NGINX ingress controllers
hosts: localhost
roles:
- role: nginx_ingress
vars:
namespace: ingress-nginx-1
release_name: ingress-nginx-1
ingress_class_name: nginx-1

- role: nginx_ingress
vars:
namespace: ingress-nginx-2
release_name: ingress-nginx-2
ingress_class_name: nginx-2
23 changes: 23 additions & 0 deletions roles/nginx_ingress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
NGINX Ingress
=========

Install nginx ingress controller using helm charts.

Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Example Playbook
----------------
TODO

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
6 changes: 6 additions & 0 deletions roles/nginx_ingress/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
namespace: ingress-nginx
release_name: ingress-nginx
azure_lb_health_probe_path: /healthz
external_traffic_policy: Local
ingress_class_name: nginx
2 changes: 2 additions & 0 deletions roles/nginx_ingress/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for nginx_ingress
34 changes: 34 additions & 0 deletions roles/nginx_ingress/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)

min_ansible_version: 2.1

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
22 changes: 22 additions & 0 deletions roles/nginx_ingress/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
- name: Add the ingress-nginx Helm repository
community.kubernetes.helm_repository:
repo_name: ingress-nginx
repo_url: https://kubernetes.github.io/ingress-nginx

- name: Install the ingress-nginx chart
community.kubernetes.helm:
name: "{{ release_name }}"
chart_ref: ingress-nginx/ingress-nginx
release_name: "{{ release_name }}"
create_namespace: true
release_namespace: "{{ namespace }}"
update_repo_cache: true
release_values:
controller:
ingressClassResource:
name: "{{ ingress_class_name }}"
service:
annotations:
service.beta.kubernetes.io/azure-load-balancer-health-probe-request-path: "{{ azure_lb_health_probe_path }}"
externalTrafficPolicy: "{{ external_traffic_policy }}"
2 changes: 2 additions & 0 deletions roles/nginx_ingress/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
localhost

5 changes: 5 additions & 0 deletions roles/nginx_ingress/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- nginx_ingress
2 changes: 2 additions & 0 deletions roles/nginx_ingress/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# vars file for nginx_ingress

0 comments on commit 06b6bc4

Please sign in to comment.