spec
spec copied to clipboard
Should Scope not be referenced by type?
As discussed in https://github.com/microsoft/hydra-spec/pull/44#issuecomment-521772248,
There would be no type fields for components, traits, or scopes.
This has been fixed in traits, but not in scopes
section in configuration yet.
@technosophos @vturecek @suhuruli Thoughts?
I think the way to do this would be to model it similarly to components. The name of the scope would be in the scope definition metadata:
apiVersion: core.oam.dev/v1alpha1
kind: ApplicationScope
metadata:
name: core.oam.dev.NetworkScope-1.1.0
annotations:
description: "network boundary that a group components reside in"
Creating the scope in the app config would look like this:
apiVersion: core.oam.dev/v1alpha1
kind: ApplicationConfiguration
metadata:
name: my-app
spec:
scopes:
- scopeName: core.oam.dev.NetworkScope-1.1.0
instanceName: myNetwork
properties:
- name: networkName
value: "..."
This is equivalent to components, where you have to specify the name of the component and give it an instance name, since you can create multiple instances of the same component or scope.
Unfortunately, we need to consider the version of the scope, and we should have a namespace to qualify it so we know that this NetworkScope refers to the core NetworkScope in the spec, and not to some custom one that a runtime provides. I'm not sure where else to put that information. My assumption is that the metadata name is the field that determines uniqueness in Kubernetes, so if we put it in annotations, we would probably have to do some additional parsing and string building before creating the resource.