@@ -40,8 +40,11 @@ func New(kubectl *kubernetes.Clientset, deployConfig *v1.DeploymentConfig, log l
4040 context = * config .Cluster .KubeContext
4141 }
4242
43- namespace := ""
44- if deployConfig .Namespace != nil {
43+ namespace , err := configutil .GetDefaultNamespace (config )
44+ if err != nil {
45+ return nil , err
46+ }
47+ if deployConfig .Namespace != nil && * deployConfig .Namespace != "" {
4548 namespace = * deployConfig .Namespace
4649 }
4750
@@ -73,6 +76,7 @@ func (d *DeployConfig) Status() ([][]string, error) {
7376
7477// Delete deletes all matched manifests from kubernetes
7578func (d * DeployConfig ) Delete () error {
79+ d .Log .StartWait ("Loading manifests" )
7680 manifests , err := loadManifests (d .Manifests , d .Log )
7781 if err != nil {
7882 return err
@@ -92,11 +96,14 @@ func (d *DeployConfig) Delete() error {
9296 cmd .Stdout = d .Log
9397 cmd .Stderr = d .Log
9498
99+ d .Log .StartWait ("Deleting manifests with kubectl" )
100+ defer d .Log .StopWait ()
95101 return cmd .Run ()
96102}
97103
98104// Deploy deploys all specified manifests via kubectl apply and adds to the specified image names the corresponding tags
99105func (d * DeployConfig ) Deploy (generatedConfig * generated.Config , forceDeploy bool ) error {
106+ d .Log .StartWait ("Loading manifests" )
100107 manifests , err := loadManifests (d .Manifests , d .Log )
101108 if err != nil {
102109 return err
@@ -120,19 +127,20 @@ func (d *DeployConfig) Deploy(generatedConfig *generated.Config, forceDeploy boo
120127 cmd .Stdout = d .Log
121128 cmd .Stderr = d .Log
122129
130+ d .Log .StartWait ("Applying manifests with kubectl" )
131+ defer d .Log .StopWait ()
123132 return cmd .Run ()
124133}
125134
126135func (d * DeployConfig ) getCmdArgs (method string , additionalArgs ... string ) []string {
127136 args := []string {}
128137
129- if d .Namespace != "" {
130- args = append (args , "-n" , d .Namespace )
131- }
132-
133138 if d .Context != "" {
134139 args = append (args , "--context" , d .Context )
135140 }
141+ if d .Namespace != "" {
142+ args = append (args , "-n" , d .Namespace )
143+ }
136144
137145 args = append (args , method )
138146
@@ -160,5 +168,5 @@ func replaceManifest(manifest Manifest, tags map[string]string) {
160168 return value + ":" + tags [value ]
161169 }
162170
163- Walk (manifest , match , replace )
171+ Walk (map [ interface {}] interface {}( manifest ) , match , replace )
164172}
0 commit comments