Skip to content

Commit

Permalink
add example usage of context to the module doc string and remove a co…
Browse files Browse the repository at this point in the history
…mment
  • Loading branch information
djivey committed Jan 13, 2025
1 parent f984245 commit 0fc04d6
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/saltext/kubernetes/states/kubernetesmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@
require:
- pip: kubernetes-python-module
# kubernetes deployment using a template with custom context variables
nginx-template-with-context:
kubernetes.deployment_present:
- name: nginx-template
- source: salt://k8s/nginx-template.yml.jinja
- template: jinja
- context:
replicas: 3
nginx_version: 1.19
environment: production
app_label: frontend
# kubernetes secret with context variables
cert-secret-with-context:
kubernetes.secret_present:
- name: tls-cert
- source: salt://k8s/tls-cert.yml.jinja
- template: jinja
- context:
cert_name: myapp.example.com
cert_data: |
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
# Kubernetes secret
k8s-secret:
Expand Down Expand Up @@ -321,7 +345,7 @@ def service_present(
template=template,
old_service=service,
saltenv=__env__,
context=context, # Pass context parameter
context=context,
**kwargs,
)

Expand Down

0 comments on commit 0fc04d6

Please sign in to comment.