Class KubeServiceAdvice
Used by KubeClusterAdvice to record configuration advice for a specific Kurbernetes service being deployed.
Implements
Inherited Members
Namespace: Neon.Kube
Assembly: Neon.Kube.dll
Syntax
public class KubeServiceAdvice : ObjectDictionary, IObjectDictionary
Remarks
This class along with an early setup step is intended to be used to help centralize the logic that decides things like what resources to reserve for services, how many service pods to deploy as well as whether to control which nodes nodes a service's pods may be deployed via affinity/tainting.
Constructors
KubeServiceAdvice(string)
Constructor.
Declaration
public KubeServiceAdvice(string serviceIdentity)
Parameters
| Type | Name | Description |
|---|---|---|
| string | serviceIdentity | Identifies the service. |
Fields
MetricsEnabledProperty
int: Identifies the property specifying whether metrics are enabled for the service.
Declaration
public const string MetricsEnabledProperty = "metrics.enabled"
Field Value
| Type | Description |
|---|---|
| string |
MetricsIntervalProperty
int: Identifies the property specifying how often metrics should be scraped for the service.
Declaration
public const string MetricsIntervalProperty = "metrics.interval"
Field Value
| Type | Description |
|---|---|
| string |
PodCpuLimitProperty
double: Identifies the property specifying the maximum CPU to assign to each service pod.
Declaration
public const string PodCpuLimitProperty = "pod.cpu.limit"
Field Value
| Type | Description |
|---|---|
| string |
PodCpuRequestProperty
double: Identifies the property specifying the CPU to reserve for each service pod.
Declaration
public const string PodCpuRequestProperty = "pod.cpu.request"
Field Value
| Type | Description |
|---|---|
| string |
PodMemoryLimitProperty
decimal: Identifies the property specifying the maxumum bytes RAM that can be consumed by each service pod.
Declaration
public const string PodMemoryLimitProperty = "pod.memory.limit"
Field Value
| Type | Description |
|---|---|
| string |
PodMemoryRequestProperty
decimal: Identifies the property specifying the bytes of RAM to be reserved for each service pod.
Declaration
public const string PodMemoryRequestProperty = "pod.memory.request"
Field Value
| Type | Description |
|---|---|
| string |
ReplicaCountProperty
int: Identifies the property specifying how many pods should be deployed for the service.
Declaration
public const string ReplicaCountProperty = "replica.count"
Field Value
| Type | Description |
|---|---|
| string |
Properties
IsReadOnly
Cluster advice is designed to be configured once during cluster setup and then be
considered to be read-only thereafter. This property should be set to
true after the advice is intialized to prevent it from being modified
again.
note
This is necessary because setup is performed on multiple threads and this class is not inheritly thread-safe. This also fits with the idea that the logic behind this advice is to be centralized.
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| bool |
MetricsEnabled
Specifies whether metrics should be collected for the service.
Declaration
public bool? MetricsEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? |
MetricsInterval
Specifies the metrics scrape interval or null when this property is not set.
Declaration
public string MetricsInterval { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
PodCpuLimit
Specifies the CPU limit for each service pod or null when this property is not set.
Declaration
public double? PodCpuLimit { get; set; }
Property Value
| Type | Description |
|---|---|
| double? |
PodCpuRequest
Specifies the CPU request for each service pod or null when this property is not set.
Declaration
public double? PodCpuRequest { get; set; }
Property Value
| Type | Description |
|---|---|
| double? |
PodMemoryLimit
Specifies the memory limit for each service pod or null when this property is not set.
Declaration
public decimal? PodMemoryLimit { get; set; }
Property Value
| Type | Description |
|---|---|
| decimal? |
PodMemoryRequest
Specifies the memory request for each service pod or null when this property is not set.
Declaration
public decimal? PodMemoryRequest { get; set; }
Property Value
| Type | Description |
|---|---|
| decimal? |
ReplicaCount
Specifies the number of pods to be seployed for the service or null when this property is not set.
Declaration
public int? ReplicaCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
ServiceName
Returns the service name.
Declaration
public string ServiceName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetProperty(string)
Returns the property value if present or null.
Declaration
public string GetProperty(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The property name. |
Returns
| Type | Description |
|---|---|
| string | The property value or |
GetProperty<T>(string)
Returns the property value if present or null.
Declaration
public T? GetProperty<T>(string name) where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The property name. |
Returns
| Type | Description |
|---|---|
| T? | The property value or |
Type Parameters
| Name | Description |
|---|---|
| T | The value type. |