-
Notifications
You must be signed in to change notification settings - Fork 40
Thoughts on refactoring Services in the spec #18
Comments
we can't rename anything, it has to be still possible to use the kubernetes way. You still have to be able to write full ServiceSpec if you want (you=creator of application) |
The first think we should figure out is where we will put ServiceSpec. Top level, or somewhere in PodSpec? |
@kadel what do you mean by top level, here? The top level is the PodSpec right now, and a more things. IMO, if we do not want to rename the fields in the ServiceSpec, then we should merge it with the PodSpec, like - type App struct {
...
...
api_v1.PodSpec
api_v1.ServiceSpec
} |
yes by top level I meant in PodSpec, not embedded but as it is right now. By somewhere in PodSpec I meant somewhere deeper (like port level in container) I don't think that merging PodSpec and ServiceSpac is good way to go. |
If we put this somewhere with ports with containers, then that means that we are defining services on a per container level, which means that if container 1 says that it needs to have a NodePort, then container 2 also gets a NodePort, but when we will look at the spec, this will not be the case, because NodePort will be mentioned in only container 1.
Why? A Service is applied at the Pod level, what looks wrong with merging 2 concepts that apply to the same level? |
It looks logically inconsistent. It will be much more cleaner and clearer to have it in seperate level. And more importantly how would you create multiple services if you merge podspec with servicespec? |
Whoops, yep, makes sense. |
For now, let's keep it like the way it is |
Okay, so this is the data that the ServiceSpec in Kubernetes contains -
Name
Ports
Selector
ClusterIP
Type
- one ofExternalName
,ClusterIP
,NodePort
, andLoadBalancer
ExternalIPs
SessionAffinity
LoadBalancerIP
LoadBalancerSourceRanges
ExternalName
Now, I understand that a service will be applied to the pods with the given selector, and yes, this needs to be defined outside
containers:
, so I think that the service spec should be defined at the root level.Selector
, because well, we are defining the service with a given pod, so the selected happens to be that automatically.Name
because we don't need it anywhere, and we can name it ourselves, like we used to do with containers in OpenCompose.Type
to something more generic likeExposeType
orAccessPolicy
orAccessType
, or something better than this which can be understood without the context of Kubernetes.An example file would look like -
The text was updated successfully, but these errors were encountered: