From c08b0ed92c83ee665f8944c795732214fe1df3cf Mon Sep 17 00:00:00 2001 From: Chris Doan Date: Mon, 13 Jul 2020 22:01:38 -0500 Subject: [PATCH] update guestbook example for 2.0 --- demo/app/guestbook/README.md | 2 ++ demo/app/guestbook/application.yaml | 8 ++++---- demo/app/guestbook/dev-placement-rule.yaml | 5 +++-- demo/app/guestbook/kustomization.yaml | 2 +- demo/app/guestbook/scc-policy.yaml | 19 +++++++++++-------- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/demo/app/guestbook/README.md b/demo/app/guestbook/README.md index e1d63d7ff..7c0a42a20 100644 --- a/demo/app/guestbook/README.md +++ b/demo/app/guestbook/README.md @@ -2,10 +2,12 @@ - Create from within this directory, in a terminal window run: ```bash + kubectl create namespace demo-guestbook kubectl apply -k . ``` - Remove ```bash kubectl delete -k . + kubectl delete namespace demo-guestbook ``` \ No newline at end of file diff --git a/demo/app/guestbook/application.yaml b/demo/app/guestbook/application.yaml index 96c372b5a..9f164792b 100644 --- a/demo/app/guestbook/application.yaml +++ b/demo/app/guestbook/application.yaml @@ -3,7 +3,7 @@ apiVersion: apps.open-cluster-management.io/v1 kind: Channel metadata: name: guestbook-app-latest - namespace: open-cluster-management + namespace: demo-guestbook spec: type: GitHub pathname: https://github.com/open-cluster-management/deploy.git @@ -12,7 +12,7 @@ apiVersion: app.k8s.io/v1beta1 kind: Application metadata: name: guestbook-app - namespace: open-cluster-management + namespace: demo-guestbook spec: componentKinds: - group: apps.open-cluster-management.io @@ -29,13 +29,13 @@ apiVersion: apps.open-cluster-management.io/v1 kind: Subscription metadata: name: guestbook-app - namespace: open-cluster-management + namespace: demo-guestbook labels: app: guestbook-app annotations: apps.open-cluster-management.io/github-path: resources/guestbook spec: - channel: open-cluster-management/guestbook-app-latest + channel: demo-guestbook/guestbook-app-latest placement: placementRef: kind: PlacementRule diff --git a/demo/app/guestbook/dev-placement-rule.yaml b/demo/app/guestbook/dev-placement-rule.yaml index a71e5447e..dbceb0826 100644 --- a/demo/app/guestbook/dev-placement-rule.yaml +++ b/demo/app/guestbook/dev-placement-rule.yaml @@ -2,10 +2,11 @@ apiVersion: apps.open-cluster-management.io/v1 kind: PlacementRule metadata: name: dev-clusters - namespace: open-cluster-management + namespace: demo-guestbook spec: clusterConditions: - - type: OK + - status: "True" + type: ManagedClusterConditionAvailable clusterSelector: matchExpressions: [] matchLabels: diff --git a/demo/app/guestbook/kustomization.yaml b/demo/app/guestbook/kustomization.yaml index 523740aa9..7e9b4996e 100644 --- a/demo/app/guestbook/kustomization.yaml +++ b/demo/app/guestbook/kustomization.yaml @@ -3,7 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization # namespace to deploy all Resources to -namespace: open-cluster-management +namespace: demo-guestbook generatorOptions: disableNameSuffixHash: true diff --git a/demo/app/guestbook/scc-policy.yaml b/demo/app/guestbook/scc-policy.yaml index 949540cd8..5f34c29f8 100644 --- a/demo/app/guestbook/scc-policy.yaml +++ b/demo/app/guestbook/scc-policy.yaml @@ -1,16 +1,19 @@ --- -apiVersion: policy.mcm.ibm.com/v1alpha1 +apiVersion: policy.open-cluster-management.io/v1 kind: Policy metadata: name: guestbook-policy-scc - namespace: open-cluster-management + namespace: demo-guestbook + annotations: + policy.open-cluster-management.io/categories: PR.PT Protective Technology + policy.open-cluster-management.io/controls: PR.PT-3 Least Functionality + policy.open-cluster-management.io/standards: NIST-CSF spec: - complianceType: musthave remediationAction: enforce disabled: false namespaces: exclude: ["kube-*"] - include: ["open-cluster-management"] + include: ["demo-guestbook"] object-templates: - complianceType: musthave objectDefinition: @@ -47,7 +50,7 @@ spec: supplementalGroups: type: RunAsAny users: - - 'system:serviceaccount:open-cluster-management:runasanyuid' + - 'system:serviceaccount:demo-guestbook:runasanyuid' volumes: - configMap - downwardAPI @@ -56,11 +59,11 @@ spec: - projected - secret --- -apiVersion: mcm.ibm.com/v1alpha1 +apiVersion: policy.open-cluster-management.io/v1 kind: PlacementBinding metadata: name: binding-guestbook-policy-scc - namespace: open-cluster-management + namespace: demo-guestbook placementRef: name: dev-clusters kind: PlacementRule @@ -68,4 +71,4 @@ placementRef: subjects: - name: guestbook-policy-scc kind: Policy - apiGroup: policy.mcm.ibm.com \ No newline at end of file + apiGroup: policy.open-cluster-management.io \ No newline at end of file