You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by jefflill December 29, 2021
This looks like a really cool library. We're looking at this for implementing operators for a nascent Kubernetes distribution: neonKUBE
One problem I'm having is actually building an operator that generates CRDs. The issue appears to be with dependency injection trying to construct a KubernetesClient instance when I don't have a current Kubernetes context specified in my .kube/config file.
I replicated this with your KubeOps.TestOperator by executing (without a current Kubernetes context) in the debugger with this command line:
generator crds --out config\crds --format Yaml
here's the exception:
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> k8s.Exceptions.KubeConfigException: Cannot infer server host url either from context or masterUrl
at k8s.KubernetesClientConfiguration.GetKubernetesClientConfiguration(String currentContext, String masterUrl, K8SConfiguration k8SConfig)
at k8s.KubernetesClientConfiguration.BuildConfigFromConfigObject(K8SConfiguration k8SConfig, String currentContext, String masterUrl)
at k8s.KubernetesClientConfiguration.BuildDefaultConfig()
at DotnetKubernetesClient.KubernetesClient..ctor()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ServiceProvider.GetService(Type serviceType)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.System.IServiceProvider.GetService(Type serviceType)
at McMaster.Extensions.CommandLineUtils.Conventions.ConstructorInjectionConvention.FindMatchedConstructor[TModel](ConstructorInfo[] constructors, IServiceProvider services, Boolean throwIfNoParameterTypeRegistered)
at McMaster.Extensions.CommandLineUtils.Conventions.ConstructorInjectionConvention.ApplyImpl[TModel](ConventionContext context)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at McMaster.Extensions.CommandLineUtils.Conventions.ConstructorInjectionConvention.Apply(ConventionContext context)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Builder.McMaster.Extensions.CommandLineUtils.Conventions.IConventionBuilder.AddConvention(IConvention convention)
at McMaster.Extensions.CommandLineUtils.ConventionBuilderExtensions.UseConstructorInjection(IConventionBuilder builder, IServiceProvider additionalServices)
at KubeOps.Operator.HostExtensions.RunOperatorAsync(IHost host, String[] args) in C:\Temp\dotnet-operator-sdk\src\KubeOps\Operator\HostExtensions.cs:line 24
at Program.<Main>$(String[] args) in C:\Temp\dotnet-operator-sdk\tests\KubeOps.TestOperator\Program.cs:line 10
at Program.<Main>(String[] args)
It seems to me that constructing a KubernetesClient instance isn't really necessary for generating the CRDs. Is there a way to avoid this?
The text was updated successfully, but these errors were encountered:
Discussed in #343
Originally posted by jefflill December 29, 2021
This looks like a really cool library. We're looking at this for implementing operators for a nascent Kubernetes distribution: neonKUBE
One problem I'm having is actually building an operator that generates CRDs. The issue appears to be with dependency injection trying to construct a
KubernetesClient
instance when I don't have a current Kubernetes context specified in my .kube/config file.I replicated this with your KubeOps.TestOperator by executing (without a current Kubernetes context) in the debugger with this command line:
here's the exception:
It seems to me that constructing a
KubernetesClient
instance isn't really necessary for generating the CRDs. Is there a way to avoid this?The text was updated successfully, but these errors were encountered: