A simple code generator that can generate Kubernetes resources.
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.NativeTo 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: value2CertManagerCertificateGeneratorCertManagerClusterIssuerGenerator
FluxAlertGeneratorFluxAlertProviderGeneratorFluxHelmReleaseGeneratorFluxHelmRepositoryGeneratorFluxKustomizationGenerator
KindConfigGenerator
K3dConfigGenerator
KustomizeComponentGeneratorKustomizeKustomizationGenerator
ClusterIPServiceGeneratorClusterRoleBindingGeneratorClusterRoleGeneratorConfigMapGeneratorCronJobGeneratorDaemonSetGeneratorDeploymentGeneratorDockerRegistrySecretGeneratorExternalNameServiceGeneratorGenericSecretGeneratorHorizontalPodAutoscalerGeneratorIngressGeneratorJobGeneratorLoadBalancerServiceGeneratorNamespaceGeneratorNetworkPolicyGeneratorNodePortServiceGeneratorPersistentVolumeClaimGeneratorPersistentVolumeGeneratorPodDisruptionBudgetGeneratorPodGeneratorPriorityClassGeneratorResourceQuotaGeneratorRoleBindingGeneratorRoleGeneratorServiceAccountGeneratorStatefulSetGeneratorTLSSecretGenerator