diff --git a/assets/scss/_documentation.scss b/assets/scss/_documentation.scss index f2f070b1d870d..e1307de38f5fa 100644 --- a/assets/scss/_documentation.scss +++ b/assets/scss/_documentation.scss @@ -11,11 +11,6 @@ } div.feature-state-notice { - background-color: $feature; - border-radius: 0.75rem; - padding: 1rem; - margin-bottom: 1em; - font-size: 1.2em; > .feature-state-name::before { @@ -36,9 +31,15 @@ div.feature-state-notice { font-family: inherit; // don't treat as actual code background-color: $feature; } +} + +div.feature-state-notice, div.feature-state-notice + div.feature-stable.stable-in-latest-release { + background-color: $feature; + border-radius: 0.75rem; + padding: 1rem; + margin-bottom: 1em; - margin-right: 2em; - max-width: 80%; + margin-right: 2.5rem; } .includecode .highlight { diff --git a/i18n/en/en.toml b/i18n/en/en.toml index 74bc2c25700f9..973242e3c0fb0 100644 --- a/i18n/en/en.toml +++ b/i18n/en/en.toml @@ -176,6 +176,12 @@ other = "Examples" [feature_gate_enabled] other = "(enabled by default: {{ .enabled }})" +[feature_gate_stable_graduated] +other = "This is a stable feature in Kubernetes, and has been since version {{ .stableVersion }}. It was first available in the v{{ .firstReleaseWithThisFeature }} release." + +[feature_gate_stable_locked] +other = "This is a stable feature in Kubernetes, and has been since version {{ .stableVersion }}. It was first available in the v{{ .firstReleaseWithThisFeature }} release. You can no longer disable or opt of of this behavior." + [feature_gate_stage_alpha] other = "Alpha" diff --git a/layouts/shortcodes/feature-state.html b/layouts/shortcodes/feature-state.html index 30c39cd334214..d7aef1b1337d9 100644 --- a/layouts/shortcodes/feature-state.html +++ b/layouts/shortcodes/feature-state.html @@ -1,8 +1,13 @@ +{{/* for features that haven't been removed, show an info box */}} +{{/* for features that have been removed, show a simple paragraph explaining that the feature is stable */}} {{ $valid_states := "alpha, beta, deprecated, stable" }} {{ $state := .Get "state" }} {{ $for_k8s_version := .Get "for_k8s_version" | default (.Page.Param "version") }} {{ $is_valid := strings.Contains $valid_states $state }} +{{ $latestVersion := site.Params.latest }} {{ $feature_gate_name := .Get "feature_gate_name" }} +{{ $firstReleaseWithThisFeature := false }} +{{ $stableInLatestRelease := false }} {{ if not $feature_gate_name }} {{ if not $is_valid }} @@ -29,14 +34,31 @@ {{- $featureGateNameFromFile := $featureGateFile.Params.Title -}} {{- if eq $featureGateNameFromFile $feature_gate_name -}} + {{- $featureGateWasRemoved := $featureGateFile.Params.removed -}} + {{- $earliestStage := (index $featureGateFile.Params.stages 0) -}} + {{- with $earliestStage -}} + {{ $firstReleaseWithThisFeature = .fromVersion -}} + {{- end -}} {{- $currentStage := index $featureGateFile.Params.stages (sub (len $featureGateFile.Params.stages) 1) -}} {{- with $currentStage -}} - + {{- if and (eq .stage "stable") (eq (printf "v%s" .fromVersion) $latestVersion) -}} + {{ $stableInLatestRelease = true }} + {{- end -}} + {{- if and (eq .stage "stable") ($featureGateWasRemoved) -}} +
+

{{ T "feature_gate_stable_locked" (dict "firstReleaseWithThisFeature" $firstReleaseWithThisFeature "stableVersion" .fromVersion ) | safeHTML }}

+
+ {{- else -}}
{{ T "feature_state" }} {{ T "feature_state_kubernetes_label" }} v{{ .fromVersion }} [{{ .stage }}] {{ T "feature_gate_enabled" (dict "enabled" .defaultValue) }}
- + {{- if and (eq .stage "stable") -}} +
+

{{ T "feature_gate_stable_graduated" (dict "firstReleaseWithThisFeature" $firstReleaseWithThisFeature "stableVersion" .fromVersion ) | safeHTML }}

+
+ {{- end -}} + {{- end -}} {{- $featureGateFound = true -}} {{- end -}} {{- end -}}