Skip to content

CRD:nlsc spec.ResourceToBeInited.vgs does not support updating? #256

Description

@Clara12062

Question

问题描述

  1. 部署时, nlsc的spec配置如下:
spec:
  globalConfig:
    listConfig:
      vgs:
        include:
        - open-local-pool-[0-9]+
        - yoda-pool[0-9]+
        - ackdistro-pool
    resourceToBeInited:
      vgs:
      - devices:
        - /dev/vdb
        name: open-local-pool-0
  1. vg空间不够了, 修改nlsc的CR实例的spec如下:
spec:
  globalConfig:
    listConfig:
      vgs:
        include:
        - open-local-pool-[0-9]+
        - yoda-pool[0-9]+
        - ackdistro-pool
    resourceToBeInited:
      vgs:
      - devices:
        - /dev/vdb
        - /dev/vdc
        name: open-local-pool-0

期望结果

查看每个节点的nls的CR实例, spec更新, open-local-pool-0包含两块磁盘的PV, 宿主机上执行vgs, 卷组成功扩容.

实际结果

每个节点的nls的CR实例, spec更新, 但是open-local-pool-0没有变化, /dev/vdc并没有加进去.
查看代码open-local/pkg/agent/discovery/discovery.go:

		for _, vg := range vgs {
			if _, err := lvm.LookupVolumeGroup(vg.Name); err == lvm.ErrVolumeGroupNotFound {
				err := d.createVG(vg.Name, vg.Devices)
				if err != nil {
					msg := fmt.Sprintf("create vg %s with device %v failed: %s. you can try command \"vgcreate %s %v --force\" manually on this node", vg.Name, vg.Devices, err.Error(), vg.Name, strings.Join(vg.Devices, " "))
					log.Error(msg)
					d.recorder.Event(nls, corev1.EventTypeWarning, localtype.EventCreateVGFailed, msg)
				}
			}
		}

似乎只有VG不存在时, 才会创建VG, 而更新nlsc.spec.resourceToBeInited并不会把新建的磁盘扩到卷组中?
目前的行为是符合期望的吗? 如果resourceToBeInited仅在初始化时使用, 是不是应该添加webhook等处理限制后续的修改行为; 或者支持后续更改, 当卷组添加新磁盘时, 新增expansionVG的处理.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions