@@ -27,7 +27,7 @@ public static async Task UndeployAsync(IConsole console, FileInfo path, Verbosit
27
27
28
28
// We don't need to know anything about the services, just the application name.
29
29
var application = ConfigFactory . FromFile ( path ) ;
30
- if ( ! String . IsNullOrEmpty ( @namespace ) )
30
+ if ( ! string . IsNullOrEmpty ( @namespace ) )
31
31
{
32
32
application . Namespace = @namespace ;
33
33
}
@@ -72,12 +72,14 @@ public static async Task ExecuteUndeployAsync(OutputContext output, ConfigApplic
72
72
// - handcrafting requests to delete each resource
73
73
var resources = new List < Resource > ( ) ;
74
74
75
+ var applicationName = application . Name ;
76
+
75
77
try
76
78
{
77
79
output . WriteDebugLine ( "Querying services" ) ;
78
80
var response = await kubernetes . ListNamespacedServiceWithHttpMessagesAsync (
79
81
config . Namespace ,
80
- labelSelector : $ "app.kubernetes.io/part-of={ application . Name } ") ;
82
+ labelSelector : $ "app.kubernetes.io/part-of={ applicationName } ") ;
81
83
82
84
foreach ( var resource in response . Body . Items )
83
85
{
@@ -99,7 +101,7 @@ public static async Task ExecuteUndeployAsync(OutputContext output, ConfigApplic
99
101
output . WriteDebugLine ( "Querying deployments" ) ;
100
102
var response = await kubernetes . ListNamespacedDeploymentWithHttpMessagesAsync (
101
103
config . Namespace ,
102
- labelSelector : $ "app.kubernetes.io/part-of={ application . Name } ") ;
104
+ labelSelector : $ "app.kubernetes.io/part-of={ applicationName } ") ;
103
105
104
106
foreach ( var resource in response . Body . Items )
105
107
{
@@ -121,7 +123,7 @@ public static async Task ExecuteUndeployAsync(OutputContext output, ConfigApplic
121
123
output . WriteDebugLine ( "Querying secrets" ) ;
122
124
var response = await kubernetes . ListNamespacedSecretWithHttpMessagesAsync (
123
125
config . Namespace ,
124
- labelSelector : $ "app.kubernetes.io/part-of={ application . Name } ") ;
126
+ labelSelector : $ "app.kubernetes.io/part-of={ applicationName } ") ;
125
127
126
128
foreach ( var resource in response . Body . Items )
127
129
{
@@ -144,7 +146,7 @@ public static async Task ExecuteUndeployAsync(OutputContext output, ConfigApplic
144
146
output . WriteDebugLine ( "Querying ingresses" ) ;
145
147
var response = await kubernetes . ListNamespacedIngressWithHttpMessagesAsync (
146
148
config . Namespace ,
147
- labelSelector : $ "app.kubernetes.io/part-of={ application . Name } ") ;
149
+ labelSelector : $ "app.kubernetes.io/part-of={ applicationName } ") ;
148
150
149
151
foreach ( var resource in response . Body . Items )
150
152
{
0 commit comments