Skip to content

Commit

Permalink
missing pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
QcFe authored and air-31 committed May 30, 2024
1 parent 6569309 commit c98e285
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions operators/pkg/forge/cloudinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
// userdata is a helper structure to marshal the userdata configuration.
type userdata struct {
Users []user `yaml:"users"`
Network network `yaml:"network"`
Mounts [][]string `yaml:"mounts"`
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys,omitempty"`
}
Expand All @@ -39,6 +40,12 @@ type user struct {
Shell string `yaml:"shell"`
}

// network is a helper structure to marshal the userdata configuration to configure the network subsystem.
type network struct {
Version int `yaml:"version"`
ID0 interf `yaml:"id0"`
}

// interf is a helper structure to marshal the userdata configuration to configure a given interface.
type interf struct {
DHCP4 bool `yaml:"dhcp4"`
Expand Down Expand Up @@ -66,6 +73,10 @@ func CloudInitUserData(nfsServerName, nfsPath string, publicKeys []string) ([]by
SSHAuthorizedKeys: publicKeys,
Shell: "/bin/bash",
}},
Network: network{
Version: 2,
ID0: interf{DHCP4: true},
},
SSHAuthorizedKeys: publicKeys,
}
if nfsServerName != "" && nfsPath != "" {
Expand Down
4 changes: 4 additions & 0 deletions operators/pkg/forge/cloudinit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ users:
- tenant-key-1
- tenant-key-2
shell: /bin/bash
network:
version: 2
id0:
dhcp4: true
mounts:
- - rook-ceph-nfs-my-nfs-a.rook-ceph.svc.cluster.local:/path
- /media/mydrive
Expand Down

0 comments on commit c98e285

Please sign in to comment.