Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please improve PV/PVC generator #68

Open
Moep90 opened this issue Feb 12, 2021 · 0 comments
Open

Please improve PV/PVC generator #68

Moep90 opened this issue Feb 12, 2021 · 0 comments
Labels
enhancement New feature or request generator Related to generator components

Comments

@Moep90
Copy link
Contributor

Moep90 commented Feb 12, 2021

Usecase

For a Deployment + Job + CronJob resource it's sometimes required to have one or more additional PV/PVC's.
Therfore I need the generators to be able to generate them.

Issue

Currently PV/PVC generator only allows the function with volumeClaimTemplate by type: statefulset to create actual persistence.

Current "Workaround"

parameters:
  kapitan:
    compile:
      - output_path: manifests
        input_type: jinja2
        input_paths: 
          - templates/jinja/pvc.yml

The Component

parameters:
  extra:
    pvcs:
      - name: pg-backup
        spec:
          storageClassName: ${postgres:persistence:storageclass}
          accessModes: ${postgres:persistence:accessModes}
          resources:
            requests:
              storage: ${postgres:backup:size}

My Jinja2 Template:

{% set p = inventory.parameters %}
{% for pvc in p.extra.pvcs %}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ pvc.name }}
  namespace: {{ p.namespace }}
  labels: {{ p.generators.manifest.default_config.labels }}
  annotations: {{ p.generators.manifest.default_config.annotations }}
spec: {{ pvc.spec }}
{% endfor %}

The Result

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pg-backup
  namespace: gitea
  labels: {'app.kubernetes.io/part-of': 'gitea', 'app.kubernetes.io/managed-by': 'kapitan'}
  annotations: {'manifests.kapicorp.com/generated': 'true'}
spec: {'storageClassName': 'standard', 'accessModes': ['ReadWriteOnce'], 'resources': {'requests': {'storage': '10Gi'}}}
@Moep90 Moep90 changed the title [Enhancement] Please improve PV/PVC generator [Enhancement][Generator][PersistentVolumes] Please improve PV/PVC generator Feb 22, 2021
@ademariag ademariag added enhancement New feature or request generator Related to generator components labels Feb 22, 2021
@ademariag ademariag changed the title [Enhancement][Generator][PersistentVolumes] Please improve PV/PVC generator Please improve PV/PVC generator Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request generator Related to generator components
Projects
None yet
Development

No branches or pull requests

2 participants