Nginx Ingress Integrator
- Canonical IS DevOps
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/stable | 120 | 24 Oct 2024 | |
latest/stable | 121 | 24 Oct 2024 | |
latest/stable | 101 | 28 May 2024 | |
latest/edge | 123 | 25 Oct 2024 | |
latest/edge | 122 | 25 Oct 2024 | |
latest/edge | 109 | 22 Jul 2024 | |
latest/edge | 44 | 16 Nov 2022 | |
v2/edge | 84 | 09 Jan 2024 |
juju deploy nginx-ingress-integrator
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
charms.nginx_ingress_integrator.v0.nginx_route
-
- Last updated 07 May 2024
- Revision Library version 0.7
Library for the nginx-route relation.
This library contains the require and provide functions for handling the nginx-route interface.
Import require_nginx_route
in your charm, with four required keyword arguments:
- charm: (the charm itself)
- service_hostname
- service_name
- service_port
Other optional arguments include:
- additional_hostnames
- backend_protocol
- limit_rps
- limit_whitelist
- max_body_size
- owasp_modsecurity_crs
- owasp_modsecurity_custom_rules
- path_routes
- retry_errors
- rewrite_target
- rewrite_enabled
- service_namespace
- session_cookie_max_age
- tls_secret_name
See the config section for descriptions of each, along with the required type.
As an example, add the following to src/charm.py
:
from charms.nginx_ingress_integrator.v0.nginx_route import NginxRouteRequirer
# In your charm's `__init__` method (assuming your app is listening on port 8080).
require_nginx_route(
charm=self,
service_hostname=self.app.name,
service_name=self.app.name,
service_port=8080
)
And then add the following to metadata.yaml
:
requires:
nginx-route:
interface: nginx-route
You must require nginx route as part of the __init__
method
rather than, for instance, a config-changed event handler, for the relation
changed event to be properly handled.
In the example above we're setting service_hostname
(which translates to the
external hostname for the application when related to nginx-ingress-integrator)
to self.app.name
here. This ensures by default the charm will be available on
the name of the deployed juju application, but can be overridden in a
production deployment by setting service-hostname
on the
nginx-ingress-integrator charm. For example:
juju deploy nginx-ingress-integrator
juju deploy my-charm
juju relate nginx-ingress-integrator my-charm:nginx-route
# The service is now reachable on the ingress IP(s) of your k8s cluster at
# 'http://my-charm'.
juju config nginx-ingress-integrator service-hostname='my-charm.example.com'
# The service is now reachable on the ingress IP(s) of your k8s cluster at
# 'http://my-charm.example.com'.
Index
class NginxRouteRequirer
This class defines the functionality for the 'requires' side of the 'nginx-route' relation.
Description
Hook events observed: - relation-changed
Methods
NginxRouteRequirer. __init__( self , charm , config , nginx_route_relation_name: str )
Init function for the NginxRouteRequires class.
Arguments
The charm that requires the nginx-route relation.
Contains all the configuration options for nginx-route.
Specifies the relation name of the relation handled by this requirer class. The relation must have the nginx-route interface.
def require_nginx_route()
Set up nginx-route relation handlers on the requirer side.
Arguments
The charm that requires the nginx-route relation.
configure Nginx ingress integrator service-hostname option via relation.
configure Nginx ingress integrator service-name option via relation.
configure Nginx ingress integrator service-port option via relation.
configure Nginx ingress integrator additional-hostnames option via relation, optional.
configure Nginx ingress integrator backend-protocol option via relation, optional.
configure Nginx ingress nginx.ingress.kubernetes.io/enable-access-log option.
configure Nginx ingress integrator limit-rps option via relation, optional.
configure Nginx ingress integrator limit-whitelist option via relation, optional.
configure Nginx ingress integrator max-body-size option via relation, optional.
configure Nginx ingress integrator owasp-modsecurity-crs option via relation, optional.
configure Nginx ingress integrator owasp-modsecurity-custom-rules option via relation, optional.
configure Nginx ingress integrator path-routes option via relation, optional.
configure Nginx ingress integrator retry-errors option via relation, optional.
configure Nginx ingress integrator rewrite-target option via relation, optional.
configure Nginx ingress integrator rewrite-enabled option via relation, optional.
configure Nginx ingress integrator service-namespace option via relation, optional.
configure Nginx ingress integrator session-cookie-max-age option via relation, optional.
configure Nginx ingress integrator tls-secret-name option via relation, optional.
Specifies the relation name of the relation handled by this requirer class. The relation must have the nginx-route interface.
Returns
the NginxRouteRequirer.
Description
This function must be invoked in the charm class constructor.
def
provide_nginx_route(
charm,
on_nginx_route_available,
on_nginx_route_broken,
nginx_route_relation_name: str
)
Set up nginx-route relation handlers on the provider side.
Arguments
The charm that requires the nginx-route relation.
Callback function for the nginx-route-available event.
Callback function for the nginx-route-broken event.
Specifies the relation name of the relation handled by this provider class. The relation must have the nginx-route interface.
Description
This function must be invoked in the charm class constructor.