0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Open Cluster Management (OCM) のClusterProfile API対応を試してみた

Posted at

はじめに

Open Cluster Management (OCM) がClusterProfile APIに対応しているという情報を見かけたので、実際に動作を確認してみました。

環境セットアップ

OCMの開発環境セットアップガイドに従って環境を構築しました。

このガイドに従うことで、ローカルにOCMのハブクラスタと複数のマネージドクラスタを簡単に立ち上げることができます。

ClusterProfile機能の有効化

ClusterProfile機能はfeature gateで制御されているため、ClusterManagerリソースで明示的に有効化する必要があります。

apiVersion: operator.open-cluster-management.io/v1
kind: ClusterManager
metadata:
  name: cluster-manager
spec:
  registrationConfiguration:
    featureGates:
      - feature: ClusterProfile
        mode: Enable

この設定を適用すると、既存のManagedClusterが自動的にClusterProfileリソースとして同期されます。

確認結果

feature gateを有効化した後、ClusterProfileリソースを確認すると以下のような結果が得られました。

kubectl get clusterprofile -n open-cluster-management
apiVersion: multicluster.x-k8s.io/v1alpha1
kind: ClusterProfile
metadata:
  name: cluster1
  namespace: open-cluster-management
  labels:
    multicluster.x-k8s.io/clusterset: ""
    x-k8s.io/cluster-manager: open-cluster-management
spec:
  clusterManager:
    name: open-cluster-management
  displayName: cluster1
status:
  conditions:
    - type: ControlPlaneHealthy
      status: "True"
      reason: ManagedClusterAvailable
      message: Managed cluster is available
    - type: Joined
      status: "True"
      reason: ManagedClusterJoined
      message: Managed cluster joined
  version:
    kubernetes: v1.34.0

ポイント

  • ManagedClusterの状態がClusterProfileのstatus.conditionsに適切にマッピングされている
  • ControlPlaneHealthyJoinedという2つのconditionでクラスタの状態を表現
  • Kubernetesバージョン情報も同期されている
  • multicluster.x-k8s.io/clustersetラベルが付与されている(ClusterSet識別用)

元のManagedCluster

参考までに、元のManagedClusterリソースには以下の情報が含まれています。

  • クラスタのcapacity/allocatable情報
  • 詳細なconditions (HubAcceptedManagedCluster, ManagedClusterJoined, ManagedClusterConditionAvailable, ManagedClusterConditionClockSynced)
  • API Serverへの接続情報 (caBundle, url)

ClusterProfileはこれらの情報から必要な部分を抽出し、よりシンプルなインターフェースでクラスタの状態を提供しています。

まとめ

OCMはClusterProfile APIをサポートしており、既存のManagedClusterをClusterProfileとして公開できることが確認できました。

参考リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?