Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update guestbook example for 2.0 #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions demo/app/guestbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
8 changes: 4 additions & 4 deletions demo/app/guestbook/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions demo/app/guestbook/dev-placement-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion demo/app/guestbook/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions demo/app/guestbook/scc-policy.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -47,7 +50,7 @@ spec:
supplementalGroups:
type: RunAsAny
users:
- 'system:serviceaccount:open-cluster-management:runasanyuid'
- 'system:serviceaccount:demo-guestbook:runasanyuid'
volumes:
- configMap
- downwardAPI
Expand All @@ -56,16 +59,16 @@ 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
apiGroup: apps.open-cluster-management.io
subjects:
- name: guestbook-policy-scc
kind: Policy
apiGroup: policy.mcm.ibm.com
apiGroup: policy.open-cluster-management.io