Skip to content

Commit 4836a31

Browse files
Update K8sService.cs
1 parent 574112c commit 4836a31

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Services/K8sService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public async Task StartNamespace(string ns)
4141
var deployments = await _client.AppsV1.ListNamespacedDeploymentAsync(ns);
4242
foreach (var dep in deployments.Items)
4343
{
44-
int replicas = 1;
44+
int replicas = 0;
4545
if (dep.Metadata.Annotations != null &&
4646
dep.Metadata.Annotations.TryGetValue("kubectl.kubernetes.io/last-applied-configuration", out var json))
4747
{
4848
try
4949
{
5050
var lastApplied = JsonSerializer.Deserialize<V1Deployment>(json);
51-
replicas = lastApplied?.Spec?.Replicas ?? 1;
51+
replicas = lastApplied?.Spec?.Replicas;
5252
}
5353
catch { }
5454
}
@@ -112,14 +112,14 @@ public async Task StartDeployment(string ns, string deployment)
112112
{
113113
var dep = await _client.AppsV1.ReadNamespacedDeploymentAsync(deployment, ns);
114114

115-
int replicas = 1;
115+
int replicas = 0;
116116
if (dep.Metadata.Annotations != null &&
117117
dep.Metadata.Annotations.TryGetValue("kubectl.kubernetes.io/last-applied-configuration", out var json))
118118
{
119119
try
120120
{
121121
var lastApplied = JsonSerializer.Deserialize<V1Deployment>(json);
122-
replicas = lastApplied?.Spec?.Replicas ?? 1;
122+
replicas = lastApplied?.Spec?.Replicas;
123123
}
124124
catch { }
125125
}

0 commit comments

Comments
 (0)