Skip to content

Commit

Permalink
added a LVMLogicalVolumeWatcher controller
Browse files Browse the repository at this point in the history
Signed-off-by: viktor.kramarenko <[email protected]>
  • Loading branch information
ViktorKram committed Jan 24, 2024
1 parent 9713f94 commit 2932997
Show file tree
Hide file tree
Showing 9 changed files with 590 additions and 168 deletions.
10 changes: 10 additions & 0 deletions crds/lvmlogicalvolume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ spec:
description: |
properties:
type:
x-kubernetes-validations:
- rule: self == oldSelf
type: string
enum: [Thick, Thin]
size:
type: string
lvmVolumeGroup:
x-kubernetes-validations:
- rule: self == oldSelf
type: string
thin:
x-kubernetes-validations:
- rule: self == oldSelf
type: object
properties:
poolName:
Expand All @@ -56,6 +62,10 @@ spec:
actualSize:
type: string
additionalPrinterColumns:
- jsonPath: .status.phase
name: Phase
type: string
description: The current resource status.
- jsonPath: .spec.lvmVolumeGroup
name: LVMVolumeGroup
type: string
Expand Down
8 changes: 5 additions & 3 deletions images/agent/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,19 @@ func NewConfig() (*Options, error) {
func getMachineId() (string, error) {
id := os.Getenv(MachineID)
if id == "" {
args := []string{"-m", "-u", "-i", "-n", "-p", "-t", "1", "cat", "/etc/machine-id"}
args := []string{"-m", "-u", "-i", "-n", "-p", "-t", "1", "cat", "./etc/machine-id"}

var stdout *bytes.Buffer
var stdout bytes.Buffer
cmd := exec.Command("/usr/bin/nsenter", args...)
cmd.Stdout = stdout
cmd.Stdout = &stdout
err := cmd.Run()
if err != nil {
return "", err
}

id = stdout.String()
fmt.Println("MACHINE ID " + id)

}

return id, nil
Expand Down
18 changes: 9 additions & 9 deletions images/agent/internal/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ limitations under the License.
package internal

const (
TypePart = "part"
DRBDName = "/dev/drbd"
LoopDeviceType = "loop"
LVMDeviceType = "lvm"
LVMFSType = "LVM2_member"
SdsNodeConfigurator = "storage.deckhouse.io/sds-node-configurator"
LVMVGHealthOperational = "Operational"
LVMVGHealthNonOperational = "NonOperational"
TypePart = "part"
DRBDName = "/dev/drbd"
LoopDeviceType = "loop"
LVMDeviceType = "lvm"
LVMFSType = "LVM2_member"
SdsNodeConfiguratorFinalizer = "storage.deckhouse.io/sds-node-configurator"
LVMVGHealthOperational = "Operational"
LVMVGHealthNonOperational = "NonOperational"
)

var (
AllowedFSTypes = [...]string{LVMFSType}
InvalidDeviceTypes = [...]string{LoopDeviceType, LVMDeviceType}
BlockDeviceValidSize = "1G"
ResizeDelta = "32Mi"
Finalizers = []string{SdsNodeConfigurator}
Finalizers = []string{SdsNodeConfiguratorFinalizer}
LVMTags = []string{"storage.deckhouse.io/enabled=true", "linstor-"}
)
Loading

0 comments on commit 2932997

Please sign in to comment.