Skip to content

A simple code generator that can generate Kubernetes manifest files.

License

Notifications You must be signed in to change notification settings

devantler/dotnet-kubernetes-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☸️ .NET Kubernetes Generator

License Test codecov

A simple code generator that can generate Kubernetes resources.

Show/hide folder structure
.
├── .github
│   └── workflows
├── Devantler.KubernetesGenerator.CertManager
│   └── Models
│       └── IssuerRef
├── Devantler.KubernetesGenerator.CertManager.Tests
│   ├── CertManagerCertificateGeneratorTests
│   └── CertManagerClusterIssuerGeneratorTests
├── Devantler.KubernetesGenerator.Core
│   ├── Converters
│   └── Inspectors
├── Devantler.KubernetesGenerator.Flux
│   └── Models
│       ├── Dependencies
│       ├── Images
│       ├── KubeConfig
│       ├── Metadata
│       ├── Patches
│       ├── SecretRef
│       └── Sources
├── Devantler.KubernetesGenerator.Flux.Tests
│   ├── FluxHelmReleaseGeneratorTests
│   ├── FluxHelmRepositoryGeneratorTests
│   └── FluxKustomizationGeneratorTests
├── Devantler.KubernetesGenerator.K3d
│   └── Models
│       ├── Options
│       │   ├── K3d
│       │   ├── K3s
│       │   └── Runtime
│       └── Registries
├── Devantler.KubernetesGenerator.K3d.Tests
│   └── K3dConfigGeneratorTests
├── Devantler.KubernetesGenerator.KSail
├── Devantler.KubernetesGenerator.KSail.Tests
│   └── KSailClusterGeneratorTests
├── Devantler.KubernetesGenerator.Kind
│   └── Models
│       ├── Networking
│       └── Nodes
├── Devantler.KubernetesGenerator.Kind.Tests
│   └── KindConfigGeneratorTests
├── Devantler.KubernetesGenerator.Kustomize
│   └── Models
│       ├── Generators
│       └── Patches
├── Devantler.KubernetesGenerator.Kustomize.Tests
│   ├── KustomizeComponentGeneratorTests
│   └── KustomizeKustomizationGeneratorTests
├── Devantler.KubernetesGenerator.Native
│   ├── Cluster
│   ├── ConfigAndStorage
│   ├── Metadata
│   ├── Service
│   └── Workloads
└── Devantler.KubernetesGenerator.Native.Tests
    ├── ClusterTests
    │   ├── APIServiceGeneratorTests
    │   ├── BindingGeneratorTests
    │   ├── CertificateSigningRequestGeneratorTests
    │   ├── ClusterRoleBindingGeneratorTests
    │   ├── ClusterRoleGeneratorTests
    │   ├── ComponentStatusGeneratorTests
    │   ├── FlowSchemaGeneratorTests
    │   ├── IPAddressGeneratorTests
    │   ├── LeaseCandidateGeneratorTests
    │   ├── LeaseGeneratorTests
    │   ├── LocalSubjectAccessReviewGeneratorTests
    │   ├── NamespaceGeneratorTests
    │   ├── NetworkPolicyGeneratorTests
    │   ├── NodeGeneratorTests
    │   ├── PersistentVolumeGeneratorTests
    │   ├── PriorityLevelConfigurationGeneratorTests
    │   ├── ResourceQuotaGeneratorTests
    │   ├── RoleBindingGeneratorTests
    │   ├── RoleGeneratorTests
    │   ├── RuntimeClassGeneratorTests
    │   ├── SelfSubjectAccessReviewGeneratorTests
    │   ├── SelfSubjectReviewGeneratorTests
    │   ├── SelfSubjectRulesReviewGeneratorTests
    │   ├── ServiceAccountGeneratorTests
    │   ├── ServiceCIDRGeneratorTests
    │   ├── StorageVersionGeneratorTests
    │   ├── StorageVersionMigrationGeneratorTests
    │   ├── SubjectAccessReviewGeneratorTests
    │   └── TokenReviewGeneratorTests
    ├── ConfigAndStorageTests
    │   ├── CSIDriverGeneratorTests
    │   ├── CSINodeGeneratorTests
    │   ├── CSIStorageCapacityGeneratorTests
    │   ├── ConfigMapGeneratorTests
    │   ├── PersistentVolumeClaimGeneratorTests
    │   ├── SecretGeneratorTests
    │   ├── StorageClassGeneratorTests
    │   ├── VolumeAttachmentGeneratorTests
    │   └── VolumeAttributesClassGeneratorTests
    ├── MetadataTests
    │   ├── ClusterTrustBundleGeneratorTests
    │   ├── ControllerRevisionGeneratorTests
    │   ├── CustomResourceDefinitionGeneratorTests
    │   ├── DeviceClassGeneratorTests
    │   ├── EventGeneratorTests
    │   ├── HorizontalPodAutoscalerGeneratorTests
    │   ├── LimitRangeGeneratorTests
    │   ├── MutatingWebhookConfigurationGeneratorTests
    │   ├── PodDisruptionBudgetGeneratorTests
    │   ├── PodSchedulingContextGeneratorTests
    │   ├── PodTemplateGeneratorTests
    │   ├── PriorityClassGeneratorTests
    │   ├── ResourceClaimGeneratorTests
    │   ├── ResourceClaimTemplateGeneratorTests
    │   ├── ResourceSliceGeneratorTests
    │   ├── ValidatingAdmissionPolicyBindingGeneratorTests
    │   ├── ValidatingAdmissionPolicyGeneratorTests
    │   └── ValidatingWebhookConfigurationGeneratorTests
    ├── ServiceTests
    │   ├── EndpointSliceGeneratorTests
    │   ├── EndpointsGeneratorTests
    │   ├── IngressClassGeneratorTests
    │   ├── IngressGeneratorTests
    │   └── ServiceGeneratorTests
    └── WorkloadTests
        ├── CronJobGeneratorTests
        ├── DaemonSetGeneratorTests
        ├── DeploymentGeneratorTests
        ├── JobGeneratorTests
        ├── PodGeneratorTests
        ├── ReplicaSetGeneratorTests
        ├── ReplicationControllerGeneratorTests
        └── StatefulSetGeneratorTests

130 directories

Prerequisites

🚀 Getting Started

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

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

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

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

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

# For generating KSail resources
dotnet add package Devantler.KubernetesGenerator.KSail

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

# For generating native resources
dotnet add package Devantler.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 Devantler.KubernetesGenerator.Native;

var generator = new ConfigMapKubernetesGenerator();

var configMap = new V1ConfigMap
{
    ApiVersion = "v1",
    Kind = "ConfigMap",
    Metadata = new V1ObjectMeta
    {
        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

  • FluxHelmReleaseGenerator
  • FluxHelmRepositoryGenerator
  • FluxKustomizationGenerator

Kind

  • KindConfigGenerator

K3d

  • K3dConfigGenerator

KSail

  • KSailClusterGenerator

Kustomize

  • KustomizeComponentGenerator
  • KustomizeKustomizationGenerator

Native

The native generators are categorized according to the groupings on Kubernetes API Overview

Cluster

  • APIServiceGenerator
  • BindingGenerator
  • CertificateSigningRequestGenerator
  • ClusterRoleBindingGenerator
  • ClusterRoleGenerator
  • ComponentStatusGenerator
  • FlowSchemaGenerator
  • IPAddressGenerator
  • LeaseCandidateGenerator
  • LeaseGenerator
  • LocalSubjectAccessReviewGenerator
  • NamespaceGenerator
  • NetworkPolicyGenerator
  • NodeGenerator
  • PersistentVolumeGenerator
  • PriorityLevelConfigurationGenerator
  • ResourceQuotaGenerator
  • RoleBindingGenerator
  • RoleGenerator
  • RuntimeClassGenerator
  • SelfSubjectAccessReviewGenerator
  • SelfSubjectReviewGenerator
  • SelfSubjectRulesReviewGenerator
  • ServiceAccountGenerator
  • ServiceCIDRGenerator
  • StorageVersionGenerator
  • StorageVersionMigrationGenerator
  • SubjectAccessReviewGenerator
  • TokenReviewGenerator
  • TokenRequestGenerator

Config and Storage

  • ConfigMapGenerator
  • CSIDriverGenerator
  • CSINodeGenerator
  • CSIStorageCapacityGenerator
  • PersistentVolumeClaimGenerator
  • SecretGenerator
  • StorageClassGenerator
  • VolumeAttachmentGenerator
  • VolumeAttributesClassGenerator

Metadata

  • ClusterTrustBundleGenerator
  • ControllerRevisionGenerator
  • CustomResourceDefinitionGenerator
  • DeviceClassGenerator
  • EventGenerator
  • HorizontalPodAutoscalerGenerator
  • LimitRangeGenerator
  • MutatingWebhookConfigurationGenerator
  • PodDisruptionBudgetGenerator
  • PodSchedulingContextGenerator
  • PodTemplateGenerator
  • PriorityClassGenerator
  • ResourceClaimGenerator
  • ResourceClaimTemplateGenerator
  • ResourceSliceGenerator
  • ValidatingAdmissionPolicyBindingGenerator
  • ValidatingAdmissionPolicyGenerator
  • ValidatingWebhookConfigurationGenerator

Service

  • EndpointsGenerator
  • EndpointSliceGenerator
  • IngressClassGenerator
  • IngressGenerator
  • ServiceGenerator

Workloads

  • CronJobGenerator
  • DaemonSetGenerator
  • DeploymentGenerator
  • JobGenerator
  • PodGenerator
  • ReplicaSetGenerator
  • ReplicationControllerGenerator
  • StatefulSetGenerator

About

A simple code generator that can generate Kubernetes manifest files.

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages