Mark subproject as dirty in CMKS - Infra
This commit is contained in:
41
src/EntKube.Web/Services/IKubernetesClientFactory.cs
Normal file
41
src/EntKube.Web/Services/IKubernetesClientFactory.cs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user