Skip to content

Commit

Permalink
Upgraded packages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyzimarev committed Mar 23, 2022
1 parent fd9dde8 commit c0a589f
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 57 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MinVer" Version="2.5.0" PrivateAssets="All"/>
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" PrivateAssets="All"/>
<PackageReference Include="MinVer" Version="3.1.0" PrivateAssets="All"/>
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

<ItemGroup>
<PackageReference Include="ConsoleTableExt" Version="3.1.9" />
<PackageReference Include="Pulumi.Automation" Version="3.17.0" />
<PackageReference Include="Pulumi.Automation" Version="3.26.1" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="all" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.21216.1" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Pulumi.Kubernetes" Version="3.*" ExcludeAssets="contentFiles" />
<PackageReference Include="Pulumi.Kubernetes" Version="3.17.0" ExcludeAssets="contentFiles" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Pulumi.Kubernetes" Version="3.*" ExcludeAssets="contentFiles" />
<PackageReference Include="Pulumi.Kubernetes" Version="3.17.0" ExcludeAssets="contentFiles" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Pulumi.Kubernetes" Version="3.*" ExcludeAssets="contentFiles" />
<PackageReference Include="Pulumi.Kubernetes" Version="3.17.0" ExcludeAssets="contentFiles" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ubiquitous.AutoDevOps.Stack\Ubiquitous.AutoDevOps.Stack.csproj" />
Expand Down
20 changes: 10 additions & 10 deletions Ubiquitous.AutoDevOps.Stack/Factories/Pods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static List<ContainerArgs> GetAppContainers(
appSettings.PortName,
(c, p) =>
c.Ports = new[] {
new ContainerPortArgs {Name = p, ContainerPortValue = appSettings.Port}
new ContainerPortArgs { Name = p, ContainerPortValue = appSettings.Port }
}
)
.When(
Expand All @@ -47,7 +47,7 @@ public static List<ContainerArgs> GetAppContainers(
appSecret,
(c, s) =>
c.EnvFrom = new EnvFromSourceArgs {
SecretRef = new SecretEnvSourceArgs {Name = s.Metadata.Apply(x => x.Name)}
SecretRef = new SecretEnvSourceArgs { Name = s.Metadata.Apply(x => x.Name) }
}
)
.WhenNotEmptyString(
Expand All @@ -63,7 +63,7 @@ public static List<ContainerArgs> GetAppContainers(

configureContainer?.Invoke(container);

var containers = new List<ContainerArgs> {container};
var containers = new List<ContainerArgs> { container };
if (sidecars != null) containers.AddRange(sidecars);

return containers;
Expand Down Expand Up @@ -103,8 +103,8 @@ public static PodTemplateSpecArgs GetPodTemplate(
/// <returns></returns>
public static InputMap<string> Resource(string cpu, string memory)
=> new() {
{"cpu", cpu},
{"memory", memory}
{ "cpu", cpu },
{ "memory", memory }
};

/// <summary>
Expand All @@ -124,18 +124,18 @@ public static InputMap<string> Resource(string cpu, string memory)
public static InputList<LocalObjectReferenceArgs> ImagePullSecrets(params Output<string>?[] imagePullSecrets)
=> imagePullSecrets
.Where(x => x != null)
.Select(x => new LocalObjectReferenceArgs {Name = x!})
.Select(x => new LocalObjectReferenceArgs { Name = x! })
.ToArray();

public static EnvVarArgs EnvVar(string name, string value) => new() {Name = name, Value = value};
public static EnvVarArgs EnvVar(string name, string value) => new() { Name = name, Value = value };

public static VolumeMountArgs VolumeMount(string name, string mountPath)
=> new() {Name = name, MountPath = mountPath};
=> new() { Name = name, MountPath = mountPath };

public static EnvVarArgs FieldFrom(string envName, string field)
=> new() {
Name = envName,
ValueFrom = new EnvVarSourceArgs {FieldRef = new ObjectFieldSelectorArgs {FieldPath = field}}
ValueFrom = new EnvVarSourceArgs { FieldRef = new ObjectFieldSelectorArgs { FieldPath = field } }
};

/// <summary>
Expand Down
9 changes: 6 additions & 3 deletions Ubiquitous.AutoDevOps.Stack/Resources/KubeCronJob.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using JetBrains.Annotations;
using Pulumi;
using Pulumi.Kubernetes.Batch.V1Beta1;
using Pulumi.Kubernetes.Core.V1;
using Pulumi.Kubernetes.Types.Inputs.Batch.V1;
Expand All @@ -9,7 +10,7 @@
using CronJobSpecArgs = Pulumi.Kubernetes.Types.Inputs.Batch.V1Beta1.CronJobSpecArgs;
using JobTemplateSpecArgs = Pulumi.Kubernetes.Types.Inputs.Batch.V1Beta1.JobTemplateSpecArgs;

namespace Ubiquitous.AutoDevOps.Stack.Resources;
namespace Ubiquitous.AutoDevOps.Stack.Resources;

[PublicAPI]
public class KubeCronJob {
Expand All @@ -23,7 +24,8 @@ public static CronJob Create(
Secret imagePullSecret,
Secret? appSecret,
Action<ContainerArgs>? configureContainer = null,
Action<PodSpecArgs>? configurePod = null
Action<PodSpecArgs>? configurePod = null,
ProviderResource? providerResource = null
) {
var appLabels = Meta.AppLabels(appSettings, resourceName, deploySettings.Release);
var gitLabAnnotations = gitLabSettings.GitLabAnnotations();
Expand Down Expand Up @@ -64,7 +66,8 @@ public static CronJob Create(
Spec = new JobSpecArgs { Template = podTemplate }
}
}
}
},
providerResource.AsResourceOptions()
);
}
}
8 changes: 2 additions & 6 deletions Ubiquitous.AutoDevOps.Stack/Resources/KubeDeployment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using static Ubiquitous.AutoDevOps.Stack.AutoDevOpsSettings;
using Deployment = Pulumi.Kubernetes.Apps.V1.Deployment;

namespace Ubiquitous.AutoDevOps.Stack.Resources;
namespace Ubiquitous.AutoDevOps.Stack.Resources;

public static class KubeDeployment {
public static Deployment Create(
Expand Down Expand Up @@ -55,10 +55,6 @@ public static Deployment Create(
};
configureDeployment?.Invoke(deployment);

return new Deployment(
resourceName.AsPulumiName(),
deployment,
new CustomResourceOptions { Provider = providerResource }
);
return new Deployment(resourceName.AsPulumiName(), deployment, providerResource.AsResourceOptions());
}
}
6 changes: 1 addition & 5 deletions Ubiquitous.AutoDevOps.Stack/Resources/KubeIngress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ public static Ingress Create(
}
};

return new Ingress(
resourceName.AsPulumiName(),
ingress,
new CustomResourceOptions { Provider = providerResource }
);
return new Ingress(resourceName.AsPulumiName(), ingress, providerResource.AsResourceOptions());
}
}
38 changes: 31 additions & 7 deletions Ubiquitous.AutoDevOps.Stack/Resources/KubeNamespace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,38 @@ public static class KubeNamespace {
/// <returns></returns>
public static Namespace Create(
string name, Dictionary<string, string>? annotations = null, ProviderResource? providerResource = null
) {
var namespaceAnnotations = (annotations ?? new Dictionary<string, string>())
.AsInputMap();

return new Namespace(
)
=> new(
name,
new NamespaceArgs { Metadata = new ObjectMetaArgs { Name = name, Annotations = namespaceAnnotations } },
new CustomResourceOptions { Provider = providerResource }
new NamespaceBuilder(name).WithAnnotations(annotations).Build(),
providerResource.AsResourceOptions()
);
}

public class NamespaceBuilder {
readonly ObjectMetaArgs _meta = new();

public NamespaceBuilder(string name) => _meta.Name = name;

public NamespaceBuilder WithAnnotations(Dictionary<string, string>? annotations) {
if (annotations != null) _meta.Annotations = annotations;
return this;
}

public NamespaceBuilder WithLabels(Dictionary<string, string>? labels) {
if (labels != null) _meta.Labels = labels;
return this;
}

public NamespaceBuilder ConfigureMeta(Action<ObjectMetaArgs> configure) {
configure(_meta);
return this;
}

public NamespaceArgs Build() => new() { Metadata = _meta };
}

public static class ProviderExtensions {
public static CustomResourceOptions? AsResourceOptions(this ProviderResource? providerResource)
=> providerResource == null ? null : new CustomResourceOptions();
}
10 changes: 4 additions & 6 deletions Ubiquitous.AutoDevOps.Stack/Resources/KubeSecret.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class KubeSecret {
Namespace @namespace,
ResourceName resourceName,
AutoDevOpsSettings settings,
Dictionary<string, string>? extraData = null,
Dictionary<string, string>? extraData = null,
ProviderResource? providerResource = null
) {
var env = GetEnvironmentVariables();
Expand Down Expand Up @@ -60,7 +60,7 @@ public static class KubeSecret {
Type = "opaque",
StringData = vars
},
new CustomResourceOptions { Provider = providerResource }
providerResource.AsResourceOptions()
);
}

Expand All @@ -85,7 +85,7 @@ public static Secret CreateAppSecret(
Type = "opaque",
StringData = variables
},
new CustomResourceOptions { Provider = providerResource }
providerResource.AsResourceOptions()
);

/// <summary>
Expand Down Expand Up @@ -115,9 +115,7 @@ public static Secret CreateRegistrySecret(
Type = "kubernetes.io/dockerconfigjson",
Data = new InputMap<string> { { ".dockerconfigjson", content } }
},
new CustomResourceOptions {
Provider = providerResource
}
providerResource.AsResourceOptions()
);
}
}
8 changes: 2 additions & 6 deletions Ubiquitous.AutoDevOps.Stack/Resources/KubeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Ubiquitous.AutoDevOps.Stack.Factories;
using static Ubiquitous.AutoDevOps.Stack.AutoDevOpsSettings;

namespace Ubiquitous.AutoDevOps.Stack.Resources;
namespace Ubiquitous.AutoDevOps.Stack.Resources;

[PublicAPI]
public static class KubeService {
Expand Down Expand Up @@ -118,10 +118,6 @@ public static Service Create(
};
configureService?.Invoke(serviceArgs);

return new Service(
resourceName.AsPulumiName(),
serviceArgs,
new CustomResourceOptions {Provider = providerResource}
);
return new Service(resourceName.AsPulumiName(), serviceArgs, providerResource.AsResourceOptions());
}
}
7 changes: 1 addition & 6 deletions Ubiquitous.AutoDevOps.Stack/Resources/KubeStatefulSet.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using JetBrains.Annotations;
using Pulumi;
using Pulumi.Kubernetes.Apps.V1;
Expand Down Expand Up @@ -65,10 +64,6 @@ public static StatefulSet Create(
};
configureStatefulSet?.Invoke(statefulSetArgs);

return new StatefulSet(
resourceName.AsPulumiName(),
statefulSetArgs,
new CustomResourceOptions { Provider = providerResource }
);
return new StatefulSet(resourceName.AsPulumiName(), statefulSetArgs, providerResource.AsResourceOptions());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Pulumi.Kubernetes" Version="3.9.0" />
<PackageReference Include="Pulumi.Kubernetes" Version="3.17.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit c0a589f

Please sign in to comment.