Skip to content

Commit 921417c

Browse files
committed
fix(k8s): incorrent json format
1 parent d62c643 commit 921417c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/GZCTF/Services/Container/Manager/KubernetesManager.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ public KubernetesManager(IContainerProvider<Kubernetes, KubernetesMetadata> prov
6767
},
6868
Spec = new V1PodSpec
6969
{
70+
ImagePullSecrets =
71+
authSecretName is null
72+
? Array.Empty<V1LocalObjectReference>()
73+
: new List<V1LocalObjectReference> { new() { Name = authSecretName } },
7074
DnsPolicy = "None",
7175
DnsConfig = new() { Nameservers = options.Dns ?? ["223.5.5.5", "114.114.114.114"] },
7276
EnableServiceLinks = false,
@@ -109,9 +113,6 @@ config.Flag is null
109113
}
110114
};
111115

112-
if (authSecretName is not null)
113-
pod.Spec.ImagePullSecrets.Add(new() { Name = authSecretName });
114-
115116
try
116117
{
117118
pod = await _client.CreateNamespacedPodAsync(pod, options.Namespace, cancellationToken: token);

src/GZCTF/Services/Container/Provider/KubernetesProvider.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Text.Json;
1+
using System.Diagnostics.CodeAnalysis;
2+
using System.Text.Json;
23
using GZCTF.Models.Internal;
34
using k8s;
45
using k8s.Models;
@@ -161,6 +162,8 @@ void InsertRegistrySecret(string address, RegistryConfig registry)
161162
}
162163
}
163164

164-
internal record DockerRegistryOptions(Dictionary<string, DockerRegistryEntry> Auths);
165+
[SuppressMessage("ReSharper", "InconsistentNaming")]
166+
internal record DockerRegistryOptions(Dictionary<string, DockerRegistryEntry> auths);
165167

166-
internal record DockerRegistryEntry(string Auth, string? Username, string? Password);
168+
[SuppressMessage("ReSharper", "InconsistentNaming")]
169+
internal record DockerRegistryEntry(string auth, string? username, string? password);

0 commit comments

Comments
 (0)