Skip to content

Commit

Permalink
feat(components): Kubernetes - Create PersistentVolumeClaim (#5222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark-kun authored Jul 15, 2021
1 parent 697c041 commit 1d38f6d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions components/kubernetes/Create_PersistentVolumeClaim/component.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create PersistentVolumeClaim in Kubernetes
inputs:
- {name: Name, type: String}
- {name: Storage size, type: String, default: 1Gi}
outputs:
- {name: Name, type: String}
metadata:
annotations:
author: Alexey Volkov <alexey.volkov@ark-kun.com>
implementation:
container:
image: bitnami/kubectl:1.17.17
command:
- bash
- -exc
- |
name=$0
storage_size=$1
output_name_path=$2
mkdir -p "$(dirname "$output_name_path")"
object_path=$(mktemp)
cat <<EOF >"$object_path"
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: $name
spec:
#storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: $storage_size
EOF
object_name=$(kubectl apply -f "$object_path" --namespace default --output=name)
object_name=${object_name##persistentvolumeclaim/}
echo "$object_name" >"$output_name_path"
- {inputValue: Name}
- {inputValue: Storage size}
- {outputPath: Name}

0 comments on commit 1d38f6d

Please sign in to comment.