Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port TypeScript Azure Helm example to C# #949

Merged
merged 8 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Continue formatting fixes
  • Loading branch information
t0yv0 committed Mar 22, 2021
commit 810f2f25ea50afcd19182555548c93fa4da2cd57
14 changes: 8 additions & 6 deletions azure-cs-aks-helm/MyCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
using Pulumi.AzureNative.ContainerService;
using Pulumi.AzureNative.ContainerService.Inputs;
using Pulumi.AzureNative.Resources;
using K8S = Pulumi.Kubernetes;
using K8s = Pulumi.Kubernetes;

class MyCluster
{
public Output<string> ClusterName { get; set; }
public Output<string> Kubeconfig { get; set; }

public K8S.Provider Provider { get; set; }
public K8s.Provider Provider { get; set; }

public MyCluster(MyConfig cfg)
{
Expand All @@ -39,12 +39,14 @@ public MyCluster(MyConfig cfg)
var k8sCluster = new ManagedCluster("cluster", new ManagedClusterArgs
{
ResourceGroupName = resourceGroup.Name,
AddonProfiles = new Dictionary<string, ManagedClusterAddonProfileArgs>
AddonProfiles =
{
["KubeDashboard"] = new ManagedClusterAddonProfileArgs { Enabled = true }
},
AgentPoolProfiles = {
new ManagedClusterAgentPoolProfileArgs {
AgentPoolProfiles =
{
new ManagedClusterAgentPoolProfileArgs
{
Count = cfg.NodeCount,
VmSize = cfg.NodeSize,
MaxPods = 110,
Expand Down Expand Up @@ -95,7 +97,7 @@ public MyCluster(MyConfig cfg)
.Apply(Convert.FromBase64String)
.Apply(Encoding.UTF8.GetString);

this.Provider = new K8S.Provider("k8s-provider", new K8S.ProviderArgs
this.Provider = new K8s.Provider("k8s-provider", new K8s.ProviderArgs
{
KubeConfig = Kubeconfig
});
Expand Down
22 changes: 12 additions & 10 deletions azure-cs-aks-helm/MyStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@ public MyStack()
var myConfig = new MyConfig();
var myCluster = new MyCluster(myConfig);

var chart = new Chart("apache-chart", new ChartArgs {
Chart = "apache",
Version = "8.3.2",
FetchOptions = new ChartFetchArgs {
Repo = "https://charts.bitnami.com/bitnami"
}
}, new ComponentResourceOptions {
var chart = new Chart("apache-chart", new ChartArgs
{
Chart = "apache",
Version = "8.3.2",
FetchOptions = new ChartFetchArgs
{
Repo = "https://charts.bitnami.com/bitnami"
}
}, new ComponentResourceOptions
{
Provider = myCluster.Provider
});

this.ApacheServiceIP = chart.GetResource<Service>("apache-chart").Apply(svc => {
return svc.Status.Apply(s => s.LoadBalancer.Ingress[0].Ip);
});
this.ApacheServiceIP = chart.GetResource<Service>("apache-chart")
.Apply(svc => svc.Status.Apply(s => s.LoadBalancer.Ingress[0].Ip));

this.ClusterName = myCluster.ClusterName;
this.Kubeconfig = myCluster.Kubeconfig;
Expand Down