Skip to content

devantler-tech/dotnet-kubernetes-generator

☸️ .NET Kubernetes Generator

License Test codecov

A simple code generator that can generate Kubernetes resources.

Prerequisites

🚀 Getting Started

To get started, you can install the packages from NuGet.

# For generating Cert Manager resources
dotnet add package DevantlerTech.KubernetesGenerator.CertManager

# For generating Flux resources
dotnet add package DevantlerTech.KubernetesGenerator.Flux

# For generating Kind resources
dotnet add package DevantlerTech.KubernetesGenerator.Kind

# For generating K3d resources
dotnet add package DevantlerTech.KubernetesGenerator.K3d

# For generating Kustomize resources
dotnet add package DevantlerTech.KubernetesGenerator.Kustomize

# For generating native resources
dotnet add package DevantlerTech.KubernetesGenerator.Native

📝 Usage

To use the generators, all you need to do is to create and use a new instance of the generator for the specific resource you want to generate. For example, to generate a new ConfigMap resource, you can use the ConfigMapKubernetesGenerator.

using DevantlerTech.KubernetesGenerator.Native;

var generator = new ConfigMapKubernetesGenerator();

var configMap = new ConfigMap
{
    Metadata = new NamespacedMetadata
    {
        Name = "my-config-map",
        Namespace = "default"
    },
    Data = new Dictionary<string, string>
    {
        { "key1", "value1" },
        { "key2", "value2" }
    }
};

await generator.GenerateAsync(configMap, "path/to/output/config-map.yaml");

This will generate a new ConfigMap resource at the specified path.

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config-map
  namespace: default
data:
  key1: value1
  key2: value2

Supported Generators

Cert Manager

  • CertManagerCertificateGenerator
  • CertManagerClusterIssuerGenerator

Flux

  • FluxAlertGenerator
  • FluxAlertProviderGenerator
  • FluxHelmReleaseGenerator
  • FluxHelmRepositoryGenerator
  • FluxKustomizationGenerator

Kind

  • KindConfigGenerator

K3d

  • K3dConfigGenerator

Kustomize

  • KustomizeComponentGenerator
  • KustomizeKustomizationGenerator

Native

  • ClusterIPServiceGenerator
  • ClusterRoleBindingGenerator
  • ClusterRoleGenerator
  • ConfigMapGenerator
  • CronJobGenerator
  • DaemonSetGenerator
  • DeploymentGenerator
  • DockerRegistrySecretGenerator
  • ExternalNameServiceGenerator
  • GenericSecretGenerator
  • HorizontalPodAutoscalerGenerator
  • IngressGenerator
  • JobGenerator
  • LoadBalancerServiceGenerator
  • NamespaceGenerator
  • NetworkPolicyGenerator
  • NodePortServiceGenerator
  • PersistentVolumeClaimGenerator
  • PersistentVolumeGenerator
  • PodDisruptionBudgetGenerator
  • PodGenerator
  • PriorityClassGenerator
  • ResourceQuotaGenerator
  • RoleBindingGenerator
  • RoleGenerator
  • ServiceAccountGenerator
  • StatefulSetGenerator
  • TLSSecretGenerator

About

A simple code generator that can generate Kubernetes manifest files.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 7

Languages