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

feature: support to use the default StorageClass #34

Merged
merged 1 commit into from
Jun 27, 2021

Conversation

veezhang
Copy link
Contributor

@veezhang veezhang commented Jun 22, 2021

Fix: #34

@veezhang veezhang added type/feature req Type: feature request ready-for-testing Progress: ready for the CI test labels Jun 22, 2021
return *c.nc.Spec.Graphd.StorageClaim.StorageClassName
func (c *graphdComponent) GetStorageClass() *string {
scName := c.nc.Spec.Graphd.StorageClaim.StorageClassName
if scName == nil || *scName == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here is check null pointer to avoid panic, the emptly value is legal, right? If use default storageClass, the filed can remove while scName is nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's legal but it doesn't seem to make much sense, so I set it to nil when empty.
Are there any other problems that I haven't found?

Here is a example:

$ kubectl get sc
NAME                 PROVISIONER             RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
standard (default)   rancher.io/local-path   Delete          WaitForFirstConsumer   false                  11h

$ cat ./yaml/storageclass-test.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: test
spec:
  serviceName: test
  selector:
    matchLabels:
      app: test
  replicas: 1
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
        - name: test
          image: vesoft/nebula-console:v2-nightly
          command:
            - sleep
            - "10000"
          ports:
            - containerPort: 80
              name: test
          volumeMounts:
            - name: disk
              mountPath: /data
  volumeClaimTemplates:
    - metadata:
        name: disk
      spec:
        accessModes: [ "ReadWriteOnce" ]
        storageClassName: ""
        resources:
          requests:
            storage: 20Gi
$ kubectl apply -f ./yaml/storageclass-test.yaml
$ kubectl describe pvc disk-test-0
Name:          disk-test-0
Namespace:     default
StorageClass:
Status:        Pending
Volume:
Labels:        app=test
Annotations:   <none>
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Used By:       test-0
Events:
  Type    Reason         Age               From                         Message
  ----    ------         ----              ----                         -------
  Normal  FailedBinding  7s (x4 over 42s)  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set

@MegaByte875 MegaByte875 merged commit f153bff into vesoft-inc:master Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing Progress: ready for the CI test type/feature req Type: feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants