-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
admin.go
44 lines (37 loc) · 1001 Bytes
/
admin.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
43
44
package kubeconfig
import (
"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/installconfig"
"github.com/openshift/installer/pkg/asset/tls"
)
// Admin is the asset for the admin kubeconfig.
type Admin struct {
kubeconfig
}
var _ asset.WritableAsset = (*Admin)(nil)
// Dependencies returns the dependency of the kubeconfig.
func (k *Admin) Dependencies() []asset.Asset {
return []asset.Asset{
&tls.RootCA{},
&tls.AdminCertKey{},
&installconfig.InstallConfig{},
}
}
// Generate generates the kubeconfig.
func (k *Admin) Generate(parents asset.Parents) error {
rootCA := &tls.RootCA{}
adminCertKey := &tls.AdminCertKey{}
installConfig := &installconfig.InstallConfig{}
parents.Get(rootCA, adminCertKey, installConfig)
return k.kubeconfig.generate(
rootCA,
adminCertKey,
installConfig.Config,
"admin",
"kubeconfig",
)
}
// Name returns the human-friendly name of the asset.
func (k *Admin) Name() string {
return "Kubeconfig Admin"
}