Skip to content

feat: Declare the probe and security context defaults in the CRD schema - #72

Merged
as51340 merged 1 commit into
mainfrom
feat/explicit-api-defaults
Oct 13, 2026
Merged

as51340 merged 1 commit into
mainfrom
feat/explicit-api-defaults

Conversation

@as51340

@as51340 as51340 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Why

Following the Kubernetes API convention that defaults should be visible in the object rather than implied ("unspecified fields get the default behavior"), two defaults existed only in the builders. A stored MemgraphCluster never showed the readiness probe timings or the uid/gid its pods ran with.

What

  • readinessProbe: default={} on the block, and 20/10/5 on failureThreshold/timeoutSeconds/periodSeconds. A timing left out beside a written one is now filled in too.
  • securityContext: when absent, it defaults to {runAsUser: 101, runAsGroup: 103, fsGroup: 103}, the values normalizeSecurityContext already wrote. No field inside the block has a default, so securityContext: {} still leaves all three to the platform (OpenShift restricted-v2). The constants move to the API package as DefaultRunAsUser/DefaultRunAsGroup/DefaultFSGroup. The builder fallback stays, like every other default, for specs that never passed admission.
  • coreDumps.uploader.image gets an explicit +required. It was already required, because its json tag has no omitempty. The CRD is otherwise unchanged by this line, and every field in the API now carries an explicit marker.
  • Chart version 1.0.1-rc.1 → 1.0.1-rc.2 (the chart's CRD changed). appVersion is unchanged.

Pod templates don't change, so nothing restarts. Existing objects pick up the defaults when the API server reads them.

Testing

  • make test (the envtest defaults test now expects both blocks to be filled in, and an empty securityContext still round-trips empty), make lint, make chart-verify, make helm-lint, make chart-version-check.

The readiness probe timings and the pod identity were defaulted only by the
builders, so a stored MemgraphCluster never showed the values its pods ran
with. Both are now CRD schema defaults, mirrored by Go constants for specs
that never passed admission, like every other default:

- readinessProbe defaults to {} and each timing to 20/10/5, so a timing left
  out beside a written one is filled in too.
- securityContext, when absent, defaults to runAsUser 101, runAsGroup 103,
  fsGroup 103, the values the builder already wrote. No field inside the
  block has a default, so an empty block still leaves all three to the
  platform, as OpenShift's restricted-v2 needs.

Pods are unchanged. The uploader's image, already required by the schema,
now says so with +required like every other field.
@as51340 as51340 self-assigned this Oct 13, 2026
@as51340
as51340 merged commit 7fa8acc into main Oct 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant