only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must su

问题:

K8S挂载glusterFS创建的存储类型,创建PVC后,想对PVC进行扩容,弹出

only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must su

原因:

创建的存储类型不支持动态扩容,需要添加allowVolumeExpansion: true 字段
如下:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: glusterfs-sc
parameters:
  clusterid: adec35a0ce70274sdfr3d4dsf158e77ccse
  resturl: http://10.0.1.201:48080
  volumetype: replicate:3
provisioner: kubernetes.io/glusterfs
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true 
on the result array. To allocate memory dynamically in C, we use the malloc() function. The syntax for using malloc() is as follows: ``` ptr = (castType*) malloc(size); ``` Here, ptr is a pointer of type castType. The malloc() function allocates a block of size bytes of memory, and returns a pointer to the first byte of the block. We can then use this pointer to access the block of memory. In the context of the given problem, we need to allocate memory for a new array of size n, where n is the length of the input array. We can use malloc() to do this as follows: ``` int* result = (int*) malloc(n * sizeof(int)); ``` Here, we first cast the pointer returned by malloc() to an int pointer, as we are allocating memory for an array of integers. We then multiply the size of an int (in bytes) by n, to get the total number of bytes to allocate. Finally, we assign the pointer returned by malloc() to the result variable. The complete code for the function is as follows: ``` int* runningSum(int* nums, int numsSize, int* returnSize){ int* result = (int*) malloc(numsSize * sizeof(int)); int sum = 0; for (int i = 0; i < numsSize; i++) { sum += nums[i]; result[i] = sum; } *returnSize = numsSize; return result; } ``` Here, we first allocate memory for the result array using malloc(). We then iterate through the input array, computing the running sum and storing it in the result array. Finally, we set the value of returnSize to numsSize (as the length of the result array is equal to the length of the input array), and return the result array.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

king config

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值