sparse-intern-71089
06/10/2022, 10:54 AMdry-salesmen-32588
06/10/2022, 10:57 AMdry-salesmen-32588
06/10/2022, 10:59 AMdry-salesmen-32588
06/10/2022, 11:00 AMdry-salesmen-32588
06/10/2022, 11:05 AMdry-salesmen-32588
06/10/2022, 11:05 AMdry-salesmen-32588
06/10/2022, 11:07 AMechoing-dinner-19531
06/10/2022, 12:09 PMthat some resources are not resolved properly now.Not totally sure what you mean by this? Are you saying that the Outputs from resources are coming back null?
dry-salesmen-32588
06/10/2022, 12:09 PMechoing-dinner-19531
06/10/2022, 12:09 PMdry-salesmen-32588
06/10/2022, 12:10 PMdry-salesmen-32588
06/10/2022, 12:11 PMdry-salesmen-32588
06/10/2022, 12:12 PM2022-06-09T07:18:01.5820701Z Diagnostics:
2022-06-09T07:18:01.5834051Z pulumi:pulumi:Stack (DevSecOps.NgdpPlatform-ci):
2022-06-09T07:18:01.5835107Z error: Running program '/work/src/ApplicationPlatform/bin/Debug/netcoreapp3.1/ApplicationPlatform.dll' failed with an unhandled exception:
2022-06-09T07:18:01.5835788Z System.NullReferenceException: Object reference not set to an instance of an object.
2022-06-09T07:18:01.5836668Z at void ApplicationPlatform.CaaS.Cluster.EksCluster.CreateKubeConfig(string name)+(ValueTuple<ClusterCertificateAuthority, string, string, GetRoleResult> c) => { } [5] in /work/src/ApplicationPlatform/CaaS/Cluster/EksCluster.cs:line 352
2022-06-09T07:18:01.5837530Z at Output<U> Pulumi.Output<T>.Apply<U>(Func<T, U> func)+(T t) => { }
2022-06-09T07:18:01.5840301Z at async Task<OutputData<U>> Pulumi.Output<T>.ApplyHelperAsync<U>(Task<OutputData<T>> dataTask, Func<T, Output<U>> func)
2022-06-09T07:18:01.5841455Z error: Running program '/work/src/ApplicationPlatform/bin/Debug/netcoreapp3.1/ApplicationPlatform.dll' failed with an unhandled exception:
2022-06-09T07:18:01.5842151Z System.NullReferenceException: Object reference not set to an instance of an object.
2022-06-09T07:18:01.5842976Z at void ApplicationPlatform.CaaS.Cluster.EksCluster.CreateKubeConfig(string name)+(ValueTuple<ClusterCertificateAuthority, string, string> c) => { } [4] in /work/src/ApplicationPlatform/CaaS/Cluster/EksCluster.cs:line 294
2022-06-09T07:18:01.5843783Z at Output<U> Pulumi.Output<T>.Apply<U>(Func<T, U> func)+(T t) => { }
2022-06-09T07:18:01.5844350Z at async Task<OutputData<U>> Pulumi.Output<T>.ApplyHelperAsync<U>(Task<OutputData<T>> dataTask, Func<T, Output<U>> func)
2022-06-09T07:18:01.5844970Z at async Task<OutputData<object>> Pulumi.Output<T>.Pulumi.IOutput.GetDataAsync()
2022-06-09T07:18:01.5845619Z at async Task<object> Pulumi.Serialization.Serializer.SerializeAsync(string ctx, object prop, bool keepResources, bool keepOutputValues) x 2
2022-06-09T07:18:01.5846550Z at async Task<RawSerializationResult> Pulumi.Deployment.SerializeFilteredPropertiesRawAsync(string label, IDictionary<string, object> args, Predicate<string> acceptKey, bool keepResources, bool keepOutputValues)
2022-06-09T07:18:01.5847615Z at async Task<SerializationResult> Pulumi.Deployment.SerializeFilteredPropertiesAsync(string label, IDictionary<string, object> args, Predicate<string> acceptKey, bool keepResources, bool keepOutputValues)
2022-06-09T07:18:01.5848839Z at async Task<PrepareResult> Pulumi.Deployment.PrepareResourceAsync(string label, Resource res, bool custom, bool remote, ResourceArgs args, ResourceOptions options)
2022-06-09T07:18:01.5850085Z at async Task<(string urn, string id, Struct data, ImmutableDictionary<string, ImmutableHashSet<Resource>> dependencies)> Pulumi.Deployment.RegisterResourceAsync(Resource resource, bool remote, Func<string, Resource> newDependency, ResourceArgs args, ResourceOptions options)
2022-06-09T07:18:01.5851411Z at async Task<(string urn, string id, Struct data, ImmutableDictionary<string, ImmutableHashSet<Resource>> dependencies)> Pulumi.Deployment.ReadOrRegisterResourceAsync(Resource resource, bool remote, Func<string, Resource> newDependency, ResourceArgs args, ResourceOptions options)
2022-06-09T07:18:01.5852655Z at async Task Pulumi.Deployment.CompleteResourceAsync(Resource resource, bool remote, Func<string, Resource> newDependency, ResourceArgs args, ResourceOptions options, ImmutableDictionary<string, IOutputCompletionSource> completionSources)
2022-06-09T07:18:01.5853500Z at async Task<T> Pulumi.Output<T>.GetValueAsync(T whenUnknown)
2022-06-09T07:18:01.5854100Z at async Task<HashSet<string>> Pulumi.Deployment.GetAllTransitivelyReferencedResourceUrnsAsync(HashSet<Resource> resources)
2022-06-09T07:18:01.5854886Z at async Task<PrepareResult> Pulumi.Deployment.PrepareResourceAsync(string label, Resource res, bool custom, bool remote, ResourceArgs args, ResourceOptions options)
2022-06-09T07:18:01.5855982Z at async Task<(string urn, string id, Struct data, ImmutableDictionary<string, ImmutableHashSet<Resource>> dependencies)> Pulumi.Deployment.RegisterResourceAsync(Resource resource, bool remote, Func<string, Resource> newDependency, ResourceArgs args, ResourceOptions options)
2022-06-09T07:18:01.5857286Z at async Task<(string urn, string id, Struct data, ImmutableDictionary<string, ImmutableHashSet<Resource>> dependencies)> Pulumi.Deployment.ReadOrRegisterResourceAsync(Resource resource, bool remote, Func<string, Resource> newDependency, ResourceArgs args, ResourceOptions options)
2022-06-09T07:18:01.5858554Z at async Task Pulumi.Deployment.CompleteResourceAsync(Resource resource, bool remote, Func<string, Resource> newDependency, ResourceArgs args, ResourceOptions options, ImmutableDictionary<string, IOutputCompletionSource> completionSources)
----- SNIP ------
2022-06-09T07:18:01.5903204Z at async Task<T> Pulumi.Output<T>.GetValueAsync(T whenUnknown)
2022-06-09T07:18:01.5903733Z at async Task<string> Pulumi.Deployment+EngineLogger.TryGetResourceUrnAsync(Resource resource)
2022-06-09T07:18:01.5904150Z
echoing-dinner-19531
06/10/2022, 12:15 PMOutput.All
though? That seems pointless.dry-salesmen-32588
06/10/2022, 12:16 PMdry-salesmen-32588
06/10/2022, 12:16 PMdry-salesmen-32588
06/10/2022, 12:17 PMdry-salesmen-32588
06/10/2022, 12:18 PMdry-salesmen-32588
06/10/2022, 12:18 PMechoing-dinner-19531
06/10/2022, 12:18 PMdry-salesmen-32588
06/10/2022, 12:18 PMechoing-dinner-19531
06/10/2022, 12:23 PMechoing-dinner-19531
06/10/2022, 12:24 PMdry-salesmen-32588
06/13/2022, 9:25 AMdry-salesmen-32588
06/13/2022, 9:25 AMdry-salesmen-32588
06/13/2022, 9:31 AMechoing-dinner-19531
06/13/2022, 10:45 AMcould it somehow be related to the fact that the code is attempting to resolve outputs inside a componentresource ?I don't think that should matter.
dry-salesmen-32588
06/13/2022, 12:01 PMdry-salesmen-32588
06/13/2022, 12:01 PMechoing-dinner-19531
06/13/2022, 12:02 PMechoing-dinner-19531
06/13/2022, 12:05 PMdry-salesmen-32588
06/13/2022, 12:37 PMdry-salesmen-32588
06/13/2022, 12:38 PMdry-salesmen-32588
06/13/2022, 12:39 PMdry-salesmen-32588
06/13/2022, 12:41 PMdry-salesmen-32588
06/13/2022, 12:42 PMechoing-dinner-19531
06/13/2022, 12:46 PMor is it simply considered a "bug".. and we will have to figure out a way around it ourselves by hacking around itYup, unfortunately. I mean the issue is an object property isn't set when you expect it to be set. I think you could write a loop to keep trying to read the property until it comes back non-null, and then use that but I don't think there's much value in trying to write a helper function in the pulumi SDK to do that.
dry-salesmen-32588
06/13/2022, 12:47 PMechoing-dinner-19531
06/13/2022, 12:48 PMdry-salesmen-32588
06/14/2022, 8:02 AMdry-salesmen-32588
06/14/2022, 8:16 AMint retrymax=10;
int retrycounter=0;
bool annoyingresourcehack=true;
while(annoyingresourcehack){
try{
UserKubeConfig = Output.Tuple(certauth, endpoint, arn).Apply(c =>
{
var k8SConfiguration = new K8SConfiguration
{
Clusters =
new List<k8s.KubeConfigModels.Cluster>
{
new k8s.KubeConfigModels.Cluster
{
Name = c.Item3,
ClusterEndpoint = new ClusterEndpoint
{
Server = c.Item2, CertificateAuthorityData = c.Item1.Data
}
}
},
Users = new List<User>
{
new User
{
Name = c.Item3,
UserCredentials = new UserCredentials
{
ExternalExecution = new ExternalExecution
{
ApiVersion = "<http://client.authentication.k8s.io/v1alpha1|client.authentication.k8s.io/v1alpha1>",
Command = "aws",
Arguments = new[]
{
"--region", Config.Region,
"eks", "get-token", "--cluster-name", name
}
}
}
}
},
Contexts = new List<Context>
{
new Context
{
Name = c.Item3,
ContextDetails = new ContextDetails
{
User = c.Item3,
Cluster = c.Item3
}
}
},
ApiVersion = "v1",
CurrentContext = c.Item3
};
var serializer = new Serializer();
return serializer.Serialize(k8SConfiguration);
});
annoyingresourcehack=false;
}
catch(NullReferenceException e){
if(retrycounter==retrymax){
Console.WriteLine("retries exhausted while attempting to fetch UserKubeConfig in CreateKubeConfig(str)");
throw e;
}
Console.WriteLine("unable to resolve resource for UserKubeConfig in CreateKubeConfig(str), retrying..");
Thread.Sleep(5000);
retrycounter++;
}
}
its ugly, and i felt dirty after i wrote this "fix" - but evidently our pipelines can now run without failing 😞echoing-dinner-19531
06/14/2022, 8:22 AMOutput.Tuple(certauth, endpoint, arn)
which is throwing? But also that is a hot loop, Apply function don't run synchronously so your probably creating hundreds or thousands of apply objects doing this!