You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e694b05
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(api): keep application image policy in charts
The charts enforce image selection without extending the API server's
write path. Keep the existing admission behavior while the application
schemas expose the supported fields.
Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <[email protected]>
// kubernetesKind is the Application.Kind of the Kubernetes cluster CR.
2158
+
// kubernetesKind is the Application.Kind of the Kubernetes cluster CR whose
2159
+
// Phase 2-removed value keys the warning below reports on.
2159
2160
constkubernetesKind="Kubernetes"
2160
2161
2161
-
// removedField is a values key whose chart has stopped reading it. Such a key
2162
-
// is still accepted and stored -- an upgraded release keeps it until re-edited,
2163
-
// and the migrations deliberately leave it in place rather than rewriting
2164
-
// values mid-upgrade -- so the write path says so rather than letting the field
2165
-
// look effective.
2166
-
typeremovedFieldstruct {
2167
-
keystring
2168
-
// replacement says what happens instead, in the second half of the warning.
2169
-
replacementstring
2170
-
// emptyDefault marks a key that is set only when it carries a value. The
2171
-
// image overrides defaulted to empty strings, the read path fills defaults
2172
-
// in, and a client that writes back what it read stores them, so their
2173
-
// presence says nothing.
2174
-
emptyDefaultbool
2175
-
}
2176
-
2177
-
varremovedFieldsByKind=map[string][]removedField{
2178
-
kubernetesKind: {
2179
-
{key: "nodeGroups", replacement: "worker pools are managed as separate KubernetesNodes resources (see the kubernetes-nodes chart)"},
2180
-
{key: "nodeHealthCheck", replacement: "worker pools are managed as separate KubernetesNodes resources (see the kubernetes-nodes chart)"},
2181
-
{key: "maxNodeProvisionTime", replacement: "worker pools are managed as separate KubernetesNodes resources (see the kubernetes-nodes chart)"},
2182
-
{key: "images", replacement: "the images come from the chart, and an air-gapped install serves them through the registry mirrors configured on its nodes", emptyDefault: true},
2183
-
},
2184
-
"KubernetesNodes": {
2185
-
{key: "images", replacement: "the images come from the chart, and an air-gapped install serves them through the registry mirrors configured on its nodes", emptyDefault: true},
2186
-
},
2187
-
"OpenSearch": {
2188
-
{key: "images", replacement: "the image follows spec.version", emptyDefault: true},
2189
-
},
2190
-
}
2191
-
2192
-
// warnRemovedFields emits a client-facing admission warning for each removed
2193
-
// field still present in the values, so an operator editing one (e.g. bumping
2194
-
// spec.nodeGroups.<x>.minReplicas) is told it has no effect instead of silently
2195
-
// getting nothing. Non-blocking: the field is preserved as-is.
"spec.%s is ignored on the %s resource: %s. The field is stored but has no effect.",
2212
-
f.key, r.kindName, f.replacement))
2213
-
}
2214
-
}
2215
-
2216
-
// carriesValue reports whether a value is more than an empty default: not null,
2217
-
// not an empty string, and for a map, at least one entry that carries a value.
2218
-
funccarriesValue(valueany) bool {
2219
-
switchv:=value.(type) {
2220
-
casenil:
2221
-
returnfalse
2222
-
casestring:
2223
-
returnv!=""
2224
-
casemap[string]any:
2225
-
for_, nested:=rangev {
2226
-
ifcarriesValue(nested) {
2227
-
returntrue
2228
-
}
2182
+
for_, key:=rangeremovedKubernetesFields {
2183
+
if_, present:=values[key]; present {
2184
+
warning.AddWarning(ctx, "", fmt.Sprintf(
2185
+
"spec.%s is ignored on the Kubernetes resource since Phase 2: worker pools are managed as separate KubernetesNodes resources (see the kubernetes-nodes chart). The field is stored but has no effect.", key))
0 commit comments