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.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
127 directories
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 Kustomize resources
dotnet add package Devantler.KubernetesGenerator.Kustomize
# For generating native resources
dotnet add package Devantler.KubernetesGenerator.Native
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
CertManagerCertificateGenerator
CertManagerClusterIssuerGenerator
FluxHelmReleaseGenerator
FluxHelmRepositoryGenerator
FluxKustomizationGenerator
KindConfigGenerator
K3dConfigGenerator
KustomizeComponentGenerator
KustomizeKustomizationGenerator
The native generators are categorized according to the groupings on Kubernetes API Overview
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
❌
ConfigMapGenerator
CSIDriverGenerator
CSINodeGenerator
CSIStorageCapacityGenerator
PersistentVolumeClaimGenerator
SecretGenerator
StorageClassGenerator
VolumeAttachmentGenerator
VolumeAttributesClassGenerator
ClusterTrustBundleGenerator
ControllerRevisionGenerator
CustomResourceDefinitionGenerator
DeviceClassGenerator
EventGenerator
HorizontalPodAutoscalerGenerator
LimitRangeGenerator
MutatingWebhookConfigurationGenerator
PodDisruptionBudgetGenerator
PodSchedulingContextGenerator
PodTemplateGenerator
PriorityClassGenerator
ResourceClaimGenerator
ResourceClaimTemplateGenerator
ResourceSliceGenerator
ValidatingAdmissionPolicyBindingGenerator
ValidatingAdmissionPolicyGenerator
ValidatingWebhookConfigurationGenerator
EndpointsGenerator
EndpointSliceGenerator
IngressClassGenerator
IngressGenerator
ServiceGenerator
CronJobGenerator
DaemonSetGenerator
DeploymentGenerator
JobGenerator
PodGenerator
ReplicaSetGenerator
ReplicationControllerGenerator
StatefulSetGenerator