16.2.5. GitOps ZTP を使用した Lifecycle Agent によるイメージベースアップグレード用の ConfigMap オブジェクトの作成
イメージベースアップグレードに備えて、ConfigMap オブジェクトにラップされた OADP リソース、追加のマニフェスト、カスタムカタログソースを作成します。
16.2.5.1. GitOps ZTP を使用したイメージベースアップグレード用の OADP リソースの作成 リンクのコピーリンクがクリップボードにコピーされました!
アップグレード後にアプリケーションを復元できるように OADP リソースを準備します。
前提条件
- GitOps ZTP を使用して 1 つ以上のマネージドクラスターをプロビジョニングした。
-
cluster-admin権限を持つユーザーとしてログインしている。 - 互換性のあるシードクラスターからシードイメージを生成した。
- stateroot 間で共有されるコンテナーイメージ用に、ターゲットクラスターに個別のパーティションを作成した。詳細は、「GitOps ZTP を使用した場合の ostree stateroot 間の共有コンテナーパーティションの設定」を参照してください。
- シードイメージで使用されるバージョンと互換性のあるバージョンの Lifecycle Agent をデプロイした。
-
OADP Operator、
DataProtectionApplicationCR、およびそのシークレットをターゲットクラスターにインストールした。 - S3 互換のストレージソリューションとすぐに使用できるバケットを作成し、適切な認証情報を設定した。詳細は、「GitOps ZTP を使用した OADP Operator のインストールと設定」を参照してください。
-
OADP
ConfigMapを生成してクラスターにコピーできるように、OADPConfigMapオブジェクト用のopenshift-adpnamespace が、すべてのマネージドクラスターとハブに存在する。
手順
ArgoCD ポリシーアプリケーションで使用する Git リポジトリーに次のディレクトリー構造が含まれていることを確認します。
├── source-crs/ │ ├── ibu/ │ │ ├── ImageBasedUpgrade.yaml │ │ ├── PlatformBackupRestore.yaml │ │ ├── PlatformBackupRestoreLvms.yaml │ │ ├── PlatformBackupRestoreWithIBGU.yaml ├── ... ├── kustomization.yamlsource-crs/ibu/PlatformBackupRestoreWithIBGU.yamlファイルは、ZTP コンテナーイメージで提供されます。PlatformBackupRestoreWithIBGU.yaml
apiVersion: velero.io/v1 kind: Backup metadata: name: acm-klusterlet annotations: lca.openshift.io/apply-label: "apps/v1/deployments/open-cluster-management-agent/klusterlet,v1/secrets/open-cluster-management-agent/bootstrap-hub-kubeconfig,rbac.authorization.k8s.io/v1/clusterroles/klusterlet,v1/serviceaccounts/open-cluster-management-agent/klusterlet,scheduling.k8s.io/v1/priorityclasses/klusterlet-critical,rbac.authorization.k8s.io/v1/clusterroles/open-cluster-management:klusterlet-work:ibu-role,rbac.authorization.k8s.io/v1/clusterroles/open-cluster-management:klusterlet-admin-aggregate-clusterrole,rbac.authorization.k8s.io/v1/clusterrolebindings/klusterlet,operator.open-cluster-management.io/v1/klusterlets/klusterlet,apiextensions.k8s.io/v1/customresourcedefinitions/klusterlets.operator.open-cluster-management.io,v1/secrets/open-cluster-management-agent/open-cluster-management-image-pull-credentials"1 labels: velero.io/storage-location: default namespace: openshift-adp spec: includedNamespaces: - open-cluster-management-agent includedClusterScopedResources: - klusterlets.operator.open-cluster-management.io - clusterroles.rbac.authorization.k8s.io - clusterrolebindings.rbac.authorization.k8s.io - priorityclasses.scheduling.k8s.io includedNamespaceScopedResources: - deployments - serviceaccounts - secrets excludedNamespaceScopedResources: [] --- apiVersion: velero.io/v1 kind: Restore metadata: name: acm-klusterlet namespace: openshift-adp labels: velero.io/storage-location: default annotations: lca.openshift.io/apply-wave: "1" spec: backupName: acm-klusterlet- 1
multiclusterHubCR に.spec.imagePullSecretが定義されておらず、ハブクラスターのopen-cluster-management-agentnamespace にシークレットが存在しない場合は、v1/secrets/open-cluster-management-agent/open-cluster-management-image-pull-credentialsを削除します。
注記マネージドクラスターでイメージベースのアップグレードを直接実行する場合は、
PlatformBackupRestore.yamlファイルを使用します。LVM Storage を使用して永続ボリュームを作成する場合は、ZTP コンテナーイメージで提供される
source-crs/ibu/PlatformBackupRestoreLvms.yamlを使用して、LVM Storage リソースをバックアップできます。PlatformBackupRestoreLvms.yaml
apiVersion: velero.io/v1 kind: Backup metadata: labels: velero.io/storage-location: default name: lvmcluster namespace: openshift-adp spec: includedNamespaces: - openshift-storage includedNamespaceScopedResources: - lvmclusters - lvmvolumegroups - lvmvolumegroupnodestatuses --- apiVersion: velero.io/v1 kind: Restore metadata: name: lvmcluster namespace: openshift-adp labels: velero.io/storage-location: default annotations: lca.openshift.io/apply-wave: "2" spec: backupName: lvmcluster-
lca.openshift.io/apply-waveの値は、アプリケーションのRestoreCR で指定された値よりも低くする必要があります。
アップグレード後にアプリケーションを復元する必要がある場合は、
openshift-adpnamespace にアプリケーションの OADPBackupCR およびRestoreCR を作成します。openshift-adpnamespace にクラスタースコープのアプリケーションアーティファクト用の OADP CR を作成します。LSO および LVM Storage のクラスタースコープアプリケーションアーティファクトの OADP CR の例
apiVersion: velero.io/v1 kind: Backup metadata: annotations: lca.openshift.io/apply-label: "apiextensions.k8s.io/v1/customresourcedefinitions/test.example.com,security.openshift.io/v1/securitycontextconstraints/test,rbac.authorization.k8s.io/v1/clusterroles/test-role,rbac.authorization.k8s.io/v1/clusterrolebindings/system:openshift:scc:test" name: backup-app-cluster-resources labels: velero.io/storage-location: default namespace: openshift-adp spec: includedClusterScopedResources: - customresourcedefinitions - securitycontextconstraints - clusterrolebindings - clusterroles excludedClusterScopedResources: - Namespace --- apiVersion: velero.io/v1 kind: Restore metadata: name: test-app-cluster-resources namespace: openshift-adp labels: velero.io/storage-location: default annotations: lca.openshift.io/apply-wave: "3" spec: backupName: backup-app-cluster-resources-
lca.openshift.io/apply-labelフィールドの例のリソース名を、実際のリソース名に置き換えてください。 -
lca.openshift.io/apply-waveフィールドの値は、プラットフォームの復元CR の値よりも大きく、アプリケーション名前空間スコープの復元CR の値よりも小さくなければなりません。
-
namespace スコープのアプリケーションアーティファクト用の OADP CR を
source-crs/custom-crsディレクトリーに作成します。LSO が使用される場合の OADP CR の namespace スコープのアプリケーションアーティファクトの例
apiVersion: velero.io/v1 kind: Backup metadata: labels: velero.io/storage-location: default name: backup-app namespace: openshift-adp spec: includedNamespaces: - test includedNamespaceScopedResources: - secrets - persistentvolumeclaims - deployments - statefulsets - configmaps - cronjobs - services - job - poddisruptionbudgets - <application_custom_resources> excludedClusterScopedResources: - persistentVolumes --- apiVersion: velero.io/v1 kind: Restore metadata: name: test-app namespace: openshift-adp labels: velero.io/storage-location: default annotations: lca.openshift.io/apply-wave: "4" spec: backupName: backup-app-
includedNamespaceScopedResourcesフィールドに、アプリケーション用のカスタムリソースを定義します。
LVM Storage が使用されている場合の OADP CR namespace スコープのアプリケーションアーティファクトの例
apiVersion: velero.io/v1 kind: Backup metadata: labels: velero.io/storage-location: default name: backup-app namespace: openshift-adp spec: includedNamespaces: - test includedNamespaceScopedResources: - secrets - persistentvolumeclaims - deployments - statefulsets - configmaps - cronjobs - services - job - poddisruptionbudgets - <application_custom_resources> includedClusterScopedResources: - persistentVolumes - logicalvolumes.topolvm.io - volumesnapshotcontents --- apiVersion: velero.io/v1 kind: Restore metadata: name: test-app namespace: openshift-adp labels: velero.io/storage-location: default annotations: lca.openshift.io/apply-wave: "4" spec: backupName: backup-app restorePVs: true restoreStatus: includedResources: - logicalvolumesここでは、以下のようになります。
-
<application_custom_resources>: アプリケーションのカスタムリソースを定義します。 -
persistentVolumes: 必須項目。 -
logicalvolumes.topolvm.io: 必須項目です。 -
volumesnapshotcontents: LVM ストレージのボリュームスナップショットを使用する場合は、この項目は省略可能です。 -
restoreStatus.includedResources: 論理ボリュームを復元するために必要なフィールドです。
重要アプリケーションの同じバージョンが、OpenShift Container Platform の現在のリリースとターゲットリリースの両方で機能する必要があります。
-
次の内容を含む
kustomization.yamlを作成します。apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization configMapGenerator:1 - files: - source-crs/ibu/PlatformBackupRestoreWithIBGU.yaml #- source-crs/custom-crs/ApplicationClusterScopedBackupRestore.yaml #- source-crs/custom-crs/ApplicationApplicationBackupRestoreLso.yaml name: oadp-cm namespace: openshift-adp2 generatorOptions: disableNameSuffixHash: true- 変更を Git リポジトリーにプッシュします。