5.4.4. 安全でない CRD 変更の例
次の例は、CRD アップグレードの安全性事前チェックで検出される、サンプルカスタムリソース定義 (CRD) のセクションに対する特定の変更を示しています。
次の例では、いかが変更前の CRD オブジェクトの状態であると想定します。
例5.19 CRD オブジェクトの例
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
name: example.test.example.com
spec:
group: test.example.com
names:
kind: Sample
listKind: SampleList
plural: samples
singular: sample
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
type: object
status:
type: object
pollInterval:
type: string
type: object
served: true
storage: true
subresources:
status: {}
5.4.4.1. スコープの変更 リンクのコピーリンクがクリップボードにコピーされました!
リンクのコピーリンクがクリップボードにコピーされました!
次のカスタムリソース定義 (CRD) の例では、scope フィールドが Namespaced から Cluster に変更されています。
例5.20 CRD におけるスコープ変更の例
spec:
group: test.example.com
names:
kind: Sample
listKind: SampleList
plural: samples
singular: sample
scope: Cluster
versions:
- name: v1alpha1
例5.21 エラー出力の例
validating upgrade for CRD "test.example.com" failed: CustomResourceDefinition test.example.com failed upgrade safety validation. "NoScopeChange" validation failed: scope changed from "Namespaced" to "Cluster"