Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"isRoot": true,
"tools": {
"kubeops.cli": {
"version": "9.1.6-alethic.5",
"version": "9.11.8",
"commands": [
"kubeops"
],
"rollForward": false
}
}
}
}
41 changes: 26 additions & 15 deletions charts/seq-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rules:
verbs:
- '*'
- apiGroups:
- ""
- ''
resources:
- secrets
- services
Expand All @@ -33,14 +33,22 @@ rules:
- events
verbs:
- '*'
- apiGroups:
- ''
resources:
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- '*'
- apiGroups:
- ""
- ''
resources:
- events
verbs:
Expand All @@ -53,7 +61,13 @@ rules:
resources:
- leases
verbs:
- '*'
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- seq.k8s.datalust.co
resources:
Expand All @@ -79,7 +93,15 @@ rules:
- update
- patch
- apiGroups:
- ""
- ''
resources:
- namespaces/status
verbs:
- get
- update
- patch
- apiGroups:
- ''
resources:
- services/status
verbs:
Expand Down Expand Up @@ -110,15 +132,4 @@ rules:
- get
- update
- patch


# Additional not generated
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- list
- watch
---
33 changes: 33 additions & 0 deletions src/Alethic.Seq.Operator/Instance/InstanceDeploymentSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,39 @@ public class InstanceDeploymentSpec
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ImagePullPolicy { get; set; }

/// <summary>
/// Liveness probe for the Seq container. Replaces the operator's own probe entirely when set; leave it unset
/// to keep the default.
/// </summary>
/// <remarks>
/// Seq answers <c>/health</c> from the same thread pool that serves ingestion, so on a busy or CPU-starved
/// instance the response can take seconds. The default probe is deliberately conservative rather than
/// generous, and a deployment that knows its own load may need to say so.
/// </remarks>
[JsonPropertyName("livenessProbe")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public V1Probe? LivenessProbe { get; set; }

/// <summary>
/// Readiness probe for the Seq container. Replaces the operator's own probe entirely when set; leave it unset
/// to keep the default.
/// </summary>
[JsonPropertyName("readinessProbe")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public V1Probe? ReadinessProbe { get; set; }

/// <summary>
/// Startup probe for the Seq container. Replaces the operator's own probe entirely when set; leave it unset
/// to keep the default.
/// </summary>
/// <remarks>
/// While a startup probe is running the liveness and readiness probes are held off, so this is the one that
/// governs how long a cold instance is given — a large store replaying on first boot is the case to size for.
/// </remarks>
[JsonPropertyName("startupProbe")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public V1Probe? StartupProbe { get; set; }

[JsonPropertyName("service")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public InstanceDeploymentServiceSpec? Service { get; set; }
Expand Down
15 changes: 12 additions & 3 deletions src/Alethic.Seq.Operator/Instance/V1alpha1InstanceController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
namespace Alethic.Seq.Operator.Instance
{

// Namespaces are read, never written: an Instance's permissions can admit entities from every namespace or from
// those matching a selector, and both are evaluated against the namespace object itself. Nothing infers this from
// the controller's entity types, so without it the generated role omits namespaces and has to be patched by hand
// wherever it is copied.
[EntityRbac(typeof(V1Namespace), Verbs = RbacVerb.Get | RbacVerb.List | RbacVerb.Watch)]
[EntityRbac(typeof(V1alpha1Instance), Verbs = RbacVerb.All)]
[EntityRbac(typeof(V1Secret), Verbs = RbacVerb.All)]
[EntityRbac(typeof(V1Service), Verbs = RbacVerb.All)]
Expand Down Expand Up @@ -593,23 +598,27 @@ V1StatefulSet ApplyDeploymentStatefulSet(V1alpha1Instance instance, InstanceDepl
container.VolumeMounts.Clear();
container.VolumeMounts.Add(new V1VolumeMount("/data", "seq-data"));

container.LivenessProbe = new V1Probe(
// A probe given on the deployment replaces ours outright rather than merging into it. Merging would let a
// caller set one field and silently inherit the rest of ours, so the probe they read back would be neither
// what they wrote nor what we chose; and it offers no way to clear a field we set. This follows the same
// shape as Resources below, which is a straight pass-through of what the caller supplied.
container.LivenessProbe = deployment.LivenessProbe ?? new V1Probe(
httpGet: new V1HTTPGetAction("ui", path: "/health"),
failureThreshold: 3,
initialDelaySeconds: 0,
periodSeconds: 10,
successThreshold: 1,
timeoutSeconds: 1);

container.ReadinessProbe = new V1Probe(
container.ReadinessProbe = deployment.ReadinessProbe ?? new V1Probe(
httpGet: new V1HTTPGetAction("ui", path: "/health"),
failureThreshold: 3,
initialDelaySeconds: 0,
periodSeconds: 10,
successThreshold: 1,
timeoutSeconds: 1);

container.StartupProbe = new V1Probe(
container.StartupProbe = deployment.StartupProbe ?? new V1Probe(
httpGet: new V1HTTPGetAction("ui", path: "/health"),
failureThreshold: 30,
periodSeconds: 10);
Expand Down
3 changes: 1 addition & 2 deletions src/Alethic.Seq.Operator/config/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ FROM mcr.microsoft.com/dotnet/runtime:latest as final
RUN addgroup k8s-operator && useradd -G k8s-operator operator-user

WORKDIR /operator
COPY --from=build /operator/out/ ./
RUN chown operator-user:k8s-operator -R .
COPY --chown=operator-user:k8s-operator --from=build /operator/out/ ./

USER operator-user

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ spec:
openAPIV3Schema:
properties:
status:
nullable: false
properties:
id:
nullable: true
Expand Down Expand Up @@ -89,7 +88,6 @@ spec:
type: string
notificationProperties:
additionalProperties:
nullable: false
type: string
nullable: true
type: object
Expand All @@ -113,11 +111,9 @@ spec:
nullable: true
type: string
type: object
nullable: false
type: array
type: object
spec:
nullable: false
properties:
instanceRef:
nullable: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ spec:
openAPIV3Schema:
properties:
status:
nullable: false
properties:
id:
nullable: true
Expand All @@ -27,10 +26,8 @@ spec:
nullable: true
properties:
name:
nullable: false
type: string
namespace:
nullable: false
type: string
type: object
info:
Expand Down Expand Up @@ -68,7 +65,6 @@ spec:
properties:
appliedProperties:
additionalProperties:
nullable: false
type: string
nullable: true
type: object
Expand Down Expand Up @@ -119,11 +115,9 @@ spec:
nullable: true
type: string
type: object
nullable: false
type: array
type: object
spec:
nullable: false
properties:
instanceRef:
nullable: true
Expand All @@ -141,10 +135,8 @@ spec:
nullable: true
properties:
name:
nullable: false
type: string
namespace:
nullable: false
type: string
type: object
conf:
Expand Down Expand Up @@ -173,7 +165,6 @@ spec:
properties:
appliedProperties:
additionalProperties:
nullable: false
type: string
nullable: true
type: object
Expand Down
Loading
Loading