1.3.6.3. アプリケーション Ansible フックのスタンドアロンモード
Ansible フックのスタンドアロンモードはサポートされていません。サブスクリプションを使用してハブクラスターに Ansible フックをデプロイするには、次のサブスクリプション YAML を使用できます。
apiVersion: apps.open-cluster-management.io/v1
kind: Subscription
metadata:
name: sub-rhacm-gitops-demo
namespace: hello-openshift
annotations:
apps.open-cluster-management.io/github-path: myapp
apps.open-cluster-management.io/github-branch: master
spec:
hooksecretref:
name: toweraccess
channel: rhacm-gitops-demo/ch-rhacm-gitops-demo
placement:
local: true
ただし、spec.placement.local:true ではサブスクリプションが standalone モードで実行されているため、この設定では Ansible インストールが作成されない可能性があります。ハブモードでサブスクリプションを作成する必要があります。
local-clusterにデプロイする配置ルールを作成します。以下のサンプルを参照してください。apiVersion: apps.open-cluster-management.io/v1 kind: PlacementRule metadata: name: <towhichcluster> namespace: hello-openshift spec: clusterSelector: matchLabels: local-cluster: "true" #this points to your hub cluster使用しているサブスクリプションで、作成した配置ルールを参照します。以下を参照してください。
apiVersion: apps.open-cluster-management.io/v1 kind: Subscription metadata: name: sub-rhacm-gitops-demo namespace: hello-openshift annotations: apps.open-cluster-management.io/github-path: myapp apps.open-cluster-management.io/github-branch: master spec: hooksecretref: name: toweraccess channel: rhacm-gitops-demo/ch-rhacm-gitops-demo placement: placementRef: name: <towhichcluster> kind: PlacementRule
両方を適用すると、ハブクラスターに作成された Ansible インスタンスが表示されます。