resource

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrUpdateForObject

func CreateOrUpdateForObject(
	ctx context.Context,
	c client.Client,
	obj client.Object,
) error

CreateOrUpdateForObject はリソースを Server-Side Apply (SSA) で適用する。

以前は Get してから ResourceVersion を引き継いだ full overwrite Update を行っていたが、 それではコントローラやデフォルティングが設定したフィールドまで踏み潰してしまう。 SSA + FieldOwner("tazuna") に切り替えることで、tazuna が宣言したフィールドのみを所有し、 他者が管理するフィールドを保持できる。ForceOwnership により、過去に別マネージャ (kubectl など) が所有していたフィールドも tazuna が引き取る (bootstrap 用途として妥当)。

JobやPodなどspecの大半がimmutableなリソースはSSAでも衝突するため、従来どおり Delete→Createで対応する。

func DeleteObject

func DeleteObject(ctx context.Context, c client.Client, obj client.Object) error

DeleteObject はリソースを削除する。NotFoundの場合は無視する。

func IsDaemonSetReady added in v0.2.0

func IsDaemonSetReady(u *unstructured.Unstructured) (bool, error)

IsDaemonSetReady は DaemonSet が Ready かどうかを確認します。

func IsDeploymentReady added in v0.2.0

func IsDeploymentReady(u *unstructured.Unstructured) (bool, error)

IsDeploymentReady は Deployment が Ready かどうかを確認します。

func IsPodReady added in v0.2.0

func IsPodReady(u *unstructured.Unstructured) (bool, error)

IsPodReady は Pod が Ready かどうかを確認します。

func IsReady added in v0.2.0

func IsReady(obj *unstructured.Unstructured) (bool, error)

IsReady は unstructured 化されたオブジェクトの Ready 状態を判定する。 対応 Kind: Deployment, StatefulSet, DaemonSet, Pod。 上記以外は常に true を返す (ConfigMap, Secret, Service 等は即 Ready 扱い)。

func IsStatefulSetReady added in v0.2.0

func IsStatefulSetReady(u *unstructured.Unstructured) (bool, error)

IsStatefulSetReady は StatefulSet が Ready かどうかを確認します。

func WaitForDeletion

func WaitForDeletion(ctx context.Context, c client.Client, obj client.Object) error

WaitForDeletion はリソースが削除されるまでポーリングして待機する。 上限タイムアウト (5 分) を超えるとエラーを返す。

func WaitForReady added in v0.4.1

func WaitForReady(ctx context.Context, c client.Client, logger *slog.Logger, objects []client.Object, timeoutSeconds int) error

WaitForReady は objects がすべて Ready になるまでポーリングして待機します。 timeoutSeconds が 0 以下の場合はデフォルト (300 秒) を使います。 helmfile の wait: true など、apply / sync の双方から利用されます。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL