Skip to content

Commit

Permalink
Add e2e/integration test case for manifestworkreplicaset (open-cluste…
Browse files Browse the repository at this point in the history
…r-management-io#191)

* Add e2e/integration test case for manifestworkreplicaset

Signed-off-by: Jian Qiu <jqiu@redhat.com>

* Fix rbac in e2e test

Signed-off-by: Jian Qiu <jqiu@redhat.com>

---------

Signed-off-by: Jian Qiu <jqiu@redhat.com>
  • Loading branch information
qiujian16 authored Mar 15, 2023
1 parent ee923cd commit 0d3dff3
Show file tree
Hide file tree
Showing 17 changed files with 746 additions and 71 deletions.
13 changes: 8 additions & 5 deletions deploy/hub/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@ kind: ClusterRole
metadata:
name: open-cluster-management:work-hub-controller
rules:
# Allow get/list/watch configmaps
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "watch"]
- apiGroups: [ "" ]
resources: [ "configmaps" ]
verbs: [ "get", "list", "watch" ]
# Allow create subjectaccessreviews
- apiGroups: ["authorization.k8s.io"]
resources: ["subjectaccessreviews"]
verbs: ["create"]
- apiGroups: ["work.open-cluster-management.io"]
resources: ["manifestworks"]
verbs: ["get", "list", "watch","create", "update", "delete", "deletecollection", "patch"]
verbs: ["get", "list", "watch","create", "update", "delete", "deletecollection", "patch", "execute-as"]
- apiGroups: ["work.open-cluster-management.io"]
resources: ["manifestworkreplicasets"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["work.open-cluster-management.io"]
resources: ["manifestworkreplicasets/status"]
verbs: ["patch", "update"]
- apiGroups: [ "cluster.open-cluster-management.io" ]
resources: [ "placements", "placementdecisions" ]
verbs: [ "get", "list", "watch"]

4 changes: 4 additions & 0 deletions deploy/hub/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ namespace: open-cluster-management-hub
resources:
- ./manifestworkreplicasets.crd.yaml
- ./manifestworks.crd.yaml
- ./placements.crd.yaml
- ./placementdecisions.crd.yaml
- ./component_namespace.yaml
- ./clusterrole_binding.yaml
- ./clusterrole.yaml
- ./role.yaml
- ./role_binding.yaml
- ./manager_deployment.yaml
- ./webhook_deployment.yaml
- ./service_account.yaml
Expand Down
60 changes: 60 additions & 0 deletions deploy/hub/placementdecisions.crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: placementdecisions.cluster.open-cluster-management.io
spec:
group: cluster.open-cluster-management.io
names:
kind: PlacementDecision
listKind: PlacementDecisionList
plural: placementdecisions
singular: placementdecision
scope: Namespaced
preserveUnknownFields: false
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: "PlacementDecision indicates a decision from a placement PlacementDecision should has a label cluster.open-cluster-management.io/placement={placement name} to reference a certain placement. \n If a placement has spec.numberOfClusters specified, the total number of decisions contained in status.decisions of PlacementDecisions should always be NumberOfClusters; otherwise, the total number of decisions should be the number of ManagedClusters which match the placement requirements. \n Some of the decisions might be empty when there are no enough ManagedClusters meet the placement requirements."
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
status:
description: Status represents the current status of the PlacementDecision
type: object
required:
- decisions
properties:
decisions:
description: Decisions is a slice of decisions according to a placement The number of decisions should not be larger than 100
type: array
items:
description: ClusterDecision represents a decision from a placement An empty ClusterDecision indicates it is not scheduled yet.
type: object
required:
- clusterName
- reason
properties:
clusterName:
description: ClusterName is the name of the ManagedCluster. If it is not empty, its value should be unique cross all placement decisions for the Placement.
type: string
reason:
description: Reason represents the reason why the ManagedCluster is selected.
type: string
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading

0 comments on commit 0d3dff3

Please sign in to comment.