Mark subproject as dirty in CMKS - Infra

This commit is contained in:
Nils Blomgren
2026-05-18 08:37:09 +02:00
parent 328d494530
commit 8b94fb8826
635 changed files with 81145 additions and 100551 deletions

View File

@@ -0,0 +1,41 @@
namespace EntKube.Web.Services;
/// <summary>
/// Abstraction over Kubernetes API operations that CnpgService needs.
/// Allows testing orchestration logic without real K8s clusters.
///
/// Implementations use the k8s .NET client or kubectl under the hood,
/// applying manifests (CNPG Cluster CRDs, Backup CRDs, Secrets) and
/// executing SQL via kubectl exec against the primary pod.
/// </summary>
public interface IKubernetesClientFactory
{
/// <summary>
/// Applies a YAML manifest to a Kubernetes cluster using the given kubeconfig.
/// Equivalent to "kubectl apply -f -" with the manifest piped in.
/// </summary>
Task ApplyManifestAsync(string manifest, string kubeconfig, CancellationToken ct = default);
/// <summary>
/// Deletes a specific Kubernetes resource by kind/name/namespace.
/// Equivalent to "kubectl delete {kind} {name} -n {namespace}".
/// </summary>
Task DeleteManifestAsync(string kind, string name, string ns, string kubeconfig, CancellationToken ct = default);
/// <summary>
/// Ensures a namespace exists, creating it if it doesn't.
/// Equivalent to "kubectl create namespace {ns} --dry-run=client -o yaml | kubectl apply -f -".
/// </summary>
Task EnsureNamespaceAsync(string ns, string kubeconfig, CancellationToken ct = default);
/// <summary>
/// Gets the JSON output of a kubectl command. Used for querying cluster/pod status.
/// </summary>
Task<string> GetJsonAsync(string resource, string ns, string kubeconfig, string labelSelector = "", CancellationToken ct = default);
/// <summary>
/// Executes a SQL statement against the CNPG primary pod.
/// Uses kubectl exec to connect to the primary and run psql.
/// </summary>
Task ExecuteSqlAsync(string clusterName, string ns, string sql, string kubeconfig, CancellationToken ct = default);
}