dapr / dapr/kubernetes-operator

[Feature request] Strongly-typed fields for CRD

Open
#45 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
18
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Currently, the CRD used by this operator has a single property "value" which accepts anything (any JSON-serializable option).

We would like to propose a new version of the CRD (possibly v1alpha2 or v2alpha1?) which lists the allowed fields explicitly, including most (though not _all_) options that are allowed by the Dapr Helm chart today.

The proposed schema (which is based on Dapr 1.11 and is missing a few fields for 1.12):

```yaml
spec:
# Dapr version
version: 'string; required'

images:
registry: 'string; defaults to "ghcr.io/dapr"'
tag: 'string; defaults to the .version property'
# For control-plane services and sidecars
imagePullPolicy: 'string (ImagePullPolicy); defaults to "IfNotPresent"'
imagePullSecrets: 'string'

# Options for injected Dapr sidecars
sidecars:
# Full name of the Docker image for the Dapr sidecar.
# This is used to override the default image when deploying sidecars, and it's useful for debugging.
# Specifying a value here changes the ImagePullPolicy for sidecars to "Always". Otherwise, the sidecars' ImagePullPolicy is set to the same as `global.imagePullPolicy` (`IfNotPresent` by default).
sidecarImage: 'string'
runAsNonRoot: 'boolean; defaults to "true"'
readOnlyRootFilesystem: 'boolean; defaults to "true"'
# When enabled, the sidecar container has `securityContext.capabilities.drop: ["ALL"]`.
dropAllCapabilities: 'boolean; defaults to "false"'

# Options for the Dapr control plane
controlPlane:
logLevel: 'string; defaults to "info"'
logAsJSON: 'boolean; defaults to "false"'
os: 'string; defaults to "linux"'
arch: 'string; defaults to "amd64"'
enableMetrics: 'boolean; defaults to "true"'
metricsPort: 'boolean; defaults to "9090"'
tolerations: 'array of corev1.Toleration'
seccompProfile: 'string'
runAsNonRoot: 'boolean; defaults to "true"'
operator:
replicaCount: 'int; defaults to "1"'
resources: 'kuberentes resources object'
enableServiceReconciler: 'boolean; defaults to "false"'
sentry:
replicaCount: 'int; defaults to "1"'
resources: 'kuberentes resources object'
tokenAudience: 'string'
trustDomain: 'string'
placement:
# If true, enables high-availability mode with 3 replicas.
# Otherwise, a single replica is used.
ha: 'boolean; defaults to "false"'
resources: 'kuberentes resources object'
# Only for HA mode
cluster:
inMemoryLog: 'boolean; defaults to "true"'
logStorePath: 'string'
logStorePathWindows: 'string'
# Unused when HA mode is used and cluster.inMemoryLog is true
volumeClaims:
storageSize: 'string'
storageClassName: 'string'

# Needs to be updated for Dapr 1.12
mTLS:
enabled: 'boolean; defaults to "true"'
workloadCertTTL: 'string'
allowedClockSkew: 'string'

dnsSuffix: 'string; defaults to ".cluster.local"'

# Additional options passed to Helm as-is.
# Each option is passed as "--set" to Helm.
# These are passed after any option built from the spec.
additionalHelmOptions: 'array of strings'
```

The reconciler would then generate the Helm `--set` flags based on the values defined above in the CRD.

A benefit of using a CRD with strictly-defined fields is that it allows catching errors when the resource is deployed on K8s, before the reconciler is invoked. It also allows auto-completion in code editors, among other things.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.