-
Notifications
You must be signed in to change notification settings - Fork 280
/
tinkerbelldatacenterconfig.go
42 lines (35 loc) · 1.09 KB
/
tinkerbelldatacenterconfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const TinkerbellDatacenterKind = "TinkerbellDatacenterConfig"
// Used for generating yaml for generate clusterconfig command
func NewTinkerbellDatacenterConfigGenerate(clusterName string) *TinkerbellDatacenterConfigGenerate {
return &TinkerbellDatacenterConfigGenerate{
TypeMeta: metav1.TypeMeta{
Kind: TinkerbellDatacenterKind,
APIVersion: SchemeBuilder.GroupVersion.String(),
},
ObjectMeta: ObjectMeta{
Name: clusterName,
},
Spec: TinkerbellDatacenterConfigSpec{},
}
}
func (c *TinkerbellDatacenterConfigGenerate) APIVersion() string {
return c.TypeMeta.APIVersion
}
func (c *TinkerbellDatacenterConfigGenerate) Kind() string {
return c.TypeMeta.Kind
}
func (c *TinkerbellDatacenterConfigGenerate) Name() string {
return c.ObjectMeta.Name
}
func GetTinkerbellDatacenterConfig(fileName string) (*TinkerbellDatacenterConfig, error) {
var clusterConfig TinkerbellDatacenterConfig
err := ParseClusterConfig(fileName, &clusterConfig)
if err != nil {
return nil, err
}
return &clusterConfig, nil
}