-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tamal Saha <[email protected]>
- Loading branch information
Showing
14 changed files
with
885 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
Copyright AppsCode Inc. and Contributors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1 | ||
|
||
import ( | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +genclient | ||
// +genclient:nonNamespaced | ||
// +genclient:skipVerbs=updateStatus | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +kubebuilder:resource:scope=Cluster | ||
|
||
// PlacementPolicy represents a set of pods with consistent identities. | ||
// Identities are defined as: | ||
// - Network: A single stable DNS and hostname. | ||
// - Storage: As many VolumeClaims as requested. | ||
// | ||
// The PlacementPolicy guarantees that a given network identity will always | ||
// map to the same storage identity. | ||
type PlacementPolicy struct { | ||
metav1.TypeMeta `json:",inline"` | ||
// Standard object's metadata. | ||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata | ||
// +optional | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Spec defines the desired identities of pods in this set. | ||
// +optional | ||
Spec PlacementPolicySpec `json:"spec,omitempty"` | ||
} | ||
|
||
// A PlacementPolicySpec is the specification of a PlacementPolicy. | ||
type PlacementPolicySpec struct { | ||
// +optional | ||
ZoneSpreadConstraint *ZoneSpreadConstraint `json:"zoneSpreadConstraint,omitempty"` | ||
|
||
// +optional | ||
NodeSpreadConstraint *NodeSpreadConstraint `json:"nodeSpreadConstraint,omitempty"` | ||
|
||
// +optional | ||
NodeAffinity []NodeAffinityRules `json:"nodeAffinity,omitempty"` | ||
} | ||
|
||
type ZoneSpreadConstraint struct { | ||
Zones []string `json:"zones"` | ||
MaxSkew int32 `json:"maxSkew"` | ||
WhenUnsatisfiable v1.UnsatisfiableConstraintAction `json:"whenUnsatisfiable"` | ||
} | ||
|
||
type NodeSpreadConstraint struct { | ||
MaxSkew int32 `json:"maxSkew"` | ||
WhenUnsatisfiable v1.UnsatisfiableConstraintAction `json:"whenUnsatisfiable"` | ||
} | ||
|
||
type NodeAffinityRules struct { | ||
TopologyKey string `json:"topologyKey"` | ||
Domains []TopologyDomain `json:"domains"` | ||
WhenUnsatisfiable v1.UnsatisfiableConstraintAction `json:"whenUnsatisfiable"` | ||
} | ||
|
||
type TopologyDomain struct { | ||
Domain string `json:"domain"` | ||
Replicas string `json:"replicas"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// PlacementPolicyList is a collection of PlacementPolicys. | ||
type PlacementPolicyList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
// Standard list's metadata. | ||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata | ||
// +optional | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
// Items is the list of stateful sets. | ||
Items []PlacementPolicy `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&PlacementPolicy{}, &PlacementPolicyList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
client/clientset/versioned/typed/apps/v1/fake/fake_apps_client.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.