Skip to content

Commit f8b889c

Browse files
authored
Get Scope from metadata (#26)
1 parent 0f3ac81 commit f8b889c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/K8sOperator.NET.Generators/Install.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ private async Task Write(IKubernetesObject obj)
4949
private static V1CustomResourceDefinition CreateCustomResourceDefinition(IEventWatcher item)
5050
{
5151
var group = item.Metadata.OfType<KubernetesEntityAttribute>().First();
52+
var scope = item.Metadata.OfType<IEntityScopeMetadata>().First();
5253

5354
var crdBuilder = new CustomResourceDefinitionBuilder();
5455
crdBuilder.WithName($"{group.PluralName}.{group.Group}")
@@ -60,7 +61,7 @@ private static V1CustomResourceDefinition CreateCustomResourceDefinition(IEventW
6061
plural: group.PluralName,
6162
singular: group.Kind.ToLower()
6263
)
63-
.WithScope(EntityScope.Namespaced)
64+
.WithScope(scope.Scope)
6465
.WithVersion(
6566
group.ApiVersion,
6667
schema =>

0 commit comments

Comments
 (0)