diff --git a/share/gitea-tekton-org/auto-ci.tf b/share/gitea-tekton-org/auto-ci.tf index 062cd86..c1bc9e1 100644 --- a/share/gitea-tekton-org/auto-ci.tf +++ b/share/gitea-tekton-org/auto-ci.tf @@ -69,10 +69,6 @@ resource "kubectl_manifest" "auto-ci-detector" { EOF } - - - - resource "kubectl_manifest" "ci-trigger-push" { count = var.autoCI?1:0 yaml_body = <<-EOF @@ -146,16 +142,9 @@ resource "kubectl_manifest" "ci-trigger-push" { value: $(tt.params.branch-name) workspaces: - name: source - volumeClaimTemplate: - metadata: - annotations: - "mayfly.cloud.namecheap.com/expire": "2h" - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi + persistentVolumeClaim: + claimName: source + subPath: "$(extensions.git-revision)" - name: dockerconfig secret: secretName: gitea-docker @@ -242,16 +231,9 @@ resource "kubectl_manifest" "ci-trigger-tag" { value: $(tt.params.branch-name) workspaces: - name: source - volumeClaimTemplate: - metadata: - annotations: - "mayfly.cloud.namecheap.com/expire": "2h" - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi + persistentVolumeClaim: + claimName: source + subPath: "$(extensions.git-revision)" - name: dockerconfig secret: secretName: gitea-docker diff --git a/share/gitea-tekton-org/index.yaml b/share/gitea-tekton-org/index.yaml index 1d8fde8..e4bcc5c 100644 --- a/share/gitea-tekton-org/index.yaml +++ b/share/gitea-tekton-org/index.yaml @@ -26,6 +26,49 @@ options: examples: - your-org type: string + storage: + default: + volume: + accessMode: ReadWriteOnce + class: '' + size: 10Gi + type: Filesystem + description: Configure this app storage + examples: + - volume: + accessMode: ReadWriteOnce + class: '' + size: 10Gi + type: Filesystem + properties: + volume: + default: + accessMode: ReadWriteOnce + class: '' + size: 10Gi + type: Filesystem + properties: + accessMode: + default: ReadWriteOnce + enum: + - ReadWriteOnce + - ReadOnlyMany + - ReadWriteMany + type: string + class: + default: '' + type: string + size: + default: 10Gi + type: string + type: + default: Filesystem + enum: + - Filesystem + - Block + type: string + type: object + type: object dependencies: - dist: null category: apps diff --git a/share/gitea-tekton-org/pvc.tf b/share/gitea-tekton-org/pvc.tf new file mode 100644 index 0000000..fd90aa6 --- /dev/null +++ b/share/gitea-tekton-org/pvc.tf @@ -0,0 +1,26 @@ +locals { + pvc_spec = merge({ + "accessModes" = [var.storage.volume.accessMode] + "volumeMode" = var.storage.volume.type + "resources" = { + "requests" = { + "storage" = "${var.storage.volume.size}" + } + } + }, var.storage.volume.class != "" ?{ + "storageClassName" = var.storage.volume.class + }:{}) +} +resource "kubectl_manifest" "pvc" { + yaml_body = <<-EOF + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: source + namespace: "${var.namespace}" + annotations: + k8up.io/backup: "false" + labels: ${jsonencode(local.common-labels)} + spec: ${jsonencode(local.pvc_spec)} + EOF +}