Skip to content

Commit

Permalink
Add cells field
Browse files Browse the repository at this point in the history
Signed-off-by: Jian Qiu <jqiu@redhat.com>
  • Loading branch information
qiujian16 committed Jul 26, 2022
1 parent bb52ba0 commit fde588e
Show file tree
Hide file tree
Showing 11 changed files with 200 additions and 59 deletions.
4 changes: 2 additions & 2 deletions config/crds/scheduling.kcp.dev_placements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ spec:
description: selectedLocation is the location that a picked by this
placement.
properties:
exportName:
locationName:
description: Name of the Location.
type: string
path:
Expand All @@ -247,7 +247,7 @@ spec:
pattern: ^root(:[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
required:
- exportName
- locationName
- path
type: object
type: object
Expand Down
43 changes: 30 additions & 13 deletions config/crds/workload.kcp.dev_synctargets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,29 @@ spec:
spec:
description: Spec holds the desired state.
properties:
cells:
additionalProperties:
type: string
description: Cells is a set of labels to identify the cells the SyncTarget
belongs to. SyncTargets with the same cells run as they are in the
same physical cluster. Each key/value pair in the cells should be
added and updated by service providers (i.e. a network provider
updates one key/value, while the storage provider updates another.)
type: object
evictAfter:
description: EvictAfter controls cluster schedulability of new and
existing workloads. After the EvictAfter time, any workload scheduled
to the cluster will be unassigned from the cluster. By default,
workloads scheduled to the cluster are not evicted.
format: date-time
type: string
exports:
description: Exports defines a set of APIExports supposed to be supported
by this SyncTarget. The SyncTarget will be selected to deploy the
workload only when the resource schema on the SyncTarget is compatible
with the resource schema included in the exports. If it is not set,
the kubernetes export in the same workspace will be used by default.
supportedAPIExports:
description: SupportedAPIExports defines a set of APIExports supposed
to be supported by this SyncTarget. The SyncTarget will be selected
to deploy the workload only when the resource schema on the SyncTarget
is compatible with the resource schema included in the exports.
If it is not set, the kubernetes export in the same workspace will
be used by default.
items:
description: ExportReference describes a reference to an APIExport.
Exactly one of the fields must be set.
Expand Down Expand Up @@ -181,7 +191,7 @@ spec:
pattern: ^(|[a-z0-9]([-a-z0-9]*[a-z0-9](\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?)$
type: string
identityHash:
description: IdentityHash is the identity for a given APIExport
description: identityHash is the identity for a given APIExport
that the APIResourceSchema belongs to. The hash can be found
on APIExport and APIResourceSchema's status. It will be empty
for core types.
Expand All @@ -194,21 +204,28 @@ spec:
type: string
state:
default: Pending
description: State indicate whether the resources schema is
description: state indicate whether the resources schema is
compatible to the SyncTarget. It must be updated by syncer
after checking the API compaibility on SyncTarget.
enum:
- Pending
- Accepted
- Incompatible
type: string
version:
description: Versions is the version of the resource.
pattern: ^[a-z][-a-z0-9]*[a-z0-9]$
type: string
versions:
description: versions are the resource versions the syncer can
choose to sync depending on availability on the downstream
cluster. Conversion to the storage version, if necessary,
will be done on the kcp side. The versions are ordered by
precedence and the first version compatible is preferred by
syncer.
items:
type: string
minItems: 1
type: array
required:
- resource
- version
- versions
type: object
type: array
virtualWorkspaces:
Expand Down
2 changes: 1 addition & 1 deletion config/root-phase0/apiexport-scheduling.kcp.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
spec:
latestResourceSchemas:
- v220706-3993e86b.locations.scheduling.kcp.dev
- v220706-3993e86b.placements.scheduling.kcp.dev
- v220721-bb52ba0d.placements.scheduling.kcp.dev
maximalPermissionPolicy:
local: {}
status: {}
2 changes: 1 addition & 1 deletion config/root-phase0/apiexport-workload.kcp.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ metadata:
name: workload.kcp.dev
spec:
latestResourceSchemas:
- v220721-ffb163a4.synctargets.workload.kcp.dev
- v220726-071d3647.synctargets.workload.kcp.dev
status: {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apis.kcp.dev/v1alpha1
kind: APIResourceSchema
metadata:
creationTimestamp: null
name: v220706-3993e86b.placements.scheduling.kcp.dev
name: v220721-bb52ba0d.placements.scheduling.kcp.dev
spec:
group: scheduling.kcp.dev
names:
Expand Down Expand Up @@ -230,7 +230,7 @@ spec:
description: selectedLocation is the location that a picked by this
placement.
properties:
exportName:
locationName:
description: Name of the Location.
type: string
path:
Expand All @@ -240,7 +240,7 @@ spec:
pattern: ^root(:[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
required:
- exportName
- locationName
- path
type: object
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apis.kcp.dev/v1alpha1
kind: APIResourceSchema
metadata:
creationTimestamp: null
name: v220721-ffb163a4.synctargets.workload.kcp.dev
name: v220726-071d3647.synctargets.workload.kcp.dev
spec:
group: workload.kcp.dev
names:
Expand Down Expand Up @@ -51,19 +51,29 @@ spec:
spec:
description: Spec holds the desired state.
properties:
cells:
additionalProperties:
type: string
description: Cells is a set of labels to identify the cells the SyncTarget
belongs to. SyncTargets with the same cells run as they are in the
same physical cluster. Each key/value pair in the cells should be
added and updated by service providers (i.e. a network provider updates
one key/value, while the storage provider updates another.)
type: object
evictAfter:
description: EvictAfter controls cluster schedulability of new and existing
workloads. After the EvictAfter time, any workload scheduled to the
cluster will be unassigned from the cluster. By default, workloads
scheduled to the cluster are not evicted.
format: date-time
type: string
exports:
description: Exports defines a set of APIExports supposed to be supported
by this SyncTarget. The SyncTarget will be selected to deploy the
workload only when the resource schema on the SyncTarget is compatible
with the resource schema included in the exports. If it is not set,
the kubernetes export in the same workspace will be used by default.
supportedAPIExports:
description: SupportedAPIExports defines a set of APIExports supposed
to be supported by this SyncTarget. The SyncTarget will be selected
to deploy the workload only when the resource schema on the SyncTarget
is compatible with the resource schema included in the exports. If
it is not set, the kubernetes export in the same workspace will be
used by default.
items:
description: ExportReference describes a reference to an APIExport.
Exactly one of the fields must be set.
Expand Down Expand Up @@ -175,7 +185,7 @@ spec:
pattern: ^(|[a-z0-9]([-a-z0-9]*[a-z0-9](\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?)$
type: string
identityHash:
description: IdentityHash is the identity for a given APIExport
description: identityHash is the identity for a given APIExport
that the APIResourceSchema belongs to. The hash can be found
on APIExport and APIResourceSchema's status. It will be empty
for core types.
Expand All @@ -188,21 +198,27 @@ spec:
type: string
state:
default: Pending
description: State indicate whether the resources schema is compatible
description: state indicate whether the resources schema is compatible
to the SyncTarget. It must be updated by syncer after checking
the API compaibility on SyncTarget.
enum:
- Pending
- Accepted
- Incompatible
type: string
version:
description: Versions is the version of the resource.
pattern: ^[a-z][-a-z0-9]*[a-z0-9]$
type: string
versions:
description: versions are the resource versions the syncer can
choose to sync depending on availability on the downstream cluster.
Conversion to the storage version, if necessary, will be done
on the kcp side. The versions are ordered by precedence and
the first version compatible is preferred by syncer.
items:
type: string
minItems: 1
type: array
required:
- resource
- version
- versions
type: object
type: array
virtualWorkspaces:
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/scheduling/v1alpha1/types_placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ type LocationReference struct {
// +required
// +kubebuilder:validation:Required
// +kube:validation:MinLength=1
LocationName string `json:"exportName"`
LocationName string `json:"locationName"`
}

type PlacementPhase string
Expand Down
23 changes: 15 additions & 8 deletions pkg/apis/workload/v1alpha1/synctarget_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,16 @@ type SyncTargetSpec struct {
// By default, workloads scheduled to the cluster are not evicted.
EvictAfter *metav1.Time `json:"evictAfter,omitempty"`

// Exports defines a set of APIExports supposed to be supported by this SyncTarget. The SyncTarget
// SupportedAPIExports defines a set of APIExports supposed to be supported by this SyncTarget. The SyncTarget
// will be selected to deploy the workload only when the resource schema on the SyncTarget is compatible
// with the resource schema included in the exports.
// If it is not set, the kubernetes export in the same workspace will be used by default.
Exports []apisv1alpha1.ExportReference `json:"exports,omitempty"`
SupportedAPIExports []apisv1alpha1.ExportReference `json:"supportedAPIExports,omitempty"`

// Cells is a set of labels to identify the cells the SyncTarget belongs to. SyncTargets with the same cells run as
// they are in the same physical cluster. Each key/value pair in the cells should be added and updated by service providers
// (i.e. a network provider updates one key/value, while the storage provider updates another.)
Cells map[string]string `json:"cells,omitempty"`
}

// SyncTargetStatus communicates the observed state of the SyncTarget (from the controller).
Expand Down Expand Up @@ -106,20 +111,22 @@ type SyncTargetStatus struct {
type ResourceToSync struct {
apisv1alpha1.GroupResource `json:","`

// Versions is the version of the resource.
// +kubebuilder:validation:Pattern=`^[a-z][-a-z0-9]*[a-z0-9]$`
// +kubebuilder:validation:MinLength:1
// versions are the resource versions the syncer can choose to sync depending on
// availability on the downstream cluster. Conversion to the storage version, if necessary,
// will be done on the kcp side. The versions are ordered by precedence and the
// first version compatible is preferred by syncer.
// +kubebuilder:validation:MinItems=1
// +required
// +kubebuilder:Required
Version string `json:"version"`
Versions []string `json:"versions"`

// IdentityHash is the identity for a given APIExport that the APIResourceSchema belongs to.
// identityHash is the identity for a given APIExport that the APIResourceSchema belongs to.
// The hash can be found on APIExport and APIResourceSchema's status.
// It will be empty for core types.
// +optional
IdentityHash string `json:"identityHash"`

// State indicate whether the resources schema is compatible to the SyncTarget. It must be updated
// state indicate whether the resources schema is compatible to the SyncTarget. It must be updated
// by syncer after checking the API compaibility on SyncTarget.
// +kubebuilder:validation:Enum=Pending;Accepted;Incompatible
// +kubebuilder:default=Pending
Expand Down
20 changes: 17 additions & 3 deletions pkg/apis/workload/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fde588e

Please sign in to comment.