Skip to content

Commit 4727e75

Browse files
authored
feat: createapp add owners file (#15)
1 parent c65e648 commit 4727e75

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

pkg/development/command/createapp.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (c *createApp) WithDir(dir string) *createApp {
8686

8787
func (c *createApp) Run(ctx context.Context, cfg *CreateConfig) error {
8888
at := AppTemplate{}
89-
at.WithAppCfg(cfg).WithDeployment(cfg).WithService(cfg).WithChartMetadata(cfg)
89+
at.WithAppCfg(cfg).WithDeployment(cfg).WithService(cfg).WithChartMetadata(cfg).WithOwner(cfg)
9090
if cfg.Traefik {
9191
at.WithTraefik(cfg)
9292
}
@@ -107,6 +107,10 @@ type AppTemplate struct {
107107
service *corev1.Service
108108
chartMetadata *chart.Metadata
109109
traefik *Traefik
110+
owner *Owner
111+
}
112+
113+
type Owner struct {
110114
}
111115

112116
type Traefik struct {
@@ -515,6 +519,11 @@ func (at *AppTemplate) WithChartMetadata(cfg *CreateConfig) *AppTemplate {
515519
return at
516520
}
517521

522+
func (at *AppTemplate) WithOwner(cfg *CreateConfig) *AppTemplate {
523+
at.owner = &Owner{}
524+
return at
525+
}
526+
518527
func (at *AppTemplate) WithTraefik(cfg *CreateConfig) *AppTemplate {
519528
sa := &corev1.ServiceAccount{
520529
TypeMeta: metav1.TypeMeta{
@@ -915,6 +924,13 @@ func (at *AppTemplate) WriteFile(cfg *CreateConfig, baseDir string) (err error)
915924
return err
916925
}
917926
}
927+
928+
if at.owner != nil {
929+
err = ioutil.WriteFile(filepath.Join(path, "owners"), []byte{}, 0644)
930+
if err != nil {
931+
return err
932+
}
933+
}
918934
var yml []byte
919935
if at.deployment != nil {
920936
yml, err = ToYaml(at.deployment)

0 commit comments

Comments
 (0)