Merge pull request #35663 from janetkuo/statefulset
Automatic merge from submit-queue Rename PetSet to StatefulSet <!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md 2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md 3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes --> **What this PR does / why we need it**: #35534 **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, #<issue_number>, ...)` format, will close that issue when PR gets merged)*: **Special notes for your reviewer**: cc @erictune @foxish @kubernetes/sig-apps @ymqytw **Release note**: <!-- Steps to write your release note: 1. Use the release-note-* labels to set the release note state (if you have access) 2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. --> ```release-note ```
This commit is contained in:
commit
e37b7cbde0
@ -14382,9 +14382,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/apis/apps/v1alpha1/namespaces/{namespace}/petsets": {
|
||||
"/apis/apps/v1alpha1/namespaces/{namespace}/statefulsets": {
|
||||
"get": {
|
||||
"description": "list or watch objects of kind PetSet",
|
||||
"description": "list or watch objects of kind StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14399,7 +14399,7 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "listAppsV1alpha1NamespacedPetSet",
|
||||
"operationId": "listAppsV1alpha1NamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"uniqueItems": true,
|
||||
@ -14441,7 +14441,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSetList"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSetList"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -14450,7 +14450,7 @@
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "create a PetSet",
|
||||
"description": "create a StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14465,14 +14465,14 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "createAppsV1alpha1NamespacedPetSet",
|
||||
"operationId": "createAppsV1alpha1NamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -14480,7 +14480,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -14489,7 +14489,7 @@
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "delete collection of PetSet",
|
||||
"description": "delete collection of StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14504,7 +14504,7 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "deleteAppsV1alpha1CollectionNamespacedPetSet",
|
||||
"operationId": "deleteAppsV1alpha1CollectionNamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"uniqueItems": true,
|
||||
@ -14572,9 +14572,9 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}": {
|
||||
"/apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}": {
|
||||
"get": {
|
||||
"description": "read the specified PetSet",
|
||||
"description": "read the specified StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14589,7 +14589,7 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "readAppsV1alpha1NamespacedPetSet",
|
||||
"operationId": "readAppsV1alpha1NamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"uniqueItems": true,
|
||||
@ -14610,7 +14610,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -14619,7 +14619,7 @@
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "replace the specified PetSet",
|
||||
"description": "replace the specified StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14634,14 +14634,14 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "replaceAppsV1alpha1NamespacedPetSet",
|
||||
"operationId": "replaceAppsV1alpha1NamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -14649,7 +14649,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -14658,7 +14658,7 @@
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "delete a PetSet",
|
||||
"description": "delete a StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14673,7 +14673,7 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "deleteAppsV1alpha1NamespacedPetSet",
|
||||
"operationId": "deleteAppsV1alpha1NamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
@ -14697,7 +14697,7 @@
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"description": "partially update the specified PetSet",
|
||||
"description": "partially update the specified StatefulSet",
|
||||
"consumes": [
|
||||
"application/json-patch+json",
|
||||
"application/merge-patch+json",
|
||||
@ -14714,7 +14714,7 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "patchAppsV1alpha1NamespacedPetSet",
|
||||
"operationId": "patchAppsV1alpha1NamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
@ -14729,7 +14729,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -14741,7 +14741,7 @@
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@ -14763,9 +14763,9 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}/status": {
|
||||
"/apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}/status": {
|
||||
"get": {
|
||||
"description": "read status of the specified PetSet",
|
||||
"description": "read status of the specified StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14780,12 +14780,12 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "readAppsV1alpha1NamespacedPetSetStatus",
|
||||
"operationId": "readAppsV1alpha1NamespacedStatefulSetStatus",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -14794,7 +14794,7 @@
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "replace status of the specified PetSet",
|
||||
"description": "replace status of the specified StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14809,14 +14809,14 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "replaceAppsV1alpha1NamespacedPetSetStatus",
|
||||
"operationId": "replaceAppsV1alpha1NamespacedStatefulSetStatus",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -14824,7 +14824,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -14833,7 +14833,7 @@
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"description": "partially update status of the specified PetSet",
|
||||
"description": "partially update status of the specified StatefulSet",
|
||||
"consumes": [
|
||||
"application/json-patch+json",
|
||||
"application/merge-patch+json",
|
||||
@ -14850,7 +14850,7 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "patchAppsV1alpha1NamespacedPetSetStatus",
|
||||
"operationId": "patchAppsV1alpha1NamespacedStatefulSetStatus",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
@ -14865,7 +14865,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -14877,7 +14877,7 @@
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@ -14899,9 +14899,9 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1alpha1/petsets": {
|
||||
"/apis/apps/v1alpha1/statefulsets": {
|
||||
"get": {
|
||||
"description": "list or watch objects of kind PetSet",
|
||||
"description": "list or watch objects of kind StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14916,12 +14916,12 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "listAppsV1alpha1PetSetForAllNamespaces",
|
||||
"operationId": "listAppsV1alpha1StatefulSetForAllNamespaces",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSetList"
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSetList"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -14974,9 +14974,9 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1alpha1/watch/namespaces/{namespace}/petsets": {
|
||||
"/apis/apps/v1alpha1/watch/namespaces/{namespace}/statefulsets": {
|
||||
"get": {
|
||||
"description": "watch individual changes to a list of PetSet",
|
||||
"description": "watch individual changes to a list of StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -14992,7 +14992,7 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "watchAppsV1alpha1NamespacedPetSetList",
|
||||
"operationId": "watchAppsV1alpha1NamespacedStatefulSetList",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@ -15058,9 +15058,9 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1alpha1/watch/namespaces/{namespace}/petsets/{name}": {
|
||||
"/apis/apps/v1alpha1/watch/namespaces/{namespace}/statefulsets/{name}": {
|
||||
"get": {
|
||||
"description": "watch changes to an object of kind PetSet",
|
||||
"description": "watch changes to an object of kind StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -15076,7 +15076,7 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "watchAppsV1alpha1NamespacedPetSet",
|
||||
"operationId": "watchAppsV1alpha1NamespacedStatefulSet",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@ -15107,7 +15107,7 @@
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@ -15150,9 +15150,9 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1alpha1/watch/petsets": {
|
||||
"/apis/apps/v1alpha1/watch/statefulsets": {
|
||||
"get": {
|
||||
"description": "watch individual changes to a list of PetSet",
|
||||
"description": "watch individual changes to a list of StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
@ -15168,7 +15168,7 @@
|
||||
"tags": [
|
||||
"apps_v1alpha1"
|
||||
],
|
||||
"operationId": "watchAppsV1alpha1PetSetListForAllNamespaces",
|
||||
"operationId": "watchAppsV1alpha1StatefulSetListForAllNamespaces",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@ -32209,90 +32209,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.PetSet": {
|
||||
"description": "PetSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe PetSet guarantees that a given network identity will always map to the same storage identity. PetSet is currently in alpha and subject to change without notice.",
|
||||
"properties": {
|
||||
"metadata": {
|
||||
"$ref": "#/definitions/v1.ObjectMeta"
|
||||
},
|
||||
"spec": {
|
||||
"description": "Spec defines the desired identities of pets in this set.",
|
||||
"$ref": "#/definitions/v1alpha1.PetSetSpec"
|
||||
},
|
||||
"status": {
|
||||
"description": "Status is the current status of Pets in this PetSet. This data may be out of date by some window of time.",
|
||||
"$ref": "#/definitions/v1alpha1.PetSetStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.PetSetList": {
|
||||
"description": "PetSetList is a collection of PetSets.",
|
||||
"required": [
|
||||
"items"
|
||||
],
|
||||
"properties": {
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/v1alpha1.PetSet"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "#/definitions/unversioned.ListMeta"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.PetSetSpec": {
|
||||
"description": "A PetSetSpec is the specification of a PetSet.",
|
||||
"required": [
|
||||
"template",
|
||||
"serviceName"
|
||||
],
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"description": "Replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"selector": {
|
||||
"description": "Selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors",
|
||||
"$ref": "#/definitions/unversioned.LabelSelector"
|
||||
},
|
||||
"serviceName": {
|
||||
"description": "ServiceName is the name of the service that governs this PetSet. This service must exist before the PetSet, and is responsible for the network identity of the set. Pets get DNS/hostnames that follow the pattern: pet-specific-string.serviceName.default.svc.cluster.local where \"pet-specific-string\" is managed by the PetSet controller.",
|
||||
"type": "string"
|
||||
},
|
||||
"template": {
|
||||
"description": "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the PetSet will fulfill this Template, but have a unique identity from the rest of the PetSet.",
|
||||
"$ref": "#/definitions/v1.PodTemplateSpec"
|
||||
},
|
||||
"volumeClaimTemplates": {
|
||||
"description": "VolumeClaimTemplates is a list of claims that pets are allowed to reference. The PetSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pet. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/v1.PersistentVolumeClaim"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.PetSetStatus": {
|
||||
"description": "PetSetStatus represents the current state of a PetSet.",
|
||||
"required": [
|
||||
"replicas"
|
||||
],
|
||||
"properties": {
|
||||
"observedGeneration": {
|
||||
"description": "most recent generation observed by this autoscaler.",
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"replicas": {
|
||||
"description": "Replicas is the number of actual replicas.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.PodDisruptionBudget": {
|
||||
"description": "PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods",
|
||||
"properties": {
|
||||
@ -32519,6 +32435,90 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.StatefulSet": {
|
||||
"description": "StatefulSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe StatefulSet guarantees that a given network identity will always map to the same storage identity. StatefulSet is currently in alpha and subject to change without notice.",
|
||||
"properties": {
|
||||
"metadata": {
|
||||
"$ref": "#/definitions/v1.ObjectMeta"
|
||||
},
|
||||
"spec": {
|
||||
"description": "Spec defines the desired identities of pods in this set.",
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSetSpec"
|
||||
},
|
||||
"status": {
|
||||
"description": "Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time.",
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSetStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.StatefulSetList": {
|
||||
"description": "StatefulSetList is a collection of StatefulSets.",
|
||||
"required": [
|
||||
"items"
|
||||
],
|
||||
"properties": {
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/v1alpha1.StatefulSet"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "#/definitions/unversioned.ListMeta"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.StatefulSetSpec": {
|
||||
"description": "A StatefulSetSpec is the specification of a StatefulSet.",
|
||||
"required": [
|
||||
"template",
|
||||
"serviceName"
|
||||
],
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"description": "Replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"selector": {
|
||||
"description": "Selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors",
|
||||
"$ref": "#/definitions/unversioned.LabelSelector"
|
||||
},
|
||||
"serviceName": {
|
||||
"description": "ServiceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller.",
|
||||
"type": "string"
|
||||
},
|
||||
"template": {
|
||||
"description": "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet.",
|
||||
"$ref": "#/definitions/v1.PodTemplateSpec"
|
||||
},
|
||||
"volumeClaimTemplates": {
|
||||
"description": "VolumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/v1.PersistentVolumeClaim"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.StatefulSetStatus": {
|
||||
"description": "StatefulSetStatus represents the current state of a StatefulSet.",
|
||||
"required": [
|
||||
"replicas"
|
||||
],
|
||||
"properties": {
|
||||
"observedGeneration": {
|
||||
"description": "most recent generation observed by this autoscaler.",
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"replicas": {
|
||||
"description": "Replicas is the number of actual replicas.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.Subject": {
|
||||
"description": "Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names.",
|
||||
"required": [
|
||||
|
@ -9,14 +9,14 @@
|
||||
},
|
||||
"apis": [
|
||||
{
|
||||
"path": "/apis/apps/v1alpha1/namespaces/{namespace}/petsets",
|
||||
"path": "/apis/apps/v1alpha1/namespaces/{namespace}/statefulsets",
|
||||
"description": "API at /apis/apps/v1alpha1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "v1alpha1.PetSetList",
|
||||
"type": "v1alpha1.StatefulSetList",
|
||||
"method": "GET",
|
||||
"summary": "list or watch objects of kind PetSet",
|
||||
"nickname": "listNamespacedPetSet",
|
||||
"summary": "list or watch objects of kind StatefulSet",
|
||||
"nickname": "listNamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -79,7 +79,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1alpha1.PetSetList"
|
||||
"responseModel": "v1alpha1.StatefulSetList"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
@ -92,10 +92,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"method": "POST",
|
||||
"summary": "create a PetSet",
|
||||
"nickname": "createNamespacedPetSet",
|
||||
"summary": "create a StatefulSet",
|
||||
"nickname": "createNamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -106,7 +106,7 @@
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
@ -126,7 +126,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1alpha1.PetSet"
|
||||
"responseModel": "v1alpha1.StatefulSet"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
@ -141,8 +141,8 @@
|
||||
{
|
||||
"type": "unversioned.Status",
|
||||
"method": "DELETE",
|
||||
"summary": "delete collection of PetSet",
|
||||
"nickname": "deletecollectionNamespacedPetSet",
|
||||
"summary": "delete collection of StatefulSet",
|
||||
"nickname": "deletecollectionNamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -220,14 +220,14 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1alpha1/watch/namespaces/{namespace}/petsets",
|
||||
"path": "/apis/apps/v1alpha1/watch/namespaces/{namespace}/statefulsets",
|
||||
"description": "API at /apis/apps/v1alpha1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "versioned.Event",
|
||||
"method": "GET",
|
||||
"summary": "watch individual changes to a list of PetSet",
|
||||
"nickname": "watchNamespacedPetSetList",
|
||||
"summary": "watch individual changes to a list of StatefulSet",
|
||||
"nickname": "watchNamespacedStatefulSetList",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -306,14 +306,14 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}",
|
||||
"path": "/apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}",
|
||||
"description": "API at /apis/apps/v1alpha1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"method": "GET",
|
||||
"summary": "read the specified PetSet",
|
||||
"nickname": "readNamespacedPetSet",
|
||||
"summary": "read the specified StatefulSet",
|
||||
"nickname": "readNamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -351,7 +351,7 @@
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
@ -360,7 +360,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1alpha1.PetSet"
|
||||
"responseModel": "v1alpha1.StatefulSet"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
@ -373,10 +373,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"method": "PUT",
|
||||
"summary": "replace the specified PetSet",
|
||||
"nickname": "replaceNamespacedPetSet",
|
||||
"summary": "replace the specified StatefulSet",
|
||||
"nickname": "replaceNamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -387,7 +387,7 @@
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
@ -406,7 +406,7 @@
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
@ -415,7 +415,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1alpha1.PetSet"
|
||||
"responseModel": "v1alpha1.StatefulSet"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
@ -428,10 +428,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"method": "PATCH",
|
||||
"summary": "partially update the specified PetSet",
|
||||
"nickname": "patchNamespacedPetSet",
|
||||
"summary": "partially update the specified StatefulSet",
|
||||
"nickname": "patchNamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -461,7 +461,7 @@
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
@ -470,7 +470,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1alpha1.PetSet"
|
||||
"responseModel": "v1alpha1.StatefulSet"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
@ -487,8 +487,8 @@
|
||||
{
|
||||
"type": "unversioned.Status",
|
||||
"method": "DELETE",
|
||||
"summary": "delete a PetSet",
|
||||
"nickname": "deleteNamespacedPetSet",
|
||||
"summary": "delete a StatefulSet",
|
||||
"nickname": "deleteNamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -518,7 +518,7 @@
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
@ -542,14 +542,14 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1alpha1/watch/namespaces/{namespace}/petsets/{name}",
|
||||
"path": "/apis/apps/v1alpha1/watch/namespaces/{namespace}/statefulsets/{name}",
|
||||
"description": "API at /apis/apps/v1alpha1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "versioned.Event",
|
||||
"method": "GET",
|
||||
"summary": "watch changes to an object of kind PetSet",
|
||||
"nickname": "watchNamespacedPetSet",
|
||||
"summary": "watch changes to an object of kind StatefulSet",
|
||||
"nickname": "watchNamespacedStatefulSet",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -611,7 +611,7 @@
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
@ -636,14 +636,14 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1alpha1/petsets",
|
||||
"path": "/apis/apps/v1alpha1/statefulsets",
|
||||
"description": "API at /apis/apps/v1alpha1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "v1alpha1.PetSetList",
|
||||
"type": "v1alpha1.StatefulSetList",
|
||||
"method": "GET",
|
||||
"summary": "list or watch objects of kind PetSet",
|
||||
"nickname": "listPetSetForAllNamespaces",
|
||||
"summary": "list or watch objects of kind StatefulSet",
|
||||
"nickname": "listStatefulSetForAllNamespaces",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -698,7 +698,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1alpha1.PetSetList"
|
||||
"responseModel": "v1alpha1.StatefulSetList"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
@ -713,14 +713,14 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1alpha1/watch/petsets",
|
||||
"path": "/apis/apps/v1alpha1/watch/statefulsets",
|
||||
"description": "API at /apis/apps/v1alpha1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "versioned.Event",
|
||||
"method": "GET",
|
||||
"summary": "watch individual changes to a list of PetSet",
|
||||
"nickname": "watchPetSetListForAllNamespaces",
|
||||
"summary": "watch individual changes to a list of StatefulSet",
|
||||
"nickname": "watchStatefulSetListForAllNamespaces",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -791,14 +791,14 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}/status",
|
||||
"path": "/apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}/status",
|
||||
"description": "API at /apis/apps/v1alpha1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"method": "GET",
|
||||
"summary": "read status of the specified PetSet",
|
||||
"nickname": "readNamespacedPetSetStatus",
|
||||
"summary": "read status of the specified StatefulSet",
|
||||
"nickname": "readNamespacedStatefulSetStatus",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -820,7 +820,7 @@
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
@ -829,7 +829,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1alpha1.PetSet"
|
||||
"responseModel": "v1alpha1.StatefulSet"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
@ -842,10 +842,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"method": "PUT",
|
||||
"summary": "replace status of the specified PetSet",
|
||||
"nickname": "replaceNamespacedPetSetStatus",
|
||||
"summary": "replace status of the specified StatefulSet",
|
||||
"nickname": "replaceNamespacedStatefulSetStatus",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -856,7 +856,7 @@
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
@ -875,7 +875,7 @@
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
@ -884,7 +884,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1alpha1.PetSet"
|
||||
"responseModel": "v1alpha1.StatefulSet"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
@ -897,10 +897,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1alpha1.PetSet",
|
||||
"type": "v1alpha1.StatefulSet",
|
||||
"method": "PATCH",
|
||||
"summary": "partially update status of the specified PetSet",
|
||||
"nickname": "patchNamespacedPetSetStatus",
|
||||
"summary": "partially update status of the specified StatefulSet",
|
||||
"nickname": "patchNamespacedStatefulSetStatus",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -930,7 +930,7 @@
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the PetSet",
|
||||
"description": "name of the StatefulSet",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
@ -939,7 +939,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1alpha1.PetSet"
|
||||
"responseModel": "v1alpha1.StatefulSet"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
@ -980,9 +980,9 @@
|
||||
}
|
||||
],
|
||||
"models": {
|
||||
"v1alpha1.PetSetList": {
|
||||
"id": "v1alpha1.PetSetList",
|
||||
"description": "PetSetList is a collection of PetSets.",
|
||||
"v1alpha1.StatefulSetList": {
|
||||
"id": "v1alpha1.StatefulSetList",
|
||||
"description": "StatefulSetList is a collection of StatefulSets.",
|
||||
"required": [
|
||||
"items"
|
||||
],
|
||||
@ -1001,7 +1001,7 @@
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "v1alpha1.PetSet"
|
||||
"$ref": "v1alpha1.StatefulSet"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1020,9 +1020,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.PetSet": {
|
||||
"id": "v1alpha1.PetSet",
|
||||
"description": "PetSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe PetSet guarantees that a given network identity will always map to the same storage identity. PetSet is currently in alpha and subject to change without notice.",
|
||||
"v1alpha1.StatefulSet": {
|
||||
"id": "v1alpha1.StatefulSet",
|
||||
"description": "StatefulSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe StatefulSet guarantees that a given network identity will always map to the same storage identity. StatefulSet is currently in alpha and subject to change without notice.",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string",
|
||||
@ -1036,12 +1036,12 @@
|
||||
"$ref": "v1.ObjectMeta"
|
||||
},
|
||||
"spec": {
|
||||
"$ref": "v1alpha1.PetSetSpec",
|
||||
"description": "Spec defines the desired identities of pets in this set."
|
||||
"$ref": "v1alpha1.StatefulSetSpec",
|
||||
"description": "Spec defines the desired identities of pods in this set."
|
||||
},
|
||||
"status": {
|
||||
"$ref": "v1alpha1.PetSetStatus",
|
||||
"description": "Status is the current status of Pets in this PetSet. This data may be out of date by some window of time."
|
||||
"$ref": "v1alpha1.StatefulSetStatus",
|
||||
"description": "Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time."
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1153,9 +1153,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.PetSetSpec": {
|
||||
"id": "v1alpha1.PetSetSpec",
|
||||
"description": "A PetSetSpec is the specification of a PetSet.",
|
||||
"v1alpha1.StatefulSetSpec": {
|
||||
"id": "v1alpha1.StatefulSetSpec",
|
||||
"description": "A StatefulSetSpec is the specification of a StatefulSet.",
|
||||
"required": [
|
||||
"template",
|
||||
"serviceName"
|
||||
@ -1172,18 +1172,18 @@
|
||||
},
|
||||
"template": {
|
||||
"$ref": "v1.PodTemplateSpec",
|
||||
"description": "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the PetSet will fulfill this Template, but have a unique identity from the rest of the PetSet."
|
||||
"description": "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet."
|
||||
},
|
||||
"volumeClaimTemplates": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "v1.PersistentVolumeClaim"
|
||||
},
|
||||
"description": "VolumeClaimTemplates is a list of claims that pets are allowed to reference. The PetSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pet. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name."
|
||||
"description": "VolumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name."
|
||||
},
|
||||
"serviceName": {
|
||||
"type": "string",
|
||||
"description": "ServiceName is the name of the service that governs this PetSet. This service must exist before the PetSet, and is responsible for the network identity of the set. Pets get DNS/hostnames that follow the pattern: pet-specific-string.serviceName.default.svc.cluster.local where \"pet-specific-string\" is managed by the PetSet controller."
|
||||
"description": "ServiceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller."
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2641,9 +2641,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1alpha1.PetSetStatus": {
|
||||
"id": "v1alpha1.PetSetStatus",
|
||||
"description": "PetSetStatus represents the current state of a PetSet.",
|
||||
"v1alpha1.StatefulSetStatus": {
|
||||
"id": "v1alpha1.StatefulSetStatus",
|
||||
"description": "StatefulSetStatus represents the current state of a StatefulSet.",
|
||||
"required": [
|
||||
"replicas"
|
||||
],
|
||||
|
@ -1,5 +1,5 @@
|
||||
apiVersion: "apps/v1alpha1"
|
||||
kind: PetSet
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: calico-etcd
|
||||
namespace: kube-system
|
||||
|
@ -440,15 +440,15 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
|
||||
|
||||
groupVersion = "apps/v1alpha1"
|
||||
resources, found = resourceMap[groupVersion]
|
||||
glog.Infof("Attempting to start petset, full resource map %+v", resourceMap)
|
||||
glog.Infof("Attempting to start statefulset, full resource map %+v", resourceMap)
|
||||
if containsVersion(versions, groupVersion) && found {
|
||||
glog.Infof("Starting %s apis", groupVersion)
|
||||
if containsResource(resources, "petsets") {
|
||||
glog.Infof("Starting PetSet controller")
|
||||
if containsResource(resources, "statefulsets") {
|
||||
glog.Infof("Starting StatefulSet controller")
|
||||
resyncPeriod := ResyncPeriod(s)()
|
||||
go petset.NewPetSetController(
|
||||
go petset.NewStatefulSetController(
|
||||
sharedInformers.Pods().Informer(),
|
||||
client("petset-controller"),
|
||||
client("statefulset-controller"),
|
||||
resyncPeriod,
|
||||
).Run(1, wait.NeverStop)
|
||||
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
|
||||
|
@ -150,7 +150,6 @@ func main() {
|
||||
"k8s.io/kubernetes/pkg/fields",
|
||||
"k8s.io/kubernetes/pkg/labels",
|
||||
"k8s.io/kubernetes/pkg/watch",
|
||||
"k8s.io/kubernetes/pkg/client/unversioned",
|
||||
"k8s.io/kubernetes/pkg/apimachinery/registered",
|
||||
}
|
||||
|
||||
|
@ -370,10 +370,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="#_v1alpha1_petset">v1alpha1.PetSet</a></p>
|
||||
<p><a href="#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="#_v1alpha1_petsetlist">v1alpha1.PetSetList</a></p>
|
||||
<p><a href="#_v1alpha1_statefulsetlist">v1alpha1.StatefulSetList</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -817,6 +817,68 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1alpha1_statefulsetspec">v1alpha1.StatefulSetSpec</h3>
|
||||
<div class="paragraph">
|
||||
<p>A StatefulSetSpec is the specification of a StatefulSet.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">replicas</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">selector</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: <a href="http://kubernetes.io/docs/user-guide/labels#label-selectors">http://kubernetes.io/docs/user-guide/labels#label-selectors</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_unversioned_labelselector">unversioned.LabelSelector</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">template</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_podtemplatespec">v1.PodTemplateSpec</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">volumeClaimTemplates</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">VolumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_persistentvolumeclaim">v1.PersistentVolumeClaim</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">serviceName</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">ServiceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where "pod-specific-string" is managed by the StatefulSet controller.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_fcvolumesource">v1.FCVolumeSource</h3>
|
||||
@ -1508,6 +1570,47 @@ Examples:<br>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1alpha1_statefulsetstatus">v1alpha1.StatefulSetStatus</h3>
|
||||
<div class="paragraph">
|
||||
<p>StatefulSetStatus represents the current state of a StatefulSet.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">observedGeneration</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">most recent generation observed by this autoscaler.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int64)</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">replicas</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Replicas is the number of actual replicas.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_podsecuritycontext">v1.PodSecurityContext</h3>
|
||||
@ -1969,68 +2072,6 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1alpha1_petsetspec">v1alpha1.PetSetSpec</h3>
|
||||
<div class="paragraph">
|
||||
<p>A PetSetSpec is the specification of a PetSet.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">replicas</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">selector</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: <a href="http://kubernetes.io/docs/user-guide/labels#label-selectors">http://kubernetes.io/docs/user-guide/labels#label-selectors</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_unversioned_labelselector">unversioned.LabelSelector</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">template</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the PetSet will fulfill this Template, but have a unique identity from the rest of the PetSet.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_podtemplatespec">v1.PodTemplateSpec</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">volumeClaimTemplates</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">VolumeClaimTemplates is a list of claims that pets are allowed to reference. The PetSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pet. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_persistentvolumeclaim">v1.PersistentVolumeClaim</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">serviceName</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">ServiceName is the name of the service that governs this PetSet. This service must exist before the PetSet, and is responsible for the network identity of the set. Pets get DNS/hostnames that follow the pattern: pet-specific-string.serviceName.default.svc.cluster.local where "pet-specific-string" is managed by the PetSet controller.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_emptydirvolumesource">v1.EmptyDirVolumeSource</h3>
|
||||
@ -2543,12 +2584,50 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1alpha1_petset">v1alpha1.PetSet</h3>
|
||||
<h3 id="_unversioned_labelselector">unversioned.LabelSelector</h3>
|
||||
<div class="paragraph">
|
||||
<p>PetSet represents a set of pods with consistent identities. Identities are defined as:<br>
|
||||
- Network: A single stable DNS and hostname.<br>
|
||||
- Storage: As many VolumeClaims as requested.<br>
|
||||
The PetSet guarantees that a given network identity will always map to the same storage identity. PetSet is currently in alpha and subject to change without notice.</p>
|
||||
<p>A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">matchLabels</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">object</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">matchExpressions</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">matchExpressions is a list of label selector requirements. The requirements are ANDed.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_unversioned_labelselectorrequirement">unversioned.LabelSelectorRequirement</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1alpha1_statefulsetlist">v1alpha1.StatefulSetList</h3>
|
||||
<div class="paragraph">
|
||||
<p>StatefulSetList is a collection of StatefulSets.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
@ -2586,62 +2665,14 @@ The PetSet guarantees that a given network identity will always map to the same
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">metadata</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_objectmeta">v1.ObjectMeta</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_unversioned_listmeta">unversioned.ListMeta</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">spec</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Spec defines the desired identities of pets in this set.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1alpha1_petsetspec">v1alpha1.PetSetSpec</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">items</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">status</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Status is the current status of Pets in this PetSet. This data may be out of date by some window of time.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1alpha1_petsetstatus">v1alpha1.PetSetStatus</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_unversioned_labelselector">unversioned.LabelSelector</h3>
|
||||
<div class="paragraph">
|
||||
<p>A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">matchLabels</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">object</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">matchExpressions</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">matchExpressions is a list of label selector requirements. The requirements are ANDed.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_unversioned_labelselectorrequirement">unversioned.LabelSelectorRequirement</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1alpha1_statefulset">v1alpha1.StatefulSet</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -3100,47 +3131,6 @@ The PetSet guarantees that a given network identity will always map to the same
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1alpha1_petsetstatus">v1alpha1.PetSetStatus</h3>
|
||||
<div class="paragraph">
|
||||
<p>PetSetStatus represents the current state of a PetSet.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">observedGeneration</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">most recent generation observed by this autoscaler.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int64)</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">replicas</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Replicas is the number of actual replicas.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_deleteoptions">v1.DeleteOptions</h3>
|
||||
@ -4244,9 +4234,12 @@ The PetSet guarantees that a given network identity will always map to the same
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1alpha1_petsetlist">v1alpha1.PetSetList</h3>
|
||||
<h3 id="_v1alpha1_statefulset">v1alpha1.StatefulSet</h3>
|
||||
<div class="paragraph">
|
||||
<p>PetSetList is a collection of PetSets.</p>
|
||||
<p>StatefulSet represents a set of pods with consistent identities. Identities are defined as:<br>
|
||||
- Network: A single stable DNS and hostname.<br>
|
||||
- Storage: As many VolumeClaims as requested.<br>
|
||||
The StatefulSet guarantees that a given network identity will always map to the same storage identity. StatefulSet is currently in alpha and subject to change without notice.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
@ -4284,14 +4277,21 @@ The PetSet guarantees that a given network identity will always map to the same
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">metadata</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_unversioned_listmeta">unversioned.ListMeta</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_objectmeta">v1.ObjectMeta</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">items</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">spec</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Spec defines the desired identities of pods in this set.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1alpha1_statefulsetspec">v1alpha1.StatefulSetSpec</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1alpha1_petset">v1alpha1.PetSet</a> array</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">status</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1alpha1_statefulsetstatus">v1alpha1.StatefulSetStatus</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -4396,7 +4396,7 @@ The PetSet guarantees that a given network identity will always map to the same
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2016-09-27 23:59:43 UTC
|
||||
Last updated 2016-10-26 23:22:35 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -443,10 +443,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_list_or_watch_objects_of_kind_petset">list or watch objects of kind PetSet</h3>
|
||||
<h3 id="_list_or_watch_objects_of_kind_statefulset">list or watch objects of kind StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>GET /apis/apps/v1alpha1/namespaces/{namespace}/petsets</pre>
|
||||
<pre>GET /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -550,7 +550,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petsetlist">v1alpha1.PetSetList</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulsetlist">v1alpha1.StatefulSetList</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -594,10 +594,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_delete_collection_of_petset">delete collection of PetSet</h3>
|
||||
<h3 id="_delete_collection_of_statefulset">delete collection of StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>DELETE /apis/apps/v1alpha1/namespaces/{namespace}/petsets</pre>
|
||||
<pre>DELETE /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -745,10 +745,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_create_a_petset">create a PetSet</h3>
|
||||
<h3 id="_create_a_statefulset">create a StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>POST /apis/apps/v1alpha1/namespaces/{namespace}/petsets</pre>
|
||||
<pre>POST /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -786,7 +786,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">body</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -820,7 +820,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -864,10 +864,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_read_the_specified_petset">read the specified PetSet</h3>
|
||||
<h3 id="_read_the_specified_statefulset">read the specified StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>GET /apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}</pre>
|
||||
<pre>GET /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -927,7 +927,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">PathParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the PetSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the StatefulSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
@ -955,7 +955,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -999,10 +999,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_replace_the_specified_petset">replace the specified PetSet</h3>
|
||||
<h3 id="_replace_the_specified_statefulset">replace the specified StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>PUT /apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}</pre>
|
||||
<pre>PUT /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -1040,7 +1040,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">body</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -1054,7 +1054,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">PathParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the PetSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the StatefulSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
@ -1082,7 +1082,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1126,10 +1126,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_delete_a_petset">delete a PetSet</h3>
|
||||
<h3 id="_delete_a_statefulset">delete a StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>DELETE /apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}</pre>
|
||||
<pre>DELETE /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -1181,7 +1181,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">PathParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the PetSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the StatefulSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
@ -1253,10 +1253,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_partially_update_the_specified_petset">partially update the specified PetSet</h3>
|
||||
<h3 id="_partially_update_the_specified_statefulset">partially update the specified StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>PATCH /apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}</pre>
|
||||
<pre>PATCH /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -1308,7 +1308,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">PathParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the PetSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the StatefulSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
@ -1336,7 +1336,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1386,10 +1386,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_read_status_of_the_specified_petset">read status of the specified PetSet</h3>
|
||||
<h3 id="_read_status_of_the_specified_statefulset">read status of the specified StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>GET /apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}/status</pre>
|
||||
<pre>GET /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}/status</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -1433,7 +1433,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">PathParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the PetSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the StatefulSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
@ -1461,7 +1461,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1505,10 +1505,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_replace_status_of_the_specified_petset">replace status of the specified PetSet</h3>
|
||||
<h3 id="_replace_status_of_the_specified_statefulset">replace status of the specified StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>PUT /apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}/status</pre>
|
||||
<pre>PUT /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}/status</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -1546,7 +1546,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">body</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -1560,7 +1560,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">PathParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the PetSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the StatefulSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
@ -1588,7 +1588,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1632,10 +1632,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_partially_update_status_of_the_specified_petset">partially update status of the specified PetSet</h3>
|
||||
<h3 id="_partially_update_status_of_the_specified_statefulset">partially update status of the specified StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>PATCH /apis/apps/v1alpha1/namespaces/{namespace}/petsets/{name}/status</pre>
|
||||
<pre>PATCH /apis/apps/v1alpha1/namespaces/{namespace}/statefulsets/{name}/status</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -1687,7 +1687,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">PathParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the PetSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the StatefulSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
@ -1715,7 +1715,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petset">v1alpha1.PetSet</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulset">v1alpha1.StatefulSet</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1765,10 +1765,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_list_or_watch_objects_of_kind_petset_2">list or watch objects of kind PetSet</h3>
|
||||
<h3 id="_list_or_watch_objects_of_kind_statefulset_2">list or watch objects of kind StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>GET /apis/apps/v1alpha1/petsets</pre>
|
||||
<pre>GET /apis/apps/v1alpha1/statefulsets</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -1864,7 +1864,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_petsetlist">v1alpha1.PetSetList</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1alpha1_statefulsetlist">v1alpha1.StatefulSetList</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1908,10 +1908,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_watch_individual_changes_to_a_list_of_petset">watch individual changes to a list of PetSet</h3>
|
||||
<h3 id="_watch_individual_changes_to_a_list_of_statefulset">watch individual changes to a list of StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>GET /apis/apps/v1alpha1/watch/namespaces/{namespace}/petsets</pre>
|
||||
<pre>GET /apis/apps/v1alpha1/watch/namespaces/{namespace}/statefulsets</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -2062,10 +2062,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_watch_changes_to_an_object_of_kind_petset">watch changes to an object of kind PetSet</h3>
|
||||
<h3 id="_watch_changes_to_an_object_of_kind_statefulset">watch changes to an object of kind StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>GET /apis/apps/v1alpha1/watch/namespaces/{namespace}/petsets/{name}</pre>
|
||||
<pre>GET /apis/apps/v1alpha1/watch/namespaces/{namespace}/statefulsets/{name}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -2149,7 +2149,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">PathParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the PetSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">name of the StatefulSet</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
@ -2224,10 +2224,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_watch_individual_changes_to_a_list_of_petset_2">watch individual changes to a list of PetSet</h3>
|
||||
<h3 id="_watch_individual_changes_to_a_list_of_statefulset_2">watch individual changes to a list of StatefulSet</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>GET /apis/apps/v1alpha1/watch/petsets</pre>
|
||||
<pre>GET /apis/apps/v1alpha1/watch/statefulsets</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
@ -2374,7 +2374,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2016-09-22 17:28:35 UTC
|
||||
Last updated 2016-10-26 23:22:35 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -130,11 +130,11 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = expvalidation.ValidateDaemonSet(t)
|
||||
case *apps.PetSet:
|
||||
case *apps.StatefulSet:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = appsvalidation.ValidatePetSet(t)
|
||||
errors = appsvalidation.ValidateStatefulSet(t)
|
||||
default:
|
||||
errors = field.ErrorList{}
|
||||
errors = append(errors, field.InternalError(field.NewPath(""), fmt.Errorf("no validation defined for %#v", obj)))
|
||||
@ -221,7 +221,7 @@ func TestExampleObjectSchemas(t *testing.T) {
|
||||
"cassandra-daemonset": &extensions.DaemonSet{},
|
||||
"cassandra-controller": &api.ReplicationController{},
|
||||
"cassandra-service": &api.Service{},
|
||||
"cassandra-petset": &apps.PetSet{},
|
||||
"cassandra-petset": &apps.StatefulSet{},
|
||||
},
|
||||
"../examples/cluster-dns": {
|
||||
"dns-backend-rc": &api.ReplicationController{},
|
||||
|
@ -180,7 +180,7 @@ of three pods.
|
||||
|
||||
```yaml
|
||||
apiVersion: "apps/v1alpha1"
|
||||
kind: PetSet
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: cassandra
|
||||
spec:
|
||||
|
@ -1,5 +1,5 @@
|
||||
apiVersion: "apps/v1alpha1"
|
||||
kind: PetSet
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: cassandra
|
||||
spec:
|
||||
|
@ -334,7 +334,7 @@ runTests() {
|
||||
hpa_min_field=".spec.minReplicas"
|
||||
hpa_max_field=".spec.maxReplicas"
|
||||
hpa_cpu_field=".spec.targetCPUUtilizationPercentage"
|
||||
petset_replicas_field=".spec.replicas"
|
||||
statefulset_replicas_field=".spec.replicas"
|
||||
job_parallelism_field=".spec.parallelism"
|
||||
deployment_replicas=".spec.replicas"
|
||||
secret_data=".data"
|
||||
@ -1185,7 +1185,7 @@ __EOF__
|
||||
kube::test::if_has_string "${output_message}" "/api/v1/namespaces/default/pods 200 OK"
|
||||
kube::test::if_has_string "${output_message}" "/api/v1/namespaces/default/replicationcontrollers 200 OK"
|
||||
kube::test::if_has_string "${output_message}" "/api/v1/namespaces/default/services 200 OK"
|
||||
kube::test::if_has_string "${output_message}" "/apis/apps/v1alpha1/namespaces/default/petsets 200 OK"
|
||||
kube::test::if_has_string "${output_message}" "/apis/apps/v1alpha1/namespaces/default/statefulsets 200 OK"
|
||||
kube::test::if_has_string "${output_message}" "/apis/autoscaling/v1/namespaces/default/horizontalpodautoscalers 200"
|
||||
kube::test::if_has_string "${output_message}" "/apis/batch/v1/namespaces/default/jobs 200 OK"
|
||||
kube::test::if_has_string "${output_message}" "/apis/extensions/v1beta1/namespaces/default/deployments 200 OK"
|
||||
@ -2396,25 +2396,25 @@ __EOF__
|
||||
|
||||
|
||||
|
||||
############
|
||||
# Pet Sets #
|
||||
############
|
||||
#################
|
||||
# Stateful Sets #
|
||||
#################
|
||||
|
||||
kube::log::status "Testing kubectl(${version}:petsets)"
|
||||
kube::log::status "Testing kubectl(${version}:statefulsets)"
|
||||
|
||||
### Create and stop petset, make sure it doesn't leak pods
|
||||
# Pre-condition: no petset exists
|
||||
kube::test::get_object_assert petset "{{range.items}}{{$id_field}}:{{end}}" ''
|
||||
# Command: create petset
|
||||
### Create and stop statefulset, make sure it doesn't leak pods
|
||||
# Pre-condition: no statefulset exists
|
||||
kube::test::get_object_assert statefulset "{{range.items}}{{$id_field}}:{{end}}" ''
|
||||
# Command: create statefulset
|
||||
kubectl create -f hack/testdata/nginx-petset.yaml "${kube_flags[@]}"
|
||||
|
||||
### Scale petset test with current-replicas and replicas
|
||||
### Scale statefulset test with current-replicas and replicas
|
||||
# Pre-condition: 0 replicas
|
||||
kube::test::get_object_assert 'petset nginx' "{{$petset_replicas_field}}" '0'
|
||||
kube::test::get_object_assert 'statefulset nginx' "{{$statefulset_replicas_field}}" '0'
|
||||
# Command: Scale up
|
||||
kubectl scale --current-replicas=0 --replicas=1 petset nginx "${kube_flags[@]}"
|
||||
kubectl scale --current-replicas=0 --replicas=1 statefulset nginx "${kube_flags[@]}"
|
||||
# Post-condition: 1 replica, named nginx-0
|
||||
kube::test::get_object_assert 'petset nginx' "{{$petset_replicas_field}}" '1'
|
||||
kube::test::get_object_assert 'statefulset nginx' "{{$statefulset_replicas_field}}" '1'
|
||||
# Typically we'd wait and confirm that N>1 replicas are up, but this framework
|
||||
# doesn't start the scheduler, so pet-0 will block all others.
|
||||
# TODO: test robust scaling in an e2e.
|
||||
@ -2422,7 +2422,7 @@ __EOF__
|
||||
|
||||
### Clean up
|
||||
kubectl delete -f hack/testdata/nginx-petset.yaml "${kube_flags[@]}"
|
||||
# Post-condition: no pods from petset controller
|
||||
# Post-condition: no pods from statefulset controller
|
||||
wait-for-pods-with-label "app=nginx-petset" ""
|
||||
|
||||
|
||||
|
2
hack/testdata/nginx-petset.yaml
vendored
2
hack/testdata/nginx-petset.yaml
vendored
@ -17,7 +17,7 @@ spec:
|
||||
app: nginx-petset
|
||||
---
|
||||
apiVersion: apps/v1alpha1
|
||||
kind: PetSet
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: nginx
|
||||
spec:
|
||||
|
@ -77,8 +77,8 @@ func TestDefaulting(t *testing.T) {
|
||||
{Group: "", Version: "v1", Kind: "SecretList"}: {},
|
||||
{Group: "", Version: "v1", Kind: "Service"}: {},
|
||||
{Group: "", Version: "v1", Kind: "ServiceList"}: {},
|
||||
{Group: "apps", Version: "v1alpha1", Kind: "PetSet"}: {},
|
||||
{Group: "apps", Version: "v1alpha1", Kind: "PetSetList"}: {},
|
||||
{Group: "apps", Version: "v1alpha1", Kind: "StatefulSet"}: {},
|
||||
{Group: "apps", Version: "v1alpha1", Kind: "StatefulSetList"}: {},
|
||||
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscaler"}: {},
|
||||
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscalerList"}: {},
|
||||
{Group: "batch", Version: "v1", Kind: "Job"}: {},
|
||||
|
@ -175,7 +175,7 @@ func TestKindForGroupVersionKinds(t *testing.T) {
|
||||
ok: true,
|
||||
},
|
||||
{
|
||||
input: []GroupVersionKind{{Group: "apps", Version: "v1alpha1", Kind: "PetSet"}},
|
||||
input: []GroupVersionKind{{Group: "apps", Version: "v1alpha1", Kind: "StatefulSet"}},
|
||||
target: GroupVersionKind{},
|
||||
ok: false,
|
||||
},
|
||||
|
@ -47,8 +47,8 @@ func Resource(resource string) unversioned.GroupResource {
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
// TODO this will get cleaned up with the scheme types are fixed
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&PetSet{},
|
||||
&PetSetList{},
|
||||
&StatefulSet{},
|
||||
&StatefulSetList{},
|
||||
&api.ListOptions{},
|
||||
&api.DeleteOptions{},
|
||||
)
|
||||
|
@ -75,7 +75,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSet) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *StatefulSet) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -220,7 +220,7 @@ func (x *PetSet) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSet) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *StatefulSet) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -250,7 +250,7 @@ func (x *PetSet) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -293,14 +293,14 @@ func (x *PetSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
case "spec":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Spec = PetSetSpec{}
|
||||
x.Spec = StatefulSetSpec{}
|
||||
} else {
|
||||
yyv24 := &x.Spec
|
||||
yyv24.CodecDecodeSelf(d)
|
||||
}
|
||||
case "status":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = PetSetStatus{}
|
||||
x.Status = StatefulSetStatus{}
|
||||
} else {
|
||||
yyv25 := &x.Status
|
||||
yyv25.CodecDecodeSelf(d)
|
||||
@ -312,7 +312,7 @@ func (x *PetSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -380,7 +380,7 @@ func (x *PetSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Spec = PetSetSpec{}
|
||||
x.Spec = StatefulSetSpec{}
|
||||
} else {
|
||||
yyv30 := &x.Spec
|
||||
yyv30.CodecDecodeSelf(d)
|
||||
@ -397,7 +397,7 @@ func (x *PetSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = PetSetStatus{}
|
||||
x.Status = StatefulSetStatus{}
|
||||
} else {
|
||||
yyv31 := &x.Status
|
||||
yyv31.CodecDecodeSelf(d)
|
||||
@ -418,7 +418,7 @@ func (x *PetSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *StatefulSetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -583,7 +583,7 @@ func (x *PetSetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetSpec) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *StatefulSetSpec) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -613,7 +613,7 @@ func (x *PetSetSpec) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -690,7 +690,7 @@ func (x *PetSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -811,7 +811,7 @@ func (x *PetSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetStatus) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *StatefulSetStatus) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -905,7 +905,7 @@ func (x *PetSetStatus) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetStatus) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *StatefulSetStatus) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -935,7 +935,7 @@ func (x *PetSetStatus) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -986,7 +986,7 @@ func (x *PetSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1051,7 +1051,7 @@ func (x *PetSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *StatefulSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -1172,7 +1172,7 @@ func (x *PetSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
_ = yym101
|
||||
if false {
|
||||
} else {
|
||||
h.encSlicePetSet(([]PetSet)(x.Items), e)
|
||||
h.encSliceStatefulSet(([]StatefulSet)(x.Items), e)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1186,7 +1186,7 @@ func (x *PetSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
_ = yym102
|
||||
if false {
|
||||
} else {
|
||||
h.encSlicePetSet(([]PetSet)(x.Items), e)
|
||||
h.encSliceStatefulSet(([]StatefulSet)(x.Items), e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1199,7 +1199,7 @@ func (x *PetSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetList) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *StatefulSetList) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1229,7 +1229,7 @@ func (x *PetSetList) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1285,7 +1285,7 @@ func (x *PetSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
_ = yym111
|
||||
if false {
|
||||
} else {
|
||||
h.decSlicePetSet((*[]PetSet)(yyv110), d)
|
||||
h.decSliceStatefulSet((*[]StatefulSet)(yyv110), d)
|
||||
}
|
||||
}
|
||||
default:
|
||||
@ -1295,7 +1295,7 @@ func (x *PetSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1376,7 +1376,7 @@ func (x *PetSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
_ = yym118
|
||||
if false {
|
||||
} else {
|
||||
h.decSlicePetSet((*[]PetSet)(yyv117), d)
|
||||
h.decSliceStatefulSet((*[]StatefulSet)(yyv117), d)
|
||||
}
|
||||
}
|
||||
for {
|
||||
@ -1511,7 +1511,7 @@ func (x codecSelfer1234) decSliceapi_PersistentVolumeClaim(v *[]pkg2_api.Persist
|
||||
}
|
||||
}
|
||||
|
||||
func (x codecSelfer1234) encSlicePetSet(v []PetSet, e *codec1978.Encoder) {
|
||||
func (x codecSelfer1234) encSliceStatefulSet(v []StatefulSet, e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -1524,7 +1524,7 @@ func (x codecSelfer1234) encSlicePetSet(v []PetSet, e *codec1978.Encoder) {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
func (x codecSelfer1234) decSliceStatefulSet(v *[]StatefulSet, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1534,7 +1534,7 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
var yyc127 bool
|
||||
if yyl127 == 0 {
|
||||
if yyv127 == nil {
|
||||
yyv127 = []PetSet{}
|
||||
yyv127 = []StatefulSet{}
|
||||
yyc127 = true
|
||||
} else if len(yyv127) != 0 {
|
||||
yyv127 = yyv127[:0]
|
||||
@ -1552,10 +1552,10 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
if yyrl127 <= cap(yyv127) {
|
||||
yyv127 = yyv127[:yyrl127]
|
||||
} else {
|
||||
yyv127 = make([]PetSet, yyrl127)
|
||||
yyv127 = make([]StatefulSet, yyrl127)
|
||||
}
|
||||
} else {
|
||||
yyv127 = make([]PetSet, yyrl127)
|
||||
yyv127 = make([]StatefulSet, yyrl127)
|
||||
}
|
||||
yyc127 = true
|
||||
yyrr127 = len(yyv127)
|
||||
@ -1570,7 +1570,7 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
for ; yyj127 < yyrr127; yyj127++ {
|
||||
yyh127.ElemContainerState(yyj127)
|
||||
if r.TryDecodeAsNil() {
|
||||
yyv127[yyj127] = PetSet{}
|
||||
yyv127[yyj127] = StatefulSet{}
|
||||
} else {
|
||||
yyv128 := &yyv127[yyj127]
|
||||
yyv128.CodecDecodeSelf(d)
|
||||
@ -1579,10 +1579,10 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
}
|
||||
if yyrt127 {
|
||||
for ; yyj127 < yyl127; yyj127++ {
|
||||
yyv127 = append(yyv127, PetSet{})
|
||||
yyv127 = append(yyv127, StatefulSet{})
|
||||
yyh127.ElemContainerState(yyj127)
|
||||
if r.TryDecodeAsNil() {
|
||||
yyv127[yyj127] = PetSet{}
|
||||
yyv127[yyj127] = StatefulSet{}
|
||||
} else {
|
||||
yyv129 := &yyv127[yyj127]
|
||||
yyv129.CodecDecodeSelf(d)
|
||||
@ -1596,13 +1596,13 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
for ; !r.CheckBreak(); yyj127++ {
|
||||
|
||||
if yyj127 >= len(yyv127) {
|
||||
yyv127 = append(yyv127, PetSet{}) // var yyz127 PetSet
|
||||
yyv127 = append(yyv127, StatefulSet{}) // var yyz127 StatefulSet
|
||||
yyc127 = true
|
||||
}
|
||||
yyh127.ElemContainerState(yyj127)
|
||||
if yyj127 < len(yyv127) {
|
||||
if r.TryDecodeAsNil() {
|
||||
yyv127[yyj127] = PetSet{}
|
||||
yyv127[yyj127] = StatefulSet{}
|
||||
} else {
|
||||
yyv130 := &yyv127[yyj127]
|
||||
yyv130.CodecDecodeSelf(d)
|
||||
@ -1617,7 +1617,7 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
yyv127 = yyv127[:yyj127]
|
||||
yyc127 = true
|
||||
} else if yyj127 == 0 && yyv127 == nil {
|
||||
yyv127 = []PetSet{}
|
||||
yyv127 = []StatefulSet{}
|
||||
yyc127 = true
|
||||
}
|
||||
}
|
||||
|
@ -23,30 +23,30 @@ import (
|
||||
|
||||
// +genclient=true
|
||||
|
||||
// PetSet represents a set of pods with consistent identities.
|
||||
// StatefulSet 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 PetSet guarantees that a given network identity will always
|
||||
// map to the same storage identity. PetSet is currently in alpha and
|
||||
// The StatefulSet guarantees that a given network identity will always
|
||||
// map to the same storage identity. StatefulSet is currently in alpha and
|
||||
// and subject to change without notice.
|
||||
type PetSet struct {
|
||||
type StatefulSet struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
api.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Spec defines the desired identities of pets in this set.
|
||||
// Spec defines the desired identities of pods in this set.
|
||||
// +optional
|
||||
Spec PetSetSpec `json:"spec,omitempty"`
|
||||
Spec StatefulSetSpec `json:"spec,omitempty"`
|
||||
|
||||
// Status is the current status of Pets in this PetSet. This data
|
||||
// Status is the current status of Pods in this StatefulSet. This data
|
||||
// may be out of date by some window of time.
|
||||
// +optional
|
||||
Status PetSetStatus `json:"status,omitempty"`
|
||||
Status StatefulSetStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// A PetSetSpec is the specification of a PetSet.
|
||||
type PetSetSpec struct {
|
||||
// A StatefulSetSpec is the specification of a StatefulSet.
|
||||
type StatefulSetSpec struct {
|
||||
// Replicas is the desired number of replicas of the given Template.
|
||||
// These are replicas in the sense that they are instantiations of the
|
||||
// same Template, but individual replicas also have a consistent identity.
|
||||
@ -62,14 +62,14 @@ type PetSetSpec struct {
|
||||
Selector *unversioned.LabelSelector `json:"selector,omitempty"`
|
||||
|
||||
// Template is the object that describes the pod that will be created if
|
||||
// insufficient replicas are detected. Each pod stamped out by the PetSet
|
||||
// insufficient replicas are detected. Each pod stamped out by the StatefulSet
|
||||
// will fulfill this Template, but have a unique identity from the rest
|
||||
// of the PetSet.
|
||||
// of the StatefulSet.
|
||||
Template api.PodTemplateSpec `json:"template"`
|
||||
|
||||
// VolumeClaimTemplates is a list of claims that pets are allowed to reference.
|
||||
// The PetSet controller is responsible for mapping network identities to
|
||||
// claims in a way that maintains the identity of a pet. Every claim in
|
||||
// VolumeClaimTemplates is a list of claims that pods are allowed to reference.
|
||||
// The StatefulSet controller is responsible for mapping network identities to
|
||||
// claims in a way that maintains the identity of a pod. Every claim in
|
||||
// this list must have at least one matching (by name) volumeMount in one
|
||||
// container in the template. A claim in this list takes precedence over
|
||||
// any volumes in the template, with the same name.
|
||||
@ -77,16 +77,16 @@ type PetSetSpec struct {
|
||||
// +optional
|
||||
VolumeClaimTemplates []api.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`
|
||||
|
||||
// ServiceName is the name of the service that governs this PetSet.
|
||||
// This service must exist before the PetSet, and is responsible for
|
||||
// the network identity of the set. Pets get DNS/hostnames that follow the
|
||||
// pattern: pet-specific-string.serviceName.default.svc.cluster.local
|
||||
// where "pet-specific-string" is managed by the PetSet controller.
|
||||
// ServiceName is the name of the service that governs this StatefulSet.
|
||||
// This service must exist before the StatefulSet, and is responsible for
|
||||
// the network identity of the set. Pods get DNS/hostnames that follow the
|
||||
// pattern: pod-specific-string.serviceName.default.svc.cluster.local
|
||||
// where "pod-specific-string" is managed by the StatefulSet controller.
|
||||
ServiceName string `json:"serviceName"`
|
||||
}
|
||||
|
||||
// PetSetStatus represents the current state of a PetSet.
|
||||
type PetSetStatus struct {
|
||||
// StatefulSetStatus represents the current state of a StatefulSet.
|
||||
type StatefulSetStatus struct {
|
||||
// most recent generation observed by this autoscaler.
|
||||
// +optional
|
||||
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
|
||||
@ -95,10 +95,10 @@ type PetSetStatus struct {
|
||||
Replicas int32 `json:"replicas"`
|
||||
}
|
||||
|
||||
// PetSetList is a collection of PetSets.
|
||||
type PetSetList struct {
|
||||
// StatefulSetList is a collection of StatefulSets.
|
||||
type StatefulSetList struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||
Items []PetSet `json:"items"`
|
||||
Items []StatefulSet `json:"items"`
|
||||
}
|
||||
|
@ -33,14 +33,14 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
||||
// it, but a plain int32 is more convenient in the internal type. These
|
||||
// functions are the same as the autogenerated ones in every other way.
|
||||
err := scheme.AddConversionFuncs(
|
||||
Convert_v1alpha1_PetSetSpec_To_apps_PetSetSpec,
|
||||
Convert_apps_PetSetSpec_To_v1alpha1_PetSetSpec,
|
||||
Convert_v1alpha1_StatefulSetSpec_To_apps_StatefulSetSpec,
|
||||
Convert_apps_StatefulSetSpec_To_v1alpha1_StatefulSetSpec,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return api.Scheme.AddFieldLabelConversionFunc("apps/v1alpha1", "PetSet",
|
||||
return api.Scheme.AddFieldLabelConversionFunc("apps/v1alpha1", "StatefulSet",
|
||||
func(label, value string) (string, string, error) {
|
||||
switch label {
|
||||
case "metadata.name", "metadata.namespace", "status.successful":
|
||||
@ -52,7 +52,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
||||
)
|
||||
}
|
||||
|
||||
func Convert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(in *PetSetSpec, out *apps.PetSetSpec, s conversion.Scope) error {
|
||||
func Convert_v1alpha1_StatefulSetSpec_To_apps_StatefulSetSpec(in *StatefulSetSpec, out *apps.StatefulSetSpec, s conversion.Scope) error {
|
||||
if in.Replicas != nil {
|
||||
out.Replicas = *in.Replicas
|
||||
}
|
||||
@ -83,7 +83,7 @@ func Convert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(in *PetSetSpec, out *apps.Pe
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_apps_PetSetSpec_To_v1alpha1_PetSetSpec(in *apps.PetSetSpec, out *PetSetSpec, s conversion.Scope) error {
|
||||
func Convert_apps_StatefulSetSpec_To_v1alpha1_StatefulSetSpec(in *apps.StatefulSetSpec, out *StatefulSetSpec, s conversion.Scope) error {
|
||||
out.Replicas = new(int32)
|
||||
*out.Replicas = in.Replicas
|
||||
if in.Selector != nil {
|
||||
|
@ -24,11 +24,11 @@ import (
|
||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||
RegisterDefaults(scheme)
|
||||
return scheme.AddDefaultingFuncs(
|
||||
SetDefaults_PetSet,
|
||||
SetDefaults_StatefulSet,
|
||||
)
|
||||
}
|
||||
|
||||
func SetDefaults_PetSet(obj *PetSet) {
|
||||
func SetDefaults_StatefulSet(obj *StatefulSet) {
|
||||
labels := obj.Spec.Template.Labels
|
||||
if labels != nil {
|
||||
if obj.Spec.Selector == nil {
|
||||
|
@ -25,10 +25,10 @@ limitations under the License.
|
||||
k8s.io/kubernetes/pkg/apis/apps/v1alpha1/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
PetSet
|
||||
PetSetList
|
||||
PetSetSpec
|
||||
PetSetStatus
|
||||
StatefulSet
|
||||
StatefulSetList
|
||||
StatefulSetSpec
|
||||
StatefulSetStatus
|
||||
*/
|
||||
package v1alpha1
|
||||
|
||||
@ -53,29 +53,29 @@ var _ = math.Inf
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
const _ = proto.GoGoProtoPackageIsVersion1
|
||||
|
||||
func (m *PetSet) Reset() { *m = PetSet{} }
|
||||
func (*PetSet) ProtoMessage() {}
|
||||
func (*PetSet) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
func (m *StatefulSet) Reset() { *m = StatefulSet{} }
|
||||
func (*StatefulSet) ProtoMessage() {}
|
||||
func (*StatefulSet) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *PetSetList) Reset() { *m = PetSetList{} }
|
||||
func (*PetSetList) ProtoMessage() {}
|
||||
func (*PetSetList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||
func (m *StatefulSetList) Reset() { *m = StatefulSetList{} }
|
||||
func (*StatefulSetList) ProtoMessage() {}
|
||||
func (*StatefulSetList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||
|
||||
func (m *PetSetSpec) Reset() { *m = PetSetSpec{} }
|
||||
func (*PetSetSpec) ProtoMessage() {}
|
||||
func (*PetSetSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
|
||||
func (m *StatefulSetSpec) Reset() { *m = StatefulSetSpec{} }
|
||||
func (*StatefulSetSpec) ProtoMessage() {}
|
||||
func (*StatefulSetSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
|
||||
|
||||
func (m *PetSetStatus) Reset() { *m = PetSetStatus{} }
|
||||
func (*PetSetStatus) ProtoMessage() {}
|
||||
func (*PetSetStatus) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{3} }
|
||||
func (m *StatefulSetStatus) Reset() { *m = StatefulSetStatus{} }
|
||||
func (*StatefulSetStatus) ProtoMessage() {}
|
||||
func (*StatefulSetStatus) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{3} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*PetSet)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.PetSet")
|
||||
proto.RegisterType((*PetSetList)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.PetSetList")
|
||||
proto.RegisterType((*PetSetSpec)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.PetSetSpec")
|
||||
proto.RegisterType((*PetSetStatus)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.PetSetStatus")
|
||||
proto.RegisterType((*StatefulSet)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.StatefulSet")
|
||||
proto.RegisterType((*StatefulSetList)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.StatefulSetList")
|
||||
proto.RegisterType((*StatefulSetSpec)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.StatefulSetSpec")
|
||||
proto.RegisterType((*StatefulSetStatus)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.StatefulSetStatus")
|
||||
}
|
||||
func (m *PetSet) Marshal() (data []byte, err error) {
|
||||
func (m *StatefulSet) Marshal() (data []byte, err error) {
|
||||
size := m.Size()
|
||||
data = make([]byte, size)
|
||||
n, err := m.MarshalTo(data)
|
||||
@ -85,7 +85,7 @@ func (m *PetSet) Marshal() (data []byte, err error) {
|
||||
return data[:n], nil
|
||||
}
|
||||
|
||||
func (m *PetSet) MarshalTo(data []byte) (int, error) {
|
||||
func (m *StatefulSet) MarshalTo(data []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
@ -117,7 +117,7 @@ func (m *PetSet) MarshalTo(data []byte) (int, error) {
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *PetSetList) Marshal() (data []byte, err error) {
|
||||
func (m *StatefulSetList) Marshal() (data []byte, err error) {
|
||||
size := m.Size()
|
||||
data = make([]byte, size)
|
||||
n, err := m.MarshalTo(data)
|
||||
@ -127,7 +127,7 @@ func (m *PetSetList) Marshal() (data []byte, err error) {
|
||||
return data[:n], nil
|
||||
}
|
||||
|
||||
func (m *PetSetList) MarshalTo(data []byte) (int, error) {
|
||||
func (m *StatefulSetList) MarshalTo(data []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
@ -155,7 +155,7 @@ func (m *PetSetList) MarshalTo(data []byte) (int, error) {
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *PetSetSpec) Marshal() (data []byte, err error) {
|
||||
func (m *StatefulSetSpec) Marshal() (data []byte, err error) {
|
||||
size := m.Size()
|
||||
data = make([]byte, size)
|
||||
n, err := m.MarshalTo(data)
|
||||
@ -165,7 +165,7 @@ func (m *PetSetSpec) Marshal() (data []byte, err error) {
|
||||
return data[:n], nil
|
||||
}
|
||||
|
||||
func (m *PetSetSpec) MarshalTo(data []byte) (int, error) {
|
||||
func (m *StatefulSetSpec) MarshalTo(data []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
@ -212,7 +212,7 @@ func (m *PetSetSpec) MarshalTo(data []byte) (int, error) {
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *PetSetStatus) Marshal() (data []byte, err error) {
|
||||
func (m *StatefulSetStatus) Marshal() (data []byte, err error) {
|
||||
size := m.Size()
|
||||
data = make([]byte, size)
|
||||
n, err := m.MarshalTo(data)
|
||||
@ -222,7 +222,7 @@ func (m *PetSetStatus) Marshal() (data []byte, err error) {
|
||||
return data[:n], nil
|
||||
}
|
||||
|
||||
func (m *PetSetStatus) MarshalTo(data []byte) (int, error) {
|
||||
func (m *StatefulSetStatus) MarshalTo(data []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
@ -265,7 +265,7 @@ func encodeVarintGenerated(data []byte, offset int, v uint64) int {
|
||||
data[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *PetSet) Size() (n int) {
|
||||
func (m *StatefulSet) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
l = m.ObjectMeta.Size()
|
||||
@ -277,7 +277,7 @@ func (m *PetSet) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *PetSetList) Size() (n int) {
|
||||
func (m *StatefulSetList) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
l = m.ListMeta.Size()
|
||||
@ -291,7 +291,7 @@ func (m *PetSetList) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *PetSetSpec) Size() (n int) {
|
||||
func (m *StatefulSetSpec) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.Replicas != nil {
|
||||
@ -314,7 +314,7 @@ func (m *PetSetSpec) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *PetSetStatus) Size() (n int) {
|
||||
func (m *StatefulSetStatus) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.ObservedGeneration != nil {
|
||||
@ -337,34 +337,34 @@ func sovGenerated(x uint64) (n int) {
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (this *PetSet) String() string {
|
||||
func (this *StatefulSet) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PetSet{`,
|
||||
s := strings.Join([]string{`&StatefulSet{`,
|
||||
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
|
||||
`Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "PetSetSpec", "PetSetSpec", 1), `&`, ``, 1) + `,`,
|
||||
`Status:` + strings.Replace(strings.Replace(this.Status.String(), "PetSetStatus", "PetSetStatus", 1), `&`, ``, 1) + `,`,
|
||||
`Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "StatefulSetSpec", "StatefulSetSpec", 1), `&`, ``, 1) + `,`,
|
||||
`Status:` + strings.Replace(strings.Replace(this.Status.String(), "StatefulSetStatus", "StatefulSetStatus", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *PetSetList) String() string {
|
||||
func (this *StatefulSetList) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PetSetList{`,
|
||||
s := strings.Join([]string{`&StatefulSetList{`,
|
||||
`ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_kubernetes_pkg_api_unversioned.ListMeta", 1), `&`, ``, 1) + `,`,
|
||||
`Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "PetSet", "PetSet", 1), `&`, ``, 1) + `,`,
|
||||
`Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "StatefulSet", "StatefulSet", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *PetSetSpec) String() string {
|
||||
func (this *StatefulSetSpec) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PetSetSpec{`,
|
||||
s := strings.Join([]string{`&StatefulSetSpec{`,
|
||||
`Replicas:` + valueToStringGenerated(this.Replicas) + `,`,
|
||||
`Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "k8s_io_kubernetes_pkg_api_unversioned.LabelSelector", 1) + `,`,
|
||||
`Template:` + strings.Replace(strings.Replace(this.Template.String(), "PodTemplateSpec", "k8s_io_kubernetes_pkg_api_v1.PodTemplateSpec", 1), `&`, ``, 1) + `,`,
|
||||
@ -374,11 +374,11 @@ func (this *PetSetSpec) String() string {
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *PetSetStatus) String() string {
|
||||
func (this *StatefulSetStatus) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PetSetStatus{`,
|
||||
s := strings.Join([]string{`&StatefulSetStatus{`,
|
||||
`ObservedGeneration:` + valueToStringGenerated(this.ObservedGeneration) + `,`,
|
||||
`Replicas:` + fmt.Sprintf("%v", this.Replicas) + `,`,
|
||||
`}`,
|
||||
@ -393,7 +393,7 @@ func valueToStringGenerated(v interface{}) string {
|
||||
pv := reflect.Indirect(rv).Interface()
|
||||
return fmt.Sprintf("*%v", pv)
|
||||
}
|
||||
func (m *PetSet) Unmarshal(data []byte) error {
|
||||
func (m *StatefulSet) Unmarshal(data []byte) error {
|
||||
l := len(data)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
@ -416,10 +416,10 @@ func (m *PetSet) Unmarshal(data []byte) error {
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PetSet: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: StatefulSet: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PetSet: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: StatefulSet: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
@ -533,7 +533,7 @@ func (m *PetSet) Unmarshal(data []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PetSetList) Unmarshal(data []byte) error {
|
||||
func (m *StatefulSetList) Unmarshal(data []byte) error {
|
||||
l := len(data)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
@ -556,10 +556,10 @@ func (m *PetSetList) Unmarshal(data []byte) error {
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PetSetList: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: StatefulSetList: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PetSetList: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: StatefulSetList: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
@ -618,7 +618,7 @@ func (m *PetSetList) Unmarshal(data []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Items = append(m.Items, PetSet{})
|
||||
m.Items = append(m.Items, StatefulSet{})
|
||||
if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -644,7 +644,7 @@ func (m *PetSetList) Unmarshal(data []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PetSetSpec) Unmarshal(data []byte) error {
|
||||
func (m *StatefulSetSpec) Unmarshal(data []byte) error {
|
||||
l := len(data)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
@ -667,10 +667,10 @@ func (m *PetSetSpec) Unmarshal(data []byte) error {
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PetSetSpec: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: StatefulSetSpec: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PetSetSpec: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: StatefulSetSpec: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
@ -837,7 +837,7 @@ func (m *PetSetSpec) Unmarshal(data []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PetSetStatus) Unmarshal(data []byte) error {
|
||||
func (m *StatefulSetStatus) Unmarshal(data []byte) error {
|
||||
l := len(data)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
@ -860,10 +860,10 @@ func (m *PetSetStatus) Unmarshal(data []byte) error {
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PetSetStatus: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: StatefulSetStatus: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PetSetStatus: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: StatefulSetStatus: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
@ -1032,44 +1032,45 @@ var (
|
||||
)
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 619 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x93, 0xcf, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0xc6, 0xe3, 0xa4, 0xa9, 0xc2, 0xa6, 0x20, 0xb4, 0x54, 0x28, 0x8a, 0x90, 0x5b, 0xe5, 0x14,
|
||||
0xa1, 0x76, 0x4d, 0x0a, 0x45, 0x3d, 0x1b, 0x09, 0x84, 0x04, 0xb4, 0x72, 0xa0, 0x42, 0x20, 0x2a,
|
||||
0xad, 0x9d, 0xc1, 0x5d, 0x62, 0x7b, 0x2d, 0xef, 0xda, 0x67, 0x0e, 0x70, 0xe7, 0xcc, 0x63, 0xf0,
|
||||
0x08, 0x9c, 0x7a, 0xec, 0x91, 0x53, 0x45, 0xcd, 0x8b, 0x20, 0xaf, 0xff, 0x24, 0xd4, 0x49, 0x4b,
|
||||
0x6f, 0x99, 0xf5, 0x7c, 0xbf, 0x99, 0xf9, 0x66, 0x82, 0xf6, 0xa6, 0x7b, 0x82, 0x30, 0x6e, 0x4c,
|
||||
0x63, 0x1b, 0xa2, 0x00, 0x24, 0x08, 0x23, 0x9c, 0xba, 0x06, 0x0d, 0x99, 0x30, 0x68, 0x18, 0x0a,
|
||||
0x23, 0x19, 0x51, 0x2f, 0x3c, 0xa6, 0x23, 0xc3, 0x85, 0x00, 0x22, 0x2a, 0x61, 0x42, 0xc2, 0x88,
|
||||
0x4b, 0x8e, 0x87, 0xb9, 0x92, 0xcc, 0x94, 0x24, 0x9c, 0xba, 0x24, 0x53, 0x92, 0x4c, 0x49, 0x4a,
|
||||
0x65, 0x7f, 0xdb, 0x65, 0xf2, 0x38, 0xb6, 0x89, 0xc3, 0x7d, 0xc3, 0xe5, 0x2e, 0x37, 0x14, 0xc0,
|
||||
0x8e, 0x3f, 0xaa, 0x48, 0x05, 0xea, 0x57, 0x0e, 0xee, 0xef, 0x2c, 0x6d, 0xc9, 0x88, 0x40, 0xf0,
|
||||
0x38, 0x72, 0xe0, 0x62, 0x33, 0xfd, 0xdd, 0xe5, 0x9a, 0x38, 0x48, 0x20, 0x12, 0x8c, 0x07, 0x30,
|
||||
0xa9, 0xc9, 0xb6, 0x96, 0xcb, 0x92, 0xda, 0xc4, 0xfd, 0xed, 0xc5, 0xd9, 0x51, 0x1c, 0x48, 0xe6,
|
||||
0xd7, 0x7b, 0x1a, 0x2d, 0x4e, 0x8f, 0x25, 0xf3, 0x0c, 0x16, 0x48, 0x21, 0xa3, 0x8b, 0x92, 0xc1,
|
||||
0xf7, 0x26, 0x5a, 0x3d, 0x00, 0x39, 0x06, 0x89, 0xdf, 0xa2, 0x8e, 0x0f, 0x92, 0x4e, 0xa8, 0xa4,
|
||||
0x3d, 0x6d, 0x53, 0x1b, 0x76, 0x77, 0x86, 0x64, 0xa9, 0xe3, 0x24, 0x19, 0x91, 0x7d, 0xfb, 0x13,
|
||||
0x38, 0xf2, 0x25, 0x48, 0x6a, 0xe2, 0x93, 0xb3, 0x8d, 0x46, 0x7a, 0xb6, 0x81, 0x66, 0x6f, 0x56,
|
||||
0x45, 0xc3, 0x87, 0x68, 0x45, 0x84, 0xe0, 0xf4, 0x9a, 0x8a, 0xfa, 0x88, 0xfc, 0xef, 0x1e, 0x49,
|
||||
0xde, 0xd9, 0x38, 0x04, 0xc7, 0x5c, 0x2b, 0x2a, 0xac, 0x64, 0x91, 0xa5, 0x78, 0xf8, 0x08, 0xad,
|
||||
0x0a, 0x49, 0x65, 0x2c, 0x7a, 0x2d, 0x45, 0x7e, 0x7c, 0x6d, 0xb2, 0x52, 0x9b, 0xb7, 0x0a, 0xf6,
|
||||
0x6a, 0x1e, 0x5b, 0x05, 0x75, 0xf0, 0x53, 0x43, 0x28, 0x4f, 0x7c, 0xc1, 0x84, 0xc4, 0x1f, 0x6a,
|
||||
0x06, 0x19, 0x97, 0x18, 0x34, 0x77, 0x05, 0x24, 0x93, 0x2b, 0x9f, 0x6e, 0x17, 0x95, 0x3a, 0xe5,
|
||||
0xcb, 0x9c, 0x4b, 0x6f, 0x50, 0x9b, 0x49, 0xf0, 0x45, 0xaf, 0xb9, 0xd9, 0x1a, 0x76, 0x77, 0x1e,
|
||||
0x5c, 0x77, 0x18, 0xf3, 0x66, 0x01, 0x6f, 0x3f, 0xcf, 0x30, 0x56, 0x4e, 0x1b, 0xfc, 0x68, 0x95,
|
||||
0x43, 0x64, 0xce, 0xe1, 0x21, 0xea, 0x44, 0x10, 0x7a, 0xcc, 0xa1, 0x42, 0x0d, 0xd1, 0x36, 0xd7,
|
||||
0xb2, 0x7e, 0xac, 0xe2, 0xcd, 0xaa, 0xbe, 0xe2, 0x23, 0xd4, 0x11, 0xe0, 0x81, 0x23, 0x79, 0x74,
|
||||
0xf5, 0xe6, 0xfe, 0x1d, 0x97, 0xda, 0xe0, 0x8d, 0x0b, 0x6d, 0xce, 0x2f, 0x23, 0xab, 0x62, 0xe2,
|
||||
0xf7, 0xa8, 0x23, 0xc1, 0x0f, 0x3d, 0x2a, 0xa1, 0xd8, 0xdf, 0xf6, 0xe5, 0xf7, 0x76, 0xc0, 0x27,
|
||||
0xaf, 0x0b, 0x81, 0x3a, 0x89, 0xca, 0xcc, 0xf2, 0xd5, 0xaa, 0x80, 0xf8, 0xab, 0x86, 0xd6, 0x13,
|
||||
0xee, 0xc5, 0x3e, 0x3c, 0xf1, 0x28, 0xf3, 0xcb, 0x0c, 0xd1, 0x5b, 0x51, 0xe6, 0x3e, 0xbc, 0xa2,
|
||||
0x52, 0x36, 0x8a, 0x90, 0x10, 0xc8, 0xc3, 0x19, 0xc3, 0xbc, 0x57, 0xd4, 0x5b, 0x3f, 0x5c, 0x00,
|
||||
0xb6, 0x16, 0x96, 0xc3, 0xbb, 0xa8, 0x2b, 0x20, 0x4a, 0x98, 0x03, 0xaf, 0xa8, 0x0f, 0xbd, 0xf6,
|
||||
0xa6, 0x36, 0xbc, 0x61, 0xde, 0x29, 0x40, 0xdd, 0xf1, 0xec, 0x93, 0x35, 0x9f, 0x37, 0xf8, 0xa2,
|
||||
0xa1, 0xb5, 0xf9, 0x13, 0xc5, 0x4f, 0x11, 0xe6, 0x76, 0x96, 0x01, 0x93, 0x67, 0xf9, 0x5f, 0x98,
|
||||
0xf1, 0x40, 0x2d, 0xb0, 0x65, 0xde, 0x4d, 0xcf, 0x36, 0xf0, 0x7e, 0xed, 0xab, 0xb5, 0x40, 0x81,
|
||||
0xb7, 0xe6, 0xd6, 0xdf, 0x54, 0xeb, 0xaf, 0x5c, 0xac, 0x9f, 0x80, 0x79, 0xff, 0xe4, 0x5c, 0x6f,
|
||||
0x9c, 0x9e, 0xeb, 0x8d, 0x5f, 0xe7, 0x7a, 0xe3, 0x73, 0xaa, 0x6b, 0x27, 0xa9, 0xae, 0x9d, 0xa6,
|
||||
0xba, 0xf6, 0x3b, 0xd5, 0xb5, 0x6f, 0x7f, 0xf4, 0xc6, 0xbb, 0x4e, 0x79, 0x84, 0x7f, 0x03, 0x00,
|
||||
0x00, 0xff, 0xff, 0x14, 0xcf, 0x45, 0x01, 0xd8, 0x05, 0x00, 0x00,
|
||||
// 628 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x93, 0xcd, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0xc7, 0xe3, 0xa4, 0xa9, 0xc2, 0xa6, 0x7c, 0x2d, 0x15, 0x8a, 0x22, 0xe4, 0x56, 0x39, 0x45,
|
||||
0xa8, 0x5d, 0x2b, 0x85, 0x4a, 0x45, 0xdc, 0x8c, 0x04, 0x42, 0x02, 0x8a, 0x1c, 0x54, 0xa1, 0x56,
|
||||
0x20, 0x6d, 0x9c, 0x69, 0xba, 0xc4, 0xf6, 0x5a, 0xde, 0x71, 0xce, 0x5c, 0x38, 0x70, 0xe3, 0x35,
|
||||
0x78, 0x02, 0x5e, 0xa1, 0x07, 0x0e, 0x3d, 0x72, 0xaa, 0x48, 0x78, 0x11, 0xe4, 0xcd, 0xe6, 0x83,
|
||||
0x3a, 0x29, 0x55, 0x6f, 0x9e, 0xdd, 0xf9, 0xff, 0x66, 0xe6, 0xbf, 0x63, 0xb2, 0xd7, 0xdf, 0x53,
|
||||
0x4c, 0x48, 0xa7, 0x9f, 0x76, 0x20, 0x89, 0x00, 0x41, 0x39, 0x71, 0xbf, 0xe7, 0xf0, 0x58, 0x28,
|
||||
0x87, 0xc7, 0xb1, 0x72, 0x06, 0x2d, 0x1e, 0xc4, 0x27, 0xbc, 0xe5, 0xf4, 0x20, 0x82, 0x84, 0x23,
|
||||
0x74, 0x59, 0x9c, 0x48, 0x94, 0xb4, 0x39, 0x56, 0xb2, 0x99, 0x92, 0xc5, 0xfd, 0x1e, 0xcb, 0x94,
|
||||
0x2c, 0x53, 0xb2, 0x89, 0xb2, 0xbe, 0xdd, 0x13, 0x78, 0x92, 0x76, 0x98, 0x2f, 0x43, 0xa7, 0x27,
|
||||
0x7b, 0xd2, 0xd1, 0x80, 0x4e, 0x7a, 0xac, 0x23, 0x1d, 0xe8, 0xaf, 0x31, 0xb8, 0xbe, 0xb3, 0xb4,
|
||||
0x25, 0x27, 0x01, 0x25, 0xd3, 0xc4, 0x87, 0x8b, 0xcd, 0xd4, 0x77, 0x97, 0x6b, 0xd2, 0x68, 0x00,
|
||||
0x89, 0x12, 0x32, 0x82, 0x6e, 0x4e, 0xb6, 0xb5, 0x5c, 0x36, 0xc8, 0x4d, 0x5c, 0xdf, 0x5e, 0x9c,
|
||||
0x9d, 0xa4, 0x11, 0x8a, 0x30, 0xdf, 0x53, 0x6b, 0x71, 0x7a, 0x8a, 0x22, 0x70, 0x44, 0x84, 0x0a,
|
||||
0x93, 0x8b, 0x92, 0xc6, 0xf7, 0x22, 0xa9, 0xb6, 0x91, 0x23, 0x1c, 0xa7, 0x41, 0x1b, 0x90, 0xbe,
|
||||
0x27, 0x95, 0x10, 0x90, 0x77, 0x39, 0xf2, 0x9a, 0xb5, 0x69, 0x35, 0xab, 0x3b, 0x4d, 0xb6, 0xd4,
|
||||
0x76, 0x36, 0x68, 0xb1, 0xfd, 0xce, 0x27, 0xf0, 0xf1, 0x35, 0x20, 0x77, 0xe9, 0xe9, 0xf9, 0x46,
|
||||
0x61, 0x74, 0xbe, 0x41, 0x66, 0x67, 0xde, 0x94, 0x46, 0x8f, 0xc8, 0x8a, 0x8a, 0xc1, 0xaf, 0x15,
|
||||
0x35, 0xf5, 0x09, 0xbb, 0xea, 0x63, 0xb2, 0xb9, 0xf6, 0xda, 0x31, 0xf8, 0xee, 0x9a, 0x29, 0xb3,
|
||||
0x92, 0x45, 0x9e, 0x86, 0x52, 0x9f, 0xac, 0x2a, 0xe4, 0x98, 0xaa, 0x5a, 0x49, 0xe3, 0x9f, 0x5e,
|
||||
0x0f, 0xaf, 0x11, 0xee, 0x2d, 0x53, 0x60, 0x75, 0x1c, 0x7b, 0x06, 0xdd, 0xf8, 0x69, 0x91, 0xdb,
|
||||
0x73, 0xd9, 0xaf, 0x84, 0x42, 0xfa, 0x21, 0xe7, 0x97, 0x73, 0x89, 0x5f, 0x73, 0x9b, 0xc1, 0x32,
|
||||
0xb9, 0xb6, 0xed, 0x8e, 0x29, 0x57, 0x99, 0x9c, 0xcc, 0x99, 0x76, 0x48, 0xca, 0x02, 0x21, 0x54,
|
||||
0xb5, 0xe2, 0x66, 0xa9, 0x59, 0xdd, 0xd9, 0xbd, 0xd6, 0x58, 0xee, 0x4d, 0x53, 0xa1, 0xfc, 0x32,
|
||||
0x63, 0x79, 0x63, 0x64, 0xe3, 0x47, 0xe9, 0x9f, 0x71, 0x32, 0x37, 0x69, 0x93, 0x54, 0x12, 0x88,
|
||||
0x03, 0xe1, 0x73, 0xa5, 0xc7, 0x29, 0xbb, 0x6b, 0x59, 0x67, 0x9e, 0x39, 0xf3, 0xa6, 0xb7, 0xf4,
|
||||
0x23, 0xa9, 0x28, 0x08, 0xc0, 0x47, 0x99, 0x98, 0x27, 0x7d, 0x7c, 0xd5, 0xc1, 0x79, 0x07, 0x82,
|
||||
0xb6, 0xd1, 0x8e, 0xf9, 0x93, 0xc8, 0x9b, 0x32, 0xe9, 0x11, 0xa9, 0x20, 0x84, 0x71, 0xc0, 0x11,
|
||||
0xcc, 0x9b, 0x6e, 0x5f, 0xbe, 0x88, 0x6f, 0x65, 0xf7, 0x9d, 0x11, 0xe8, 0x35, 0x99, 0xda, 0x3a,
|
||||
0x39, 0xf5, 0xa6, 0x40, 0xfa, 0xc5, 0x22, 0xeb, 0x03, 0x19, 0xa4, 0x21, 0x3c, 0x0b, 0xb8, 0x08,
|
||||
0x27, 0x19, 0xaa, 0xb6, 0xa2, 0x6d, 0x7e, 0xf4, 0x9f, 0x4a, 0xd9, 0x28, 0x0a, 0x21, 0xc2, 0x83,
|
||||
0x19, 0xc3, 0x7d, 0x60, 0xea, 0xad, 0x1f, 0x2c, 0x00, 0x7b, 0x0b, 0xcb, 0xd1, 0x5d, 0x52, 0x55,
|
||||
0x90, 0x0c, 0x84, 0x0f, 0x6f, 0x78, 0x08, 0xb5, 0xf2, 0xa6, 0xd5, 0xbc, 0xe1, 0xde, 0x33, 0xa0,
|
||||
0x6a, 0x7b, 0x76, 0xe5, 0xcd, 0xe7, 0x35, 0xbe, 0x5a, 0xe4, 0x6e, 0x6e, 0x6d, 0xe9, 0x73, 0x42,
|
||||
0x65, 0x27, 0x4b, 0x83, 0xee, 0x8b, 0xf1, 0x5f, 0x2e, 0x64, 0xa4, 0x5f, 0xb1, 0xe4, 0xde, 0x1f,
|
||||
0x9d, 0x6f, 0xd0, 0xfd, 0xdc, 0xad, 0xb7, 0x40, 0x41, 0xb7, 0xe6, 0x76, 0xa0, 0xa8, 0x77, 0x60,
|
||||
0x6a, 0x65, 0x7e, 0x0f, 0xdc, 0x87, 0xa7, 0x43, 0xbb, 0x70, 0x36, 0xb4, 0x0b, 0xbf, 0x86, 0x76,
|
||||
0xe1, 0xf3, 0xc8, 0xb6, 0x4e, 0x47, 0xb6, 0x75, 0x36, 0xb2, 0xad, 0xdf, 0x23, 0xdb, 0xfa, 0xf6,
|
||||
0xc7, 0x2e, 0x1c, 0x56, 0x26, 0x3b, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, 0x02, 0xea, 0x1a, 0x59,
|
||||
0xfb, 0x05, 0x00, 0x00,
|
||||
}
|
||||
|
@ -30,37 +30,37 @@ import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1alpha1";
|
||||
|
||||
// PetSet represents a set of pods with consistent identities.
|
||||
// StatefulSet 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 PetSet guarantees that a given network identity will always
|
||||
// map to the same storage identity. PetSet is currently in alpha
|
||||
// The StatefulSet guarantees that a given network identity will always
|
||||
// map to the same storage identity. StatefulSet is currently in alpha
|
||||
// and subject to change without notice.
|
||||
message PetSet {
|
||||
message StatefulSet {
|
||||
// +optional
|
||||
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec defines the desired identities of pets in this set.
|
||||
// Spec defines the desired identities of pods in this set.
|
||||
// +optional
|
||||
optional PetSetSpec spec = 2;
|
||||
optional StatefulSetSpec spec = 2;
|
||||
|
||||
// Status is the current status of Pets in this PetSet. This data
|
||||
// Status is the current status of Pods in this StatefulSet. This data
|
||||
// may be out of date by some window of time.
|
||||
// +optional
|
||||
optional PetSetStatus status = 3;
|
||||
optional StatefulSetStatus status = 3;
|
||||
}
|
||||
|
||||
// PetSetList is a collection of PetSets.
|
||||
message PetSetList {
|
||||
// StatefulSetList is a collection of StatefulSets.
|
||||
message StatefulSetList {
|
||||
// +optional
|
||||
optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1;
|
||||
|
||||
repeated PetSet items = 2;
|
||||
repeated StatefulSet items = 2;
|
||||
}
|
||||
|
||||
// A PetSetSpec is the specification of a PetSet.
|
||||
message PetSetSpec {
|
||||
// A StatefulSetSpec is the specification of a StatefulSet.
|
||||
message StatefulSetSpec {
|
||||
// Replicas is the desired number of replicas of the given Template.
|
||||
// These are replicas in the sense that they are instantiations of the
|
||||
// same Template, but individual replicas also have a consistent identity.
|
||||
@ -76,14 +76,14 @@ message PetSetSpec {
|
||||
optional k8s.io.kubernetes.pkg.api.unversioned.LabelSelector selector = 2;
|
||||
|
||||
// Template is the object that describes the pod that will be created if
|
||||
// insufficient replicas are detected. Each pod stamped out by the PetSet
|
||||
// insufficient replicas are detected. Each pod stamped out by the StatefulSet
|
||||
// will fulfill this Template, but have a unique identity from the rest
|
||||
// of the PetSet.
|
||||
// of the StatefulSet.
|
||||
optional k8s.io.kubernetes.pkg.api.v1.PodTemplateSpec template = 3;
|
||||
|
||||
// VolumeClaimTemplates is a list of claims that pets are allowed to reference.
|
||||
// The PetSet controller is responsible for mapping network identities to
|
||||
// claims in a way that maintains the identity of a pet. Every claim in
|
||||
// VolumeClaimTemplates is a list of claims that pods are allowed to reference.
|
||||
// The StatefulSet controller is responsible for mapping network identities to
|
||||
// claims in a way that maintains the identity of a pod. Every claim in
|
||||
// this list must have at least one matching (by name) volumeMount in one
|
||||
// container in the template. A claim in this list takes precedence over
|
||||
// any volumes in the template, with the same name.
|
||||
@ -91,16 +91,16 @@ message PetSetSpec {
|
||||
// +optional
|
||||
repeated k8s.io.kubernetes.pkg.api.v1.PersistentVolumeClaim volumeClaimTemplates = 4;
|
||||
|
||||
// ServiceName is the name of the service that governs this PetSet.
|
||||
// This service must exist before the PetSet, and is responsible for
|
||||
// the network identity of the set. Pets get DNS/hostnames that follow the
|
||||
// pattern: pet-specific-string.serviceName.default.svc.cluster.local
|
||||
// where "pet-specific-string" is managed by the PetSet controller.
|
||||
// ServiceName is the name of the service that governs this StatefulSet.
|
||||
// This service must exist before the StatefulSet, and is responsible for
|
||||
// the network identity of the set. Pods get DNS/hostnames that follow the
|
||||
// pattern: pod-specific-string.serviceName.default.svc.cluster.local
|
||||
// where "pod-specific-string" is managed by the StatefulSet controller.
|
||||
optional string serviceName = 5;
|
||||
}
|
||||
|
||||
// PetSetStatus represents the current state of a PetSet.
|
||||
message PetSetStatus {
|
||||
// StatefulSetStatus represents the current state of a StatefulSet.
|
||||
message StatefulSetStatus {
|
||||
// most recent generation observed by this autoscaler.
|
||||
// +optional
|
||||
optional int64 observedGeneration = 1;
|
||||
|
@ -37,8 +37,8 @@ var (
|
||||
// Adds the list of known types to api.Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&PetSet{},
|
||||
&PetSetList{},
|
||||
&StatefulSet{},
|
||||
&StatefulSetList{},
|
||||
&v1.ListOptions{},
|
||||
&v1.DeleteOptions{},
|
||||
)
|
||||
@ -46,5 +46,5 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (obj *PetSet) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
|
||||
func (obj *PetSetList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
|
||||
func (obj *StatefulSet) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
|
||||
func (obj *StatefulSetList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
|
||||
|
@ -75,7 +75,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSet) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *StatefulSet) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -220,7 +220,7 @@ func (x *PetSet) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSet) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *StatefulSet) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -250,7 +250,7 @@ func (x *PetSet) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -293,14 +293,14 @@ func (x *PetSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
case "spec":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Spec = PetSetSpec{}
|
||||
x.Spec = StatefulSetSpec{}
|
||||
} else {
|
||||
yyv24 := &x.Spec
|
||||
yyv24.CodecDecodeSelf(d)
|
||||
}
|
||||
case "status":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = PetSetStatus{}
|
||||
x.Status = StatefulSetStatus{}
|
||||
} else {
|
||||
yyv25 := &x.Status
|
||||
yyv25.CodecDecodeSelf(d)
|
||||
@ -312,7 +312,7 @@ func (x *PetSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -380,7 +380,7 @@ func (x *PetSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Spec = PetSetSpec{}
|
||||
x.Spec = StatefulSetSpec{}
|
||||
} else {
|
||||
yyv30 := &x.Spec
|
||||
yyv30.CodecDecodeSelf(d)
|
||||
@ -397,7 +397,7 @@ func (x *PetSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = PetSetStatus{}
|
||||
x.Status = StatefulSetStatus{}
|
||||
} else {
|
||||
yyv31 := &x.Status
|
||||
yyv31.CodecDecodeSelf(d)
|
||||
@ -418,7 +418,7 @@ func (x *PetSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *StatefulSetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -593,7 +593,7 @@ func (x *PetSetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetSpec) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *StatefulSetSpec) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -623,7 +623,7 @@ func (x *PetSetSpec) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -710,7 +710,7 @@ func (x *PetSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -841,7 +841,7 @@ func (x *PetSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetStatus) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *StatefulSetStatus) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -935,7 +935,7 @@ func (x *PetSetStatus) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetStatus) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *StatefulSetStatus) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -965,7 +965,7 @@ func (x *PetSetStatus) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1016,7 +1016,7 @@ func (x *PetSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1081,7 +1081,7 @@ func (x *PetSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *StatefulSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -1202,7 +1202,7 @@ func (x *PetSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
_ = yym105
|
||||
if false {
|
||||
} else {
|
||||
h.encSlicePetSet(([]PetSet)(x.Items), e)
|
||||
h.encSliceStatefulSet(([]StatefulSet)(x.Items), e)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1216,7 +1216,7 @@ func (x *PetSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
_ = yym106
|
||||
if false {
|
||||
} else {
|
||||
h.encSlicePetSet(([]PetSet)(x.Items), e)
|
||||
h.encSliceStatefulSet(([]StatefulSet)(x.Items), e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1229,7 +1229,7 @@ func (x *PetSetList) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetList) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *StatefulSetList) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1259,7 +1259,7 @@ func (x *PetSetList) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PetSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1315,7 +1315,7 @@ func (x *PetSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
_ = yym115
|
||||
if false {
|
||||
} else {
|
||||
h.decSlicePetSet((*[]PetSet)(yyv114), d)
|
||||
h.decSliceStatefulSet((*[]StatefulSet)(yyv114), d)
|
||||
}
|
||||
}
|
||||
default:
|
||||
@ -1325,7 +1325,7 @@ func (x *PetSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *PetSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *StatefulSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1406,7 +1406,7 @@ func (x *PetSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
_ = yym122
|
||||
if false {
|
||||
} else {
|
||||
h.decSlicePetSet((*[]PetSet)(yyv121), d)
|
||||
h.decSliceStatefulSet((*[]StatefulSet)(yyv121), d)
|
||||
}
|
||||
}
|
||||
for {
|
||||
@ -1541,7 +1541,7 @@ func (x codecSelfer1234) decSlicev1_PersistentVolumeClaim(v *[]pkg2_v1.Persisten
|
||||
}
|
||||
}
|
||||
|
||||
func (x codecSelfer1234) encSlicePetSet(v []PetSet, e *codec1978.Encoder) {
|
||||
func (x codecSelfer1234) encSliceStatefulSet(v []StatefulSet, e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@ -1554,7 +1554,7 @@ func (x codecSelfer1234) encSlicePetSet(v []PetSet, e *codec1978.Encoder) {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
func (x codecSelfer1234) decSliceStatefulSet(v *[]StatefulSet, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@ -1564,7 +1564,7 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
var yyc131 bool
|
||||
if yyl131 == 0 {
|
||||
if yyv131 == nil {
|
||||
yyv131 = []PetSet{}
|
||||
yyv131 = []StatefulSet{}
|
||||
yyc131 = true
|
||||
} else if len(yyv131) != 0 {
|
||||
yyv131 = yyv131[:0]
|
||||
@ -1582,10 +1582,10 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
if yyrl131 <= cap(yyv131) {
|
||||
yyv131 = yyv131[:yyrl131]
|
||||
} else {
|
||||
yyv131 = make([]PetSet, yyrl131)
|
||||
yyv131 = make([]StatefulSet, yyrl131)
|
||||
}
|
||||
} else {
|
||||
yyv131 = make([]PetSet, yyrl131)
|
||||
yyv131 = make([]StatefulSet, yyrl131)
|
||||
}
|
||||
yyc131 = true
|
||||
yyrr131 = len(yyv131)
|
||||
@ -1600,7 +1600,7 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
for ; yyj131 < yyrr131; yyj131++ {
|
||||
yyh131.ElemContainerState(yyj131)
|
||||
if r.TryDecodeAsNil() {
|
||||
yyv131[yyj131] = PetSet{}
|
||||
yyv131[yyj131] = StatefulSet{}
|
||||
} else {
|
||||
yyv132 := &yyv131[yyj131]
|
||||
yyv132.CodecDecodeSelf(d)
|
||||
@ -1609,10 +1609,10 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
}
|
||||
if yyrt131 {
|
||||
for ; yyj131 < yyl131; yyj131++ {
|
||||
yyv131 = append(yyv131, PetSet{})
|
||||
yyv131 = append(yyv131, StatefulSet{})
|
||||
yyh131.ElemContainerState(yyj131)
|
||||
if r.TryDecodeAsNil() {
|
||||
yyv131[yyj131] = PetSet{}
|
||||
yyv131[yyj131] = StatefulSet{}
|
||||
} else {
|
||||
yyv133 := &yyv131[yyj131]
|
||||
yyv133.CodecDecodeSelf(d)
|
||||
@ -1626,13 +1626,13 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
for ; !r.CheckBreak(); yyj131++ {
|
||||
|
||||
if yyj131 >= len(yyv131) {
|
||||
yyv131 = append(yyv131, PetSet{}) // var yyz131 PetSet
|
||||
yyv131 = append(yyv131, StatefulSet{}) // var yyz131 StatefulSet
|
||||
yyc131 = true
|
||||
}
|
||||
yyh131.ElemContainerState(yyj131)
|
||||
if yyj131 < len(yyv131) {
|
||||
if r.TryDecodeAsNil() {
|
||||
yyv131[yyj131] = PetSet{}
|
||||
yyv131[yyj131] = StatefulSet{}
|
||||
} else {
|
||||
yyv134 := &yyv131[yyj131]
|
||||
yyv134.CodecDecodeSelf(d)
|
||||
@ -1647,7 +1647,7 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
||||
yyv131 = yyv131[:yyj131]
|
||||
yyc131 = true
|
||||
} else if yyj131 == 0 && yyv131 == nil {
|
||||
yyv131 = []PetSet{}
|
||||
yyv131 = []StatefulSet{}
|
||||
yyc131 = true
|
||||
}
|
||||
}
|
||||
|
@ -23,30 +23,30 @@ import (
|
||||
|
||||
// +genclient=true
|
||||
|
||||
// PetSet represents a set of pods with consistent identities.
|
||||
// StatefulSet 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 PetSet guarantees that a given network identity will always
|
||||
// map to the same storage identity. PetSet is currently in alpha
|
||||
// The StatefulSet guarantees that a given network identity will always
|
||||
// map to the same storage identity. StatefulSet is currently in alpha
|
||||
// and subject to change without notice.
|
||||
type PetSet struct {
|
||||
type StatefulSet struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Spec defines the desired identities of pets in this set.
|
||||
// Spec defines the desired identities of pods in this set.
|
||||
// +optional
|
||||
Spec PetSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
Spec StatefulSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// Status is the current status of Pets in this PetSet. This data
|
||||
// Status is the current status of Pods in this StatefulSet. This data
|
||||
// may be out of date by some window of time.
|
||||
// +optional
|
||||
Status PetSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
Status StatefulSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
// A PetSetSpec is the specification of a PetSet.
|
||||
type PetSetSpec struct {
|
||||
// A StatefulSetSpec is the specification of a StatefulSet.
|
||||
type StatefulSetSpec struct {
|
||||
// Replicas is the desired number of replicas of the given Template.
|
||||
// These are replicas in the sense that they are instantiations of the
|
||||
// same Template, but individual replicas also have a consistent identity.
|
||||
@ -62,14 +62,14 @@ type PetSetSpec struct {
|
||||
Selector *unversioned.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"`
|
||||
|
||||
// Template is the object that describes the pod that will be created if
|
||||
// insufficient replicas are detected. Each pod stamped out by the PetSet
|
||||
// insufficient replicas are detected. Each pod stamped out by the StatefulSet
|
||||
// will fulfill this Template, but have a unique identity from the rest
|
||||
// of the PetSet.
|
||||
// of the StatefulSet.
|
||||
Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"`
|
||||
|
||||
// VolumeClaimTemplates is a list of claims that pets are allowed to reference.
|
||||
// The PetSet controller is responsible for mapping network identities to
|
||||
// claims in a way that maintains the identity of a pet. Every claim in
|
||||
// VolumeClaimTemplates is a list of claims that pods are allowed to reference.
|
||||
// The StatefulSet controller is responsible for mapping network identities to
|
||||
// claims in a way that maintains the identity of a pod. Every claim in
|
||||
// this list must have at least one matching (by name) volumeMount in one
|
||||
// container in the template. A claim in this list takes precedence over
|
||||
// any volumes in the template, with the same name.
|
||||
@ -77,16 +77,16 @@ type PetSetSpec struct {
|
||||
// +optional
|
||||
VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty" protobuf:"bytes,4,rep,name=volumeClaimTemplates"`
|
||||
|
||||
// ServiceName is the name of the service that governs this PetSet.
|
||||
// This service must exist before the PetSet, and is responsible for
|
||||
// the network identity of the set. Pets get DNS/hostnames that follow the
|
||||
// pattern: pet-specific-string.serviceName.default.svc.cluster.local
|
||||
// where "pet-specific-string" is managed by the PetSet controller.
|
||||
// ServiceName is the name of the service that governs this StatefulSet.
|
||||
// This service must exist before the StatefulSet, and is responsible for
|
||||
// the network identity of the set. Pods get DNS/hostnames that follow the
|
||||
// pattern: pod-specific-string.serviceName.default.svc.cluster.local
|
||||
// where "pod-specific-string" is managed by the StatefulSet controller.
|
||||
ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"`
|
||||
}
|
||||
|
||||
// PetSetStatus represents the current state of a PetSet.
|
||||
type PetSetStatus struct {
|
||||
// StatefulSetStatus represents the current state of a StatefulSet.
|
||||
type StatefulSetStatus struct {
|
||||
// most recent generation observed by this autoscaler.
|
||||
// +optional
|
||||
ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
|
||||
@ -95,10 +95,10 @@ type PetSetStatus struct {
|
||||
Replicas int32 `json:"replicas" protobuf:"varint,2,opt,name=replicas"`
|
||||
}
|
||||
|
||||
// PetSetList is a collection of PetSets.
|
||||
type PetSetList struct {
|
||||
// StatefulSetList is a collection of StatefulSets.
|
||||
type StatefulSetList struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
Items []PetSet `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
Items []StatefulSet `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
@ -27,45 +27,45 @@ package v1alpha1
|
||||
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS START HERE
|
||||
var map_PetSet = map[string]string{
|
||||
"": "PetSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe PetSet guarantees that a given network identity will always map to the same storage identity. PetSet is currently in alpha and subject to change without notice.",
|
||||
"spec": "Spec defines the desired identities of pets in this set.",
|
||||
"status": "Status is the current status of Pets in this PetSet. This data may be out of date by some window of time.",
|
||||
var map_StatefulSet = map[string]string{
|
||||
"": "StatefulSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe StatefulSet guarantees that a given network identity will always map to the same storage identity. StatefulSet is currently in alpha and subject to change without notice.",
|
||||
"spec": "Spec defines the desired identities of pods in this set.",
|
||||
"status": "Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time.",
|
||||
}
|
||||
|
||||
func (PetSet) SwaggerDoc() map[string]string {
|
||||
return map_PetSet
|
||||
func (StatefulSet) SwaggerDoc() map[string]string {
|
||||
return map_StatefulSet
|
||||
}
|
||||
|
||||
var map_PetSetList = map[string]string{
|
||||
"": "PetSetList is a collection of PetSets.",
|
||||
var map_StatefulSetList = map[string]string{
|
||||
"": "StatefulSetList is a collection of StatefulSets.",
|
||||
}
|
||||
|
||||
func (PetSetList) SwaggerDoc() map[string]string {
|
||||
return map_PetSetList
|
||||
func (StatefulSetList) SwaggerDoc() map[string]string {
|
||||
return map_StatefulSetList
|
||||
}
|
||||
|
||||
var map_PetSetSpec = map[string]string{
|
||||
"": "A PetSetSpec is the specification of a PetSet.",
|
||||
var map_StatefulSetSpec = map[string]string{
|
||||
"": "A StatefulSetSpec is the specification of a StatefulSet.",
|
||||
"replicas": "Replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.",
|
||||
"selector": "Selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors",
|
||||
"template": "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the PetSet will fulfill this Template, but have a unique identity from the rest of the PetSet.",
|
||||
"volumeClaimTemplates": "VolumeClaimTemplates is a list of claims that pets are allowed to reference. The PetSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pet. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.",
|
||||
"serviceName": "ServiceName is the name of the service that governs this PetSet. This service must exist before the PetSet, and is responsible for the network identity of the set. Pets get DNS/hostnames that follow the pattern: pet-specific-string.serviceName.default.svc.cluster.local where \"pet-specific-string\" is managed by the PetSet controller.",
|
||||
"template": "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet.",
|
||||
"volumeClaimTemplates": "VolumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.",
|
||||
"serviceName": "ServiceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller.",
|
||||
}
|
||||
|
||||
func (PetSetSpec) SwaggerDoc() map[string]string {
|
||||
return map_PetSetSpec
|
||||
func (StatefulSetSpec) SwaggerDoc() map[string]string {
|
||||
return map_StatefulSetSpec
|
||||
}
|
||||
|
||||
var map_PetSetStatus = map[string]string{
|
||||
"": "PetSetStatus represents the current state of a PetSet.",
|
||||
var map_StatefulSetStatus = map[string]string{
|
||||
"": "StatefulSetStatus represents the current state of a StatefulSet.",
|
||||
"observedGeneration": "most recent generation observed by this autoscaler.",
|
||||
"replicas": "Replicas is the number of actual replicas.",
|
||||
}
|
||||
|
||||
func (PetSetStatus) SwaggerDoc() map[string]string {
|
||||
return map_PetSetStatus
|
||||
func (StatefulSetStatus) SwaggerDoc() map[string]string {
|
||||
return map_StatefulSetStatus
|
||||
}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
||||
|
@ -36,60 +36,60 @@ func init() {
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedConversionFuncs(
|
||||
Convert_v1alpha1_PetSet_To_apps_PetSet,
|
||||
Convert_apps_PetSet_To_v1alpha1_PetSet,
|
||||
Convert_v1alpha1_PetSetList_To_apps_PetSetList,
|
||||
Convert_apps_PetSetList_To_v1alpha1_PetSetList,
|
||||
Convert_v1alpha1_PetSetSpec_To_apps_PetSetSpec,
|
||||
Convert_apps_PetSetSpec_To_v1alpha1_PetSetSpec,
|
||||
Convert_v1alpha1_PetSetStatus_To_apps_PetSetStatus,
|
||||
Convert_apps_PetSetStatus_To_v1alpha1_PetSetStatus,
|
||||
Convert_v1alpha1_StatefulSet_To_apps_StatefulSet,
|
||||
Convert_apps_StatefulSet_To_v1alpha1_StatefulSet,
|
||||
Convert_v1alpha1_StatefulSetList_To_apps_StatefulSetList,
|
||||
Convert_apps_StatefulSetList_To_v1alpha1_StatefulSetList,
|
||||
Convert_v1alpha1_StatefulSetSpec_To_apps_StatefulSetSpec,
|
||||
Convert_apps_StatefulSetSpec_To_v1alpha1_StatefulSetSpec,
|
||||
Convert_v1alpha1_StatefulSetStatus_To_apps_StatefulSetStatus,
|
||||
Convert_apps_StatefulSetStatus_To_v1alpha1_StatefulSetStatus,
|
||||
)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_PetSet_To_apps_PetSet(in *PetSet, out *apps.PetSet, s conversion.Scope) error {
|
||||
func autoConvert_v1alpha1_StatefulSet_To_apps_StatefulSet(in *StatefulSet, out *apps.StatefulSet, s conversion.Scope) error {
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
if err := Convert_v1alpha1_StatefulSetSpec_To_apps_StatefulSetSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1alpha1_PetSetStatus_To_apps_PetSetStatus(&in.Status, &out.Status, s); err != nil {
|
||||
if err := Convert_v1alpha1_StatefulSetStatus_To_apps_StatefulSetStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1alpha1_PetSet_To_apps_PetSet(in *PetSet, out *apps.PetSet, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_PetSet_To_apps_PetSet(in, out, s)
|
||||
func Convert_v1alpha1_StatefulSet_To_apps_StatefulSet(in *StatefulSet, out *apps.StatefulSet, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_StatefulSet_To_apps_StatefulSet(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_apps_PetSet_To_v1alpha1_PetSet(in *apps.PetSet, out *PetSet, s conversion.Scope) error {
|
||||
func autoConvert_apps_StatefulSet_To_v1alpha1_StatefulSet(in *apps.StatefulSet, out *StatefulSet, s conversion.Scope) error {
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_apps_PetSetSpec_To_v1alpha1_PetSetSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
if err := Convert_apps_StatefulSetSpec_To_v1alpha1_StatefulSetSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_apps_PetSetStatus_To_v1alpha1_PetSetStatus(&in.Status, &out.Status, s); err != nil {
|
||||
if err := Convert_apps_StatefulSetStatus_To_v1alpha1_StatefulSetStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_apps_PetSet_To_v1alpha1_PetSet(in *apps.PetSet, out *PetSet, s conversion.Scope) error {
|
||||
return autoConvert_apps_PetSet_To_v1alpha1_PetSet(in, out, s)
|
||||
func Convert_apps_StatefulSet_To_v1alpha1_StatefulSet(in *apps.StatefulSet, out *StatefulSet, s conversion.Scope) error {
|
||||
return autoConvert_apps_StatefulSet_To_v1alpha1_StatefulSet(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_PetSetList_To_apps_PetSetList(in *PetSetList, out *apps.PetSetList, s conversion.Scope) error {
|
||||
func autoConvert_v1alpha1_StatefulSetList_To_apps_StatefulSetList(in *StatefulSetList, out *apps.StatefulSetList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]apps.PetSet, len(*in))
|
||||
*out = make([]apps.StatefulSet, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1alpha1_PetSet_To_apps_PetSet(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
if err := Convert_v1alpha1_StatefulSet_To_apps_StatefulSet(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -99,17 +99,17 @@ func autoConvert_v1alpha1_PetSetList_To_apps_PetSetList(in *PetSetList, out *app
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1alpha1_PetSetList_To_apps_PetSetList(in *PetSetList, out *apps.PetSetList, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_PetSetList_To_apps_PetSetList(in, out, s)
|
||||
func Convert_v1alpha1_StatefulSetList_To_apps_StatefulSetList(in *StatefulSetList, out *apps.StatefulSetList, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_StatefulSetList_To_apps_StatefulSetList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_apps_PetSetList_To_v1alpha1_PetSetList(in *apps.PetSetList, out *PetSetList, s conversion.Scope) error {
|
||||
func autoConvert_apps_StatefulSetList_To_v1alpha1_StatefulSetList(in *apps.StatefulSetList, out *StatefulSetList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]PetSet, len(*in))
|
||||
*out = make([]StatefulSet, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_apps_PetSet_To_v1alpha1_PetSet(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
if err := Convert_apps_StatefulSet_To_v1alpha1_StatefulSet(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -119,11 +119,11 @@ func autoConvert_apps_PetSetList_To_v1alpha1_PetSetList(in *apps.PetSetList, out
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_apps_PetSetList_To_v1alpha1_PetSetList(in *apps.PetSetList, out *PetSetList, s conversion.Scope) error {
|
||||
return autoConvert_apps_PetSetList_To_v1alpha1_PetSetList(in, out, s)
|
||||
func Convert_apps_StatefulSetList_To_v1alpha1_StatefulSetList(in *apps.StatefulSetList, out *StatefulSetList, s conversion.Scope) error {
|
||||
return autoConvert_apps_StatefulSetList_To_v1alpha1_StatefulSetList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(in *PetSetSpec, out *apps.PetSetSpec, s conversion.Scope) error {
|
||||
func autoConvert_v1alpha1_StatefulSetSpec_To_apps_StatefulSetSpec(in *StatefulSetSpec, out *apps.StatefulSetSpec, s conversion.Scope) error {
|
||||
if err := api.Convert_Pointer_int32_To_int32(&in.Replicas, &out.Replicas, s); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -147,7 +147,7 @@ func autoConvert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(in *PetSetSpec, out *app
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_apps_PetSetSpec_To_v1alpha1_PetSetSpec(in *apps.PetSetSpec, out *PetSetSpec, s conversion.Scope) error {
|
||||
func autoConvert_apps_StatefulSetSpec_To_v1alpha1_StatefulSetSpec(in *apps.StatefulSetSpec, out *StatefulSetSpec, s conversion.Scope) error {
|
||||
if err := api.Convert_int32_To_Pointer_int32(&in.Replicas, &out.Replicas, s); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -171,22 +171,22 @@ func autoConvert_apps_PetSetSpec_To_v1alpha1_PetSetSpec(in *apps.PetSetSpec, out
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_PetSetStatus_To_apps_PetSetStatus(in *PetSetStatus, out *apps.PetSetStatus, s conversion.Scope) error {
|
||||
func autoConvert_v1alpha1_StatefulSetStatus_To_apps_StatefulSetStatus(in *StatefulSetStatus, out *apps.StatefulSetStatus, s conversion.Scope) error {
|
||||
out.ObservedGeneration = in.ObservedGeneration
|
||||
out.Replicas = in.Replicas
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1alpha1_PetSetStatus_To_apps_PetSetStatus(in *PetSetStatus, out *apps.PetSetStatus, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_PetSetStatus_To_apps_PetSetStatus(in, out, s)
|
||||
func Convert_v1alpha1_StatefulSetStatus_To_apps_StatefulSetStatus(in *StatefulSetStatus, out *apps.StatefulSetStatus, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_StatefulSetStatus_To_apps_StatefulSetStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_apps_PetSetStatus_To_v1alpha1_PetSetStatus(in *apps.PetSetStatus, out *PetSetStatus, s conversion.Scope) error {
|
||||
func autoConvert_apps_StatefulSetStatus_To_v1alpha1_StatefulSetStatus(in *apps.StatefulSetStatus, out *StatefulSetStatus, s conversion.Scope) error {
|
||||
out.ObservedGeneration = in.ObservedGeneration
|
||||
out.Replicas = in.Replicas
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_apps_PetSetStatus_To_v1alpha1_PetSetStatus(in *apps.PetSetStatus, out *PetSetStatus, s conversion.Scope) error {
|
||||
return autoConvert_apps_PetSetStatus_To_v1alpha1_PetSetStatus(in, out, s)
|
||||
func Convert_apps_StatefulSetStatus_To_v1alpha1_StatefulSetStatus(in *apps.StatefulSetStatus, out *StatefulSetStatus, s conversion.Scope) error {
|
||||
return autoConvert_apps_StatefulSetStatus_To_v1alpha1_StatefulSetStatus(in, out, s)
|
||||
}
|
||||
|
@ -36,42 +36,42 @@ func init() {
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_PetSet, InType: reflect.TypeOf(&PetSet{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_PetSetList, InType: reflect.TypeOf(&PetSetList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_PetSetSpec, InType: reflect.TypeOf(&PetSetSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_PetSetStatus, InType: reflect.TypeOf(&PetSetStatus{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_StatefulSet, InType: reflect.TypeOf(&StatefulSet{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_StatefulSetList, InType: reflect.TypeOf(&StatefulSetList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_StatefulSetSpec, InType: reflect.TypeOf(&StatefulSetSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_StatefulSetStatus, InType: reflect.TypeOf(&StatefulSetStatus{})},
|
||||
)
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_PetSet(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
func DeepCopy_v1alpha1_StatefulSet(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PetSet)
|
||||
out := out.(*PetSet)
|
||||
in := in.(*StatefulSet)
|
||||
out := out.(*StatefulSet)
|
||||
out.TypeMeta = in.TypeMeta
|
||||
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := DeepCopy_v1alpha1_PetSetSpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
if err := DeepCopy_v1alpha1_StatefulSetSpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := DeepCopy_v1alpha1_PetSetStatus(&in.Status, &out.Status, c); err != nil {
|
||||
if err := DeepCopy_v1alpha1_StatefulSetStatus(&in.Status, &out.Status, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_PetSetList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
func DeepCopy_v1alpha1_StatefulSetList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PetSetList)
|
||||
out := out.(*PetSetList)
|
||||
in := in.(*StatefulSetList)
|
||||
out := out.(*StatefulSetList)
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]PetSet, len(*in))
|
||||
*out = make([]StatefulSet, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_v1alpha1_PetSet(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
if err := DeepCopy_v1alpha1_StatefulSet(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -82,10 +82,10 @@ func DeepCopy_v1alpha1_PetSetList(in interface{}, out interface{}, c *conversion
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_PetSetSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
func DeepCopy_v1alpha1_StatefulSetSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PetSetSpec)
|
||||
out := out.(*PetSetSpec)
|
||||
in := in.(*StatefulSetSpec)
|
||||
out := out.(*StatefulSetSpec)
|
||||
if in.Replicas != nil {
|
||||
in, out := &in.Replicas, &out.Replicas
|
||||
*out = new(int32)
|
||||
@ -121,10 +121,10 @@ func DeepCopy_v1alpha1_PetSetSpec(in interface{}, out interface{}, c *conversion
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1alpha1_PetSetStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
func DeepCopy_v1alpha1_StatefulSetStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PetSetStatus)
|
||||
out := out.(*PetSetStatus)
|
||||
in := in.(*StatefulSetStatus)
|
||||
out := out.(*StatefulSetStatus)
|
||||
if in.ObservedGeneration != nil {
|
||||
in, out := &in.ObservedGeneration, &out.ObservedGeneration
|
||||
*out = new(int64)
|
||||
|
@ -29,13 +29,13 @@ import (
|
||||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
scheme.AddTypeDefaultingFunc(&PetSet{}, func(obj interface{}) { SetObjectDefaults_PetSet(obj.(*PetSet)) })
|
||||
scheme.AddTypeDefaultingFunc(&PetSetList{}, func(obj interface{}) { SetObjectDefaults_PetSetList(obj.(*PetSetList)) })
|
||||
scheme.AddTypeDefaultingFunc(&StatefulSet{}, func(obj interface{}) { SetObjectDefaults_StatefulSet(obj.(*StatefulSet)) })
|
||||
scheme.AddTypeDefaultingFunc(&StatefulSetList{}, func(obj interface{}) { SetObjectDefaults_StatefulSetList(obj.(*StatefulSetList)) })
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetObjectDefaults_PetSet(in *PetSet) {
|
||||
SetDefaults_PetSet(in)
|
||||
func SetObjectDefaults_StatefulSet(in *StatefulSet) {
|
||||
SetDefaults_StatefulSet(in)
|
||||
v1.SetDefaults_PodSpec(&in.Spec.Template.Spec)
|
||||
for i := range in.Spec.Template.Spec.Volumes {
|
||||
a := &in.Spec.Template.Spec.Volumes[i]
|
||||
@ -158,9 +158,9 @@ func SetObjectDefaults_PetSet(in *PetSet) {
|
||||
}
|
||||
}
|
||||
|
||||
func SetObjectDefaults_PetSetList(in *PetSetList) {
|
||||
func SetObjectDefaults_StatefulSetList(in *StatefulSetList) {
|
||||
for i := range in.Items {
|
||||
a := &in.Items[i]
|
||||
SetObjectDefaults_PetSet(a)
|
||||
SetObjectDefaults_StatefulSet(a)
|
||||
}
|
||||
}
|
||||
|
@ -28,24 +28,24 @@ import (
|
||||
"k8s.io/kubernetes/pkg/util/validation/field"
|
||||
)
|
||||
|
||||
// ValidatePetSetName can be used to check whether the given PetSet name is valid.
|
||||
// ValidateStatefulSetName can be used to check whether the given StatefulSet name is valid.
|
||||
// Prefix indicates this name will be used as part of generation, in which case
|
||||
// trailing dashes are allowed.
|
||||
func ValidatePetSetName(name string, prefix bool) []string {
|
||||
// TODO: Validate that there's name for the suffix inserted by the pets.
|
||||
func ValidateStatefulSetName(name string, prefix bool) []string {
|
||||
// TODO: Validate that there's name for the suffix inserted by the pods.
|
||||
// Currently this is just "-index". In the future we may allow a user
|
||||
// specified list of suffixes and we need to validate the longest one.
|
||||
return apivalidation.NameIsDNSSubdomain(name, prefix)
|
||||
}
|
||||
|
||||
// Validates the given template and ensures that it is in accordance with the desired selector.
|
||||
func ValidatePodTemplateSpecForPetSet(template *api.PodTemplateSpec, selector labels.Selector, fldPath *field.Path) field.ErrorList {
|
||||
func ValidatePodTemplateSpecForStatefulSet(template *api.PodTemplateSpec, selector labels.Selector, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
if template == nil {
|
||||
allErrs = append(allErrs, field.Required(fldPath, ""))
|
||||
} else {
|
||||
if !selector.Empty() {
|
||||
// Verify that the PetSet selector matches the labels in template.
|
||||
// Verify that the StatefulSet selector matches the labels in template.
|
||||
labels := labels.Set(template.Labels)
|
||||
if !selector.Matches(labels) {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("metadata", "labels"), template.Labels, "`selector` does not match template `labels`"))
|
||||
@ -62,8 +62,8 @@ func ValidatePodTemplateSpecForPetSet(template *api.PodTemplateSpec, selector la
|
||||
return allErrs
|
||||
}
|
||||
|
||||
// ValidatePetSetSpec tests if required fields in the PetSet spec are set.
|
||||
func ValidatePetSetSpec(spec *apps.PetSetSpec, fldPath *field.Path) field.ErrorList {
|
||||
// ValidateStatefulSetSpec tests if required fields in the StatefulSet spec are set.
|
||||
func ValidateStatefulSetSpec(spec *apps.StatefulSetSpec, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
|
||||
allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(spec.Replicas), fldPath.Child("replicas"))...)
|
||||
@ -72,7 +72,7 @@ func ValidatePetSetSpec(spec *apps.PetSetSpec, fldPath *field.Path) field.ErrorL
|
||||
} else {
|
||||
allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(spec.Selector, fldPath.Child("selector"))...)
|
||||
if len(spec.Selector.MatchLabels)+len(spec.Selector.MatchExpressions) == 0 {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("selector"), spec.Selector, "empty selector is not valid for petset."))
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("selector"), spec.Selector, "empty selector is not valid for statefulset."))
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ func ValidatePetSetSpec(spec *apps.PetSetSpec, fldPath *field.Path) field.ErrorL
|
||||
if err != nil {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("selector"), spec.Selector, ""))
|
||||
} else {
|
||||
allErrs = append(allErrs, ValidatePodTemplateSpecForPetSet(&spec.Template, selector, fldPath.Child("template"))...)
|
||||
allErrs = append(allErrs, ValidatePodTemplateSpecForStatefulSet(&spec.Template, selector, fldPath.Child("template"))...)
|
||||
}
|
||||
|
||||
if spec.Template.Spec.RestartPolicy != api.RestartPolicyAlways {
|
||||
@ -90,42 +90,42 @@ func ValidatePetSetSpec(spec *apps.PetSetSpec, fldPath *field.Path) field.ErrorL
|
||||
return allErrs
|
||||
}
|
||||
|
||||
// ValidatePetSet validates a PetSet.
|
||||
func ValidatePetSet(petSet *apps.PetSet) field.ErrorList {
|
||||
allErrs := apivalidation.ValidateObjectMeta(&petSet.ObjectMeta, true, ValidatePetSetName, field.NewPath("metadata"))
|
||||
allErrs = append(allErrs, ValidatePetSetSpec(&petSet.Spec, field.NewPath("spec"))...)
|
||||
// ValidateStatefulSet validates a StatefulSet.
|
||||
func ValidateStatefulSet(statefulSet *apps.StatefulSet) field.ErrorList {
|
||||
allErrs := apivalidation.ValidateObjectMeta(&statefulSet.ObjectMeta, true, ValidateStatefulSetName, field.NewPath("metadata"))
|
||||
allErrs = append(allErrs, ValidateStatefulSetSpec(&statefulSet.Spec, field.NewPath("spec"))...)
|
||||
return allErrs
|
||||
}
|
||||
|
||||
// ValidatePetSetUpdate tests if required fields in the PetSet are set.
|
||||
func ValidatePetSetUpdate(petSet, oldPetSet *apps.PetSet) field.ErrorList {
|
||||
allErrs := apivalidation.ValidateObjectMetaUpdate(&petSet.ObjectMeta, &oldPetSet.ObjectMeta, field.NewPath("metadata"))
|
||||
// ValidateStatefulSetUpdate tests if required fields in the StatefulSet are set.
|
||||
func ValidateStatefulSetUpdate(statefulSet, oldStatefulSet *apps.StatefulSet) field.ErrorList {
|
||||
allErrs := apivalidation.ValidateObjectMetaUpdate(&statefulSet.ObjectMeta, &oldStatefulSet.ObjectMeta, field.NewPath("metadata"))
|
||||
|
||||
// TODO: For now we're taking the safe route and disallowing all updates to
|
||||
// spec except for Replicas, for scaling, and Template.Spec.containers.image
|
||||
// for rolling-update. Enable others on a case by case basis.
|
||||
restoreReplicas := petSet.Spec.Replicas
|
||||
petSet.Spec.Replicas = oldPetSet.Spec.Replicas
|
||||
restoreReplicas := statefulSet.Spec.Replicas
|
||||
statefulSet.Spec.Replicas = oldStatefulSet.Spec.Replicas
|
||||
|
||||
restoreContainers := petSet.Spec.Template.Spec.Containers
|
||||
petSet.Spec.Template.Spec.Containers = oldPetSet.Spec.Template.Spec.Containers
|
||||
restoreContainers := statefulSet.Spec.Template.Spec.Containers
|
||||
statefulSet.Spec.Template.Spec.Containers = oldStatefulSet.Spec.Template.Spec.Containers
|
||||
|
||||
if !reflect.DeepEqual(petSet.Spec, oldPetSet.Spec) {
|
||||
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "updates to petset spec for fields other than 'replicas' are forbidden."))
|
||||
if !reflect.DeepEqual(statefulSet.Spec, oldStatefulSet.Spec) {
|
||||
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "updates to statefulset spec for fields other than 'replicas' are forbidden."))
|
||||
}
|
||||
petSet.Spec.Replicas = restoreReplicas
|
||||
petSet.Spec.Template.Spec.Containers = restoreContainers
|
||||
statefulSet.Spec.Replicas = restoreReplicas
|
||||
statefulSet.Spec.Template.Spec.Containers = restoreContainers
|
||||
|
||||
allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(petSet.Spec.Replicas), field.NewPath("spec", "replicas"))...)
|
||||
containerErrs, _ := apivalidation.ValidateContainerUpdates(petSet.Spec.Template.Spec.Containers, oldPetSet.Spec.Template.Spec.Containers, field.NewPath("spec").Child("template").Child("containers"))
|
||||
allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(statefulSet.Spec.Replicas), field.NewPath("spec", "replicas"))...)
|
||||
containerErrs, _ := apivalidation.ValidateContainerUpdates(statefulSet.Spec.Template.Spec.Containers, oldStatefulSet.Spec.Template.Spec.Containers, field.NewPath("spec").Child("template").Child("containers"))
|
||||
allErrs = append(allErrs, containerErrs...)
|
||||
return allErrs
|
||||
}
|
||||
|
||||
// ValidatePetSetStatusUpdate tests if required fields in the PetSet are set.
|
||||
func ValidatePetSetStatusUpdate(petSet, oldPetSet *apps.PetSet) field.ErrorList {
|
||||
// ValidateStatefulSetStatusUpdate tests if required fields in the StatefulSet are set.
|
||||
func ValidateStatefulSetStatusUpdate(statefulSet, oldStatefulSet *apps.StatefulSet) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&petSet.ObjectMeta, &oldPetSet.ObjectMeta, field.NewPath("metadata"))...)
|
||||
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&statefulSet.ObjectMeta, &oldStatefulSet.ObjectMeta, field.NewPath("metadata"))...)
|
||||
// TODO: Validate status.
|
||||
return allErrs
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/apis/apps"
|
||||
)
|
||||
|
||||
func TestValidatePetSet(t *testing.T) {
|
||||
func TestValidateStatefulSet(t *testing.T) {
|
||||
validLabels := map[string]string{"a": "b"}
|
||||
validPodTemplate := api.PodTemplate{
|
||||
Template: api.PodTemplateSpec{
|
||||
@ -51,65 +51,65 @@ func TestValidatePetSet(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
successCases := []apps.PetSet{
|
||||
successCases := []apps.StatefulSet{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc-123", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, successCase := range successCases {
|
||||
if errs := ValidatePetSet(&successCase); len(errs) != 0 {
|
||||
if errs := ValidateStatefulSet(&successCase); len(errs) != 0 {
|
||||
t.Errorf("expected success: %v", errs)
|
||||
}
|
||||
}
|
||||
|
||||
errorCases := map[string]apps.PetSet{
|
||||
errorCases := map[string]apps.StatefulSet{
|
||||
"zero-length ID": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
"missing-namespace": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc-123"},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
"empty selector": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
"selector_doesnt_match": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
"invalid manifest": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
},
|
||||
},
|
||||
"negative_replicas": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: -1,
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
},
|
||||
@ -122,7 +122,7 @@ func TestValidatePetSet(t *testing.T) {
|
||||
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
||||
},
|
||||
},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
@ -135,7 +135,7 @@ func TestValidatePetSet(t *testing.T) {
|
||||
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
||||
},
|
||||
},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Template: invalidPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
@ -147,7 +147,7 @@ func TestValidatePetSet(t *testing.T) {
|
||||
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
||||
},
|
||||
},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
@ -157,7 +157,7 @@ func TestValidatePetSet(t *testing.T) {
|
||||
Name: "abc-123",
|
||||
Namespace: api.NamespaceDefault,
|
||||
},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: api.PodTemplateSpec{
|
||||
Spec: api.PodSpec{
|
||||
@ -176,7 +176,7 @@ func TestValidatePetSet(t *testing.T) {
|
||||
Name: "abc-123",
|
||||
Namespace: api.NamespaceDefault,
|
||||
},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: api.PodTemplateSpec{
|
||||
Spec: api.PodSpec{
|
||||
@ -192,7 +192,7 @@ func TestValidatePetSet(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for k, v := range errorCases {
|
||||
errs := ValidatePetSet(&v)
|
||||
errs := ValidateStatefulSet(&v)
|
||||
if len(errs) == 0 {
|
||||
t.Errorf("expected failure for %s", k)
|
||||
}
|
||||
@ -215,7 +215,7 @@ func TestValidatePetSet(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidatePetSetUpdate(t *testing.T) {
|
||||
func TestValidateStatefulSetUpdate(t *testing.T) {
|
||||
validLabels := map[string]string{"a": "b"}
|
||||
validPodTemplate := api.PodTemplate{
|
||||
Template: api.PodTemplateSpec{
|
||||
@ -255,21 +255,21 @@ func TestValidatePetSetUpdate(t *testing.T) {
|
||||
},
|
||||
}
|
||||
type psUpdateTest struct {
|
||||
old apps.PetSet
|
||||
update apps.PetSet
|
||||
old apps.StatefulSet
|
||||
update apps.StatefulSet
|
||||
}
|
||||
successCases := []psUpdateTest{
|
||||
{
|
||||
old: apps.PetSet{
|
||||
old: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
update: apps.PetSet{
|
||||
update: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: 3,
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
@ -280,22 +280,22 @@ func TestValidatePetSetUpdate(t *testing.T) {
|
||||
for _, successCase := range successCases {
|
||||
successCase.old.ObjectMeta.ResourceVersion = "1"
|
||||
successCase.update.ObjectMeta.ResourceVersion = "1"
|
||||
if errs := ValidatePetSetUpdate(&successCase.update, &successCase.old); len(errs) != 0 {
|
||||
if errs := ValidateStatefulSetUpdate(&successCase.update, &successCase.old); len(errs) != 0 {
|
||||
t.Errorf("expected success: %v", errs)
|
||||
}
|
||||
}
|
||||
errorCases := map[string]psUpdateTest{
|
||||
"more than one read/write": {
|
||||
old: apps.PetSet{
|
||||
old: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
update: apps.PetSet{
|
||||
update: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: 2,
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: readWriteVolumePodTemplate.Template,
|
||||
@ -303,16 +303,16 @@ func TestValidatePetSetUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
"updates to a field other than spec.Replicas": {
|
||||
old: apps.PetSet{
|
||||
old: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
update: apps.PetSet{
|
||||
update: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: 1,
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: readWriteVolumePodTemplate.Template,
|
||||
@ -320,16 +320,16 @@ func TestValidatePetSetUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
"invalid selector": {
|
||||
old: apps.PetSet{
|
||||
old: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
update: apps.PetSet{
|
||||
update: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: 2,
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: invalidLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
@ -337,16 +337,16 @@ func TestValidatePetSetUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
"invalid pod": {
|
||||
old: apps.PetSet{
|
||||
old: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
update: apps.PetSet{
|
||||
update: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: 2,
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: invalidPodTemplate.Template,
|
||||
@ -354,16 +354,16 @@ func TestValidatePetSetUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
"negative replicas": {
|
||||
old: apps.PetSet{
|
||||
old: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
},
|
||||
update: apps.PetSet{
|
||||
update: apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: -1,
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validLabels},
|
||||
Template: validPodTemplate.Template,
|
||||
@ -372,7 +372,7 @@ func TestValidatePetSetUpdate(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for testName, errorCase := range errorCases {
|
||||
if errs := ValidatePetSetUpdate(&errorCase.update, &errorCase.old); len(errs) == 0 {
|
||||
if errs := ValidateStatefulSetUpdate(&errorCase.update, &errorCase.old); len(errs) == 0 {
|
||||
t.Errorf("expected failure: %s", testName)
|
||||
}
|
||||
}
|
||||
|
@ -36,42 +36,42 @@ func init() {
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apps_PetSet, InType: reflect.TypeOf(&PetSet{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apps_PetSetList, InType: reflect.TypeOf(&PetSetList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apps_PetSetSpec, InType: reflect.TypeOf(&PetSetSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apps_PetSetStatus, InType: reflect.TypeOf(&PetSetStatus{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apps_StatefulSet, InType: reflect.TypeOf(&StatefulSet{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apps_StatefulSetList, InType: reflect.TypeOf(&StatefulSetList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apps_StatefulSetSpec, InType: reflect.TypeOf(&StatefulSetSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_apps_StatefulSetStatus, InType: reflect.TypeOf(&StatefulSetStatus{})},
|
||||
)
|
||||
}
|
||||
|
||||
func DeepCopy_apps_PetSet(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
func DeepCopy_apps_StatefulSet(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PetSet)
|
||||
out := out.(*PetSet)
|
||||
in := in.(*StatefulSet)
|
||||
out := out.(*StatefulSet)
|
||||
out.TypeMeta = in.TypeMeta
|
||||
if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := DeepCopy_apps_PetSetSpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
if err := DeepCopy_apps_StatefulSetSpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := DeepCopy_apps_PetSetStatus(&in.Status, &out.Status, c); err != nil {
|
||||
if err := DeepCopy_apps_StatefulSetStatus(&in.Status, &out.Status, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_apps_PetSetList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
func DeepCopy_apps_StatefulSetList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PetSetList)
|
||||
out := out.(*PetSetList)
|
||||
in := in.(*StatefulSetList)
|
||||
out := out.(*StatefulSetList)
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]PetSet, len(*in))
|
||||
*out = make([]StatefulSet, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_apps_PetSet(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
if err := DeepCopy_apps_StatefulSet(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -82,10 +82,10 @@ func DeepCopy_apps_PetSetList(in interface{}, out interface{}, c *conversion.Clo
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_apps_PetSetSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
func DeepCopy_apps_StatefulSetSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PetSetSpec)
|
||||
out := out.(*PetSetSpec)
|
||||
in := in.(*StatefulSetSpec)
|
||||
out := out.(*StatefulSetSpec)
|
||||
out.Replicas = in.Replicas
|
||||
if in.Selector != nil {
|
||||
in, out := &in.Selector, &out.Selector
|
||||
@ -115,10 +115,10 @@ func DeepCopy_apps_PetSetSpec(in interface{}, out interface{}, c *conversion.Clo
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_apps_PetSetStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
func DeepCopy_apps_StatefulSetStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PetSetStatus)
|
||||
out := out.(*PetSetStatus)
|
||||
in := in.(*StatefulSetStatus)
|
||||
out := out.(*StatefulSetStatus)
|
||||
if in.ObservedGeneration != nil {
|
||||
in, out := &in.ObservedGeneration, &out.ObservedGeneration
|
||||
*out = new(int64)
|
||||
|
34
pkg/client/cache/listers.go
vendored
34
pkg/client/cache/listers.go
vendored
@ -364,13 +364,13 @@ func (s *StoreToPVFetcher) GetPersistentVolumeInfo(id string) (*api.PersistentVo
|
||||
return o.(*api.PersistentVolume), nil
|
||||
}
|
||||
|
||||
// StoreToPetSetLister gives a store List and Exists methods. The store must contain only PetSets.
|
||||
type StoreToPetSetLister struct {
|
||||
// StoreToStatefulSetLister gives a store List and Exists methods. The store must contain only StatefulSets.
|
||||
type StoreToStatefulSetLister struct {
|
||||
Store
|
||||
}
|
||||
|
||||
// Exists checks if the given PetSet exists in the store.
|
||||
func (s *StoreToPetSetLister) Exists(ps *apps.PetSet) (bool, error) {
|
||||
// Exists checks if the given StatefulSet exists in the store.
|
||||
func (s *StoreToStatefulSetLister) Exists(ps *apps.StatefulSet) (bool, error) {
|
||||
_, exists, err := s.Store.Get(ps)
|
||||
if err != nil {
|
||||
return false, err
|
||||
@ -378,35 +378,35 @@ func (s *StoreToPetSetLister) Exists(ps *apps.PetSet) (bool, error) {
|
||||
return exists, nil
|
||||
}
|
||||
|
||||
// List lists all PetSets in the store.
|
||||
func (s *StoreToPetSetLister) List() (psList []apps.PetSet, err error) {
|
||||
// List lists all StatefulSets in the store.
|
||||
func (s *StoreToStatefulSetLister) List() (psList []apps.StatefulSet, err error) {
|
||||
for _, ps := range s.Store.List() {
|
||||
psList = append(psList, *(ps.(*apps.PetSet)))
|
||||
psList = append(psList, *(ps.(*apps.StatefulSet)))
|
||||
}
|
||||
return psList, nil
|
||||
}
|
||||
|
||||
type storePetSetsNamespacer struct {
|
||||
type storeStatefulSetsNamespacer struct {
|
||||
store Store
|
||||
namespace string
|
||||
}
|
||||
|
||||
func (s *StoreToPetSetLister) PetSets(namespace string) storePetSetsNamespacer {
|
||||
return storePetSetsNamespacer{s.Store, namespace}
|
||||
func (s *StoreToStatefulSetLister) StatefulSets(namespace string) storeStatefulSetsNamespacer {
|
||||
return storeStatefulSetsNamespacer{s.Store, namespace}
|
||||
}
|
||||
|
||||
// GetPodPetSets returns a list of PetSets managing a pod. Returns an error only if no matching PetSets are found.
|
||||
func (s *StoreToPetSetLister) GetPodPetSets(pod *api.Pod) (psList []apps.PetSet, err error) {
|
||||
// GetPodStatefulSets returns a list of StatefulSets managing a pod. Returns an error only if no matching StatefulSets are found.
|
||||
func (s *StoreToStatefulSetLister) GetPodStatefulSets(pod *api.Pod) (psList []apps.StatefulSet, err error) {
|
||||
var selector labels.Selector
|
||||
var ps apps.PetSet
|
||||
var ps apps.StatefulSet
|
||||
|
||||
if len(pod.Labels) == 0 {
|
||||
err = fmt.Errorf("no PetSets found for pod %v because it has no labels", pod.Name)
|
||||
err = fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name)
|
||||
return
|
||||
}
|
||||
|
||||
for _, m := range s.Store.List() {
|
||||
ps = *m.(*apps.PetSet)
|
||||
ps = *m.(*apps.StatefulSet)
|
||||
if ps.Namespace != pod.Namespace {
|
||||
continue
|
||||
}
|
||||
@ -416,14 +416,14 @@ func (s *StoreToPetSetLister) GetPodPetSets(pod *api.Pod) (psList []apps.PetSet,
|
||||
return
|
||||
}
|
||||
|
||||
// If a PetSet with a nil or empty selector creeps in, it should match nothing, not everything.
|
||||
// If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything.
|
||||
if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) {
|
||||
continue
|
||||
}
|
||||
psList = append(psList, ps)
|
||||
}
|
||||
if len(psList) == 0 {
|
||||
err = fmt.Errorf("could not find PetSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels)
|
||||
err = fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ go_library(
|
||||
"apps_client.go",
|
||||
"doc.go",
|
||||
"generated_expansion.go",
|
||||
"petset.go",
|
||||
"statefulset.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
|
||||
type AppsInterface interface {
|
||||
RESTClient() restclient.Interface
|
||||
PetSetsGetter
|
||||
StatefulSetsGetter
|
||||
}
|
||||
|
||||
// AppsClient is used to interact with features provided by the Apps group.
|
||||
@ -32,8 +32,8 @@ type AppsClient struct {
|
||||
restClient restclient.Interface
|
||||
}
|
||||
|
||||
func (c *AppsClient) PetSets(namespace string) PetSetInterface {
|
||||
return newPetSets(c, namespace)
|
||||
func (c *AppsClient) StatefulSets(namespace string) StatefulSetInterface {
|
||||
return newStatefulSets(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new AppsClient for the given config.
|
||||
|
@ -15,7 +15,7 @@ go_library(
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"fake_apps_client.go",
|
||||
"fake_petset.go",
|
||||
"fake_statefulset.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
|
@ -26,8 +26,8 @@ type FakeApps struct {
|
||||
*core.Fake
|
||||
}
|
||||
|
||||
func (c *FakeApps) PetSets(namespace string) unversioned.PetSetInterface {
|
||||
return &FakePetSets{c, namespace}
|
||||
func (c *FakeApps) StatefulSets(namespace string) unversioned.StatefulSetInterface {
|
||||
return &FakeStatefulSets{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
|
@ -1,127 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 fake
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps"
|
||||
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||
labels "k8s.io/kubernetes/pkg/labels"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// FakePetSets implements PetSetInterface
|
||||
type FakePetSets struct {
|
||||
Fake *FakeApps
|
||||
ns string
|
||||
}
|
||||
|
||||
var petsetsResource = unversioned.GroupVersionResource{Group: "apps", Version: "", Resource: "petsets"}
|
||||
|
||||
func (c *FakePetSets) Create(petSet *apps.PetSet) (result *apps.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewCreateAction(petsetsResource, c.ns, petSet), &apps.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) Update(petSet *apps.PetSet) (result *apps.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateAction(petsetsResource, c.ns, petSet), &apps.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) UpdateStatus(petSet *apps.PetSet) (*apps.PetSet, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateSubresourceAction(petsetsResource, "status", c.ns, petSet), &apps.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) Delete(name string, options *api.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(core.NewDeleteAction(petsetsResource, c.ns, name), &apps.PetSet{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
action := core.NewDeleteCollectionAction(petsetsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &apps.PetSetList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) Get(name string) (result *apps.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewGetAction(petsetsResource, c.ns, name), &apps.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) List(opts api.ListOptions) (result *apps.PetSetList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewListAction(petsetsResource, c.ns, opts), &apps.PetSetList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := core.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &apps.PetSetList{}
|
||||
for _, item := range obj.(*apps.PetSetList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested petSets.
|
||||
func (c *FakePetSets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(core.NewWatchAction(petsetsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched petSet.
|
||||
func (c *FakePetSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *apps.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewPatchSubresourceAction(petsetsResource, c.ns, name, data, subresources...), &apps.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.PetSet), err
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 fake
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps"
|
||||
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||
labels "k8s.io/kubernetes/pkg/labels"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// FakeStatefulSets implements StatefulSetInterface
|
||||
type FakeStatefulSets struct {
|
||||
Fake *FakeApps
|
||||
ns string
|
||||
}
|
||||
|
||||
var statefulsetsResource = unversioned.GroupVersionResource{Group: "apps", Version: "", Resource: "statefulsets"}
|
||||
|
||||
func (c *FakeStatefulSets) Create(statefulSet *apps.StatefulSet) (result *apps.StatefulSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewCreateAction(statefulsetsResource, c.ns, statefulSet), &apps.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.StatefulSet), err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) Update(statefulSet *apps.StatefulSet) (result *apps.StatefulSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateAction(statefulsetsResource, c.ns, statefulSet), &apps.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.StatefulSet), err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) UpdateStatus(statefulSet *apps.StatefulSet) (*apps.StatefulSet, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateSubresourceAction(statefulsetsResource, "status", c.ns, statefulSet), &apps.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.StatefulSet), err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) Delete(name string, options *api.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(core.NewDeleteAction(statefulsetsResource, c.ns, name), &apps.StatefulSet{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
action := core.NewDeleteCollectionAction(statefulsetsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &apps.StatefulSetList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) Get(name string) (result *apps.StatefulSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewGetAction(statefulsetsResource, c.ns, name), &apps.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.StatefulSet), err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) List(opts api.ListOptions) (result *apps.StatefulSetList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewListAction(statefulsetsResource, c.ns, opts), &apps.StatefulSetList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := core.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &apps.StatefulSetList{}
|
||||
for _, item := range obj.(*apps.StatefulSetList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested statefulSets.
|
||||
func (c *FakeStatefulSets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(core.NewWatchAction(statefulsetsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched statefulSet.
|
||||
func (c *FakeStatefulSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *apps.StatefulSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewPatchSubresourceAction(statefulsetsResource, c.ns, name, data, subresources...), &apps.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*apps.StatefulSet), err
|
||||
}
|
@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
package unversioned
|
||||
|
||||
type PetSetExpansion interface{}
|
||||
type StatefulSetExpansion interface{}
|
||||
|
@ -1,166 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 unversioned
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps"
|
||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// PetSetsGetter has a method to return a PetSetInterface.
|
||||
// A group's client should implement this interface.
|
||||
type PetSetsGetter interface {
|
||||
PetSets(namespace string) PetSetInterface
|
||||
}
|
||||
|
||||
// PetSetInterface has methods to work with PetSet resources.
|
||||
type PetSetInterface interface {
|
||||
Create(*apps.PetSet) (*apps.PetSet, error)
|
||||
Update(*apps.PetSet) (*apps.PetSet, error)
|
||||
UpdateStatus(*apps.PetSet) (*apps.PetSet, error)
|
||||
Delete(name string, options *api.DeleteOptions) error
|
||||
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
|
||||
Get(name string) (*apps.PetSet, error)
|
||||
List(opts api.ListOptions) (*apps.PetSetList, error)
|
||||
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *apps.PetSet, err error)
|
||||
PetSetExpansion
|
||||
}
|
||||
|
||||
// petSets implements PetSetInterface
|
||||
type petSets struct {
|
||||
client restclient.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newPetSets returns a PetSets
|
||||
func newPetSets(c *AppsClient, namespace string) *petSets {
|
||||
return &petSets{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Create takes the representation of a petSet and creates it. Returns the server's representation of the petSet, and an error, if there is any.
|
||||
func (c *petSets) Create(petSet *apps.PetSet) (result *apps.PetSet, err error) {
|
||||
result = &apps.PetSet{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Body(petSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a petSet and updates it. Returns the server's representation of the petSet, and an error, if there is any.
|
||||
func (c *petSets) Update(petSet *apps.PetSet) (result *apps.PetSet, err error) {
|
||||
result = &apps.PetSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(petSet.Name).
|
||||
Body(petSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *petSets) UpdateStatus(petSet *apps.PetSet) (result *apps.PetSet, err error) {
|
||||
result = &apps.PetSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(petSet.Name).
|
||||
SubResource("status").
|
||||
Body(petSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the petSet and deletes it. Returns an error if one occurs.
|
||||
func (c *petSets) Delete(name string, options *api.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *petSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
VersionedParams(&listOptions, api.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Get takes name of the petSet, and returns the corresponding petSet object, and an error if there is any.
|
||||
func (c *petSets) Get(name string) (result *apps.PetSet, err error) {
|
||||
result = &apps.PetSet{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(name).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of PetSets that match those selectors.
|
||||
func (c *petSets) List(opts api.ListOptions) (result *apps.PetSetList, err error) {
|
||||
result = &apps.PetSetList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested petSets.
|
||||
func (c *petSets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched petSet.
|
||||
func (c *petSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *apps.PetSet, err error) {
|
||||
result = &apps.PetSet{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 unversioned
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps"
|
||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// StatefulSetsGetter has a method to return a StatefulSetInterface.
|
||||
// A group's client should implement this interface.
|
||||
type StatefulSetsGetter interface {
|
||||
StatefulSets(namespace string) StatefulSetInterface
|
||||
}
|
||||
|
||||
// StatefulSetInterface has methods to work with StatefulSet resources.
|
||||
type StatefulSetInterface interface {
|
||||
Create(*apps.StatefulSet) (*apps.StatefulSet, error)
|
||||
Update(*apps.StatefulSet) (*apps.StatefulSet, error)
|
||||
UpdateStatus(*apps.StatefulSet) (*apps.StatefulSet, error)
|
||||
Delete(name string, options *api.DeleteOptions) error
|
||||
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
|
||||
Get(name string) (*apps.StatefulSet, error)
|
||||
List(opts api.ListOptions) (*apps.StatefulSetList, error)
|
||||
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *apps.StatefulSet, err error)
|
||||
StatefulSetExpansion
|
||||
}
|
||||
|
||||
// statefulSets implements StatefulSetInterface
|
||||
type statefulSets struct {
|
||||
client restclient.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newStatefulSets returns a StatefulSets
|
||||
func newStatefulSets(c *AppsClient, namespace string) *statefulSets {
|
||||
return &statefulSets{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any.
|
||||
func (c *statefulSets) Create(statefulSet *apps.StatefulSet) (result *apps.StatefulSet, err error) {
|
||||
result = &apps.StatefulSet{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Body(statefulSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any.
|
||||
func (c *statefulSets) Update(statefulSet *apps.StatefulSet) (result *apps.StatefulSet, err error) {
|
||||
result = &apps.StatefulSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSet.Name).
|
||||
Body(statefulSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *statefulSets) UpdateStatus(statefulSet *apps.StatefulSet) (result *apps.StatefulSet, err error) {
|
||||
result = &apps.StatefulSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSet.Name).
|
||||
SubResource("status").
|
||||
Body(statefulSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
|
||||
func (c *statefulSets) Delete(name string, options *api.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *statefulSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
VersionedParams(&listOptions, api.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any.
|
||||
func (c *statefulSets) Get(name string) (result *apps.StatefulSet, err error) {
|
||||
result = &apps.StatefulSet{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Name(name).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
|
||||
func (c *statefulSets) List(opts api.ListOptions) (result *apps.StatefulSetList, err error) {
|
||||
result = &apps.StatefulSetList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested statefulSets.
|
||||
func (c *statefulSets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched statefulSet.
|
||||
func (c *statefulSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *apps.StatefulSet, err error) {
|
||||
result = &apps.StatefulSet{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
@ -25,7 +25,6 @@ import (
|
||||
|
||||
type AppsInterface interface {
|
||||
GetRESTClient() *restclient.RESTClient
|
||||
PetSetsGetter
|
||||
}
|
||||
|
||||
// AppsClient is used to interact with features provided by the Apps group.
|
||||
@ -33,10 +32,6 @@ type AppsClient struct {
|
||||
*restclient.RESTClient
|
||||
}
|
||||
|
||||
func (c *AppsClient) PetSets(namespace string) PetSetInterface {
|
||||
return newPetSets(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new AppsClient for the given config.
|
||||
func NewForConfig(c *restclient.Config) (*AppsClient, error) {
|
||||
config := *c
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1alpha1 "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_4/typed/apps/v1alpha1"
|
||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||
)
|
||||
@ -26,10 +25,6 @@ type FakeApps struct {
|
||||
*core.Fake
|
||||
}
|
||||
|
||||
func (c *FakeApps) PetSets(namespace string) v1alpha1.PetSetInterface {
|
||||
return &FakePetSets{c, namespace}
|
||||
}
|
||||
|
||||
// GetRESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeApps) GetRESTClient() *restclient.RESTClient {
|
||||
|
@ -1,127 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 fake
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
v1alpha1 "k8s.io/kubernetes/pkg/apis/apps/v1alpha1"
|
||||
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||
labels "k8s.io/kubernetes/pkg/labels"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// FakePetSets implements PetSetInterface
|
||||
type FakePetSets struct {
|
||||
Fake *FakeApps
|
||||
ns string
|
||||
}
|
||||
|
||||
var petsetsResource = unversioned.GroupVersionResource{Group: "apps", Version: "v1alpha1", Resource: "petsets"}
|
||||
|
||||
func (c *FakePetSets) Create(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewCreateAction(petsetsResource, c.ns, petSet), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) Update(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateAction(petsetsResource, c.ns, petSet), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) UpdateStatus(petSet *v1alpha1.PetSet) (*v1alpha1.PetSet, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateSubresourceAction(petsetsResource, "status", c.ns, petSet), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) Delete(name string, options *api.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(core.NewDeleteAction(petsetsResource, c.ns, name), &v1alpha1.PetSet{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
action := core.NewDeleteCollectionAction(petsetsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.PetSetList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) Get(name string) (result *v1alpha1.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewGetAction(petsetsResource, c.ns, name), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) List(opts api.ListOptions) (result *v1alpha1.PetSetList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewListAction(petsetsResource, c.ns, opts), &v1alpha1.PetSetList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label := opts.LabelSelector
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.PetSetList{}
|
||||
for _, item := range obj.(*v1alpha1.PetSetList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested petSets.
|
||||
func (c *FakePetSets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(core.NewWatchAction(petsetsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched petSet.
|
||||
func (c *FakePetSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewPatchSubresourceAction(petsetsResource, c.ns, name, data, subresources...), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
@ -1,165 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 v1alpha1
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
v1alpha1 "k8s.io/kubernetes/pkg/apis/apps/v1alpha1"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// PetSetsGetter has a method to return a PetSetInterface.
|
||||
// A group's client should implement this interface.
|
||||
type PetSetsGetter interface {
|
||||
PetSets(namespace string) PetSetInterface
|
||||
}
|
||||
|
||||
// PetSetInterface has methods to work with PetSet resources.
|
||||
type PetSetInterface interface {
|
||||
Create(*v1alpha1.PetSet) (*v1alpha1.PetSet, error)
|
||||
Update(*v1alpha1.PetSet) (*v1alpha1.PetSet, error)
|
||||
UpdateStatus(*v1alpha1.PetSet) (*v1alpha1.PetSet, error)
|
||||
Delete(name string, options *api.DeleteOptions) error
|
||||
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
|
||||
Get(name string) (*v1alpha1.PetSet, error)
|
||||
List(opts api.ListOptions) (*v1alpha1.PetSetList, error)
|
||||
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.PetSet, err error)
|
||||
PetSetExpansion
|
||||
}
|
||||
|
||||
// petSets implements PetSetInterface
|
||||
type petSets struct {
|
||||
client *AppsClient
|
||||
ns string
|
||||
}
|
||||
|
||||
// newPetSets returns a PetSets
|
||||
func newPetSets(c *AppsClient, namespace string) *petSets {
|
||||
return &petSets{
|
||||
client: c,
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Create takes the representation of a petSet and creates it. Returns the server's representation of the petSet, and an error, if there is any.
|
||||
func (c *petSets) Create(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Body(petSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a petSet and updates it. Returns the server's representation of the petSet, and an error, if there is any.
|
||||
func (c *petSets) Update(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(petSet.Name).
|
||||
Body(petSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *petSets) UpdateStatus(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(petSet.Name).
|
||||
SubResource("status").
|
||||
Body(petSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the petSet and deletes it. Returns an error if one occurs.
|
||||
func (c *petSets) Delete(name string, options *api.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *petSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
VersionedParams(&listOptions, api.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Get takes name of the petSet, and returns the corresponding petSet object, and an error if there is any.
|
||||
func (c *petSets) Get(name string) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(name).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of PetSets that match those selectors.
|
||||
func (c *petSets) List(opts api.ListOptions) (result *v1alpha1.PetSetList, err error) {
|
||||
result = &v1alpha1.PetSetList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested petSets.
|
||||
func (c *petSets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched petSet.
|
||||
func (c *petSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
@ -16,7 +16,7 @@ go_library(
|
||||
"apps_client.go",
|
||||
"doc.go",
|
||||
"generated_expansion.go",
|
||||
"petset.go",
|
||||
"statefulset.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
|
||||
type AppsInterface interface {
|
||||
RESTClient() restclient.Interface
|
||||
PetSetsGetter
|
||||
StatefulSetsGetter
|
||||
}
|
||||
|
||||
// AppsClient is used to interact with features provided by the Apps group.
|
||||
@ -33,8 +33,8 @@ type AppsClient struct {
|
||||
restClient restclient.Interface
|
||||
}
|
||||
|
||||
func (c *AppsClient) PetSets(namespace string) PetSetInterface {
|
||||
return newPetSets(c, namespace)
|
||||
func (c *AppsClient) StatefulSets(namespace string) StatefulSetInterface {
|
||||
return newStatefulSets(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new AppsClient for the given config.
|
||||
|
@ -15,7 +15,7 @@ go_library(
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"fake_apps_client.go",
|
||||
"fake_petset.go",
|
||||
"fake_statefulset.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
|
@ -26,8 +26,8 @@ type FakeApps struct {
|
||||
*core.Fake
|
||||
}
|
||||
|
||||
func (c *FakeApps) PetSets(namespace string) v1alpha1.PetSetInterface {
|
||||
return &FakePetSets{c, namespace}
|
||||
func (c *FakeApps) StatefulSets(namespace string) v1alpha1.StatefulSetInterface {
|
||||
return &FakeStatefulSets{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
|
@ -1,128 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 fake
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
v1alpha1 "k8s.io/kubernetes/pkg/apis/apps/v1alpha1"
|
||||
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||
labels "k8s.io/kubernetes/pkg/labels"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// FakePetSets implements PetSetInterface
|
||||
type FakePetSets struct {
|
||||
Fake *FakeApps
|
||||
ns string
|
||||
}
|
||||
|
||||
var petsetsResource = unversioned.GroupVersionResource{Group: "apps", Version: "v1alpha1", Resource: "petsets"}
|
||||
|
||||
func (c *FakePetSets) Create(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewCreateAction(petsetsResource, c.ns, petSet), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) Update(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateAction(petsetsResource, c.ns, petSet), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) UpdateStatus(petSet *v1alpha1.PetSet) (*v1alpha1.PetSet, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateSubresourceAction(petsetsResource, "status", c.ns, petSet), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(core.NewDeleteAction(petsetsResource, c.ns, name), &v1alpha1.PetSet{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := core.NewDeleteCollectionAction(petsetsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.PetSetList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) Get(name string) (result *v1alpha1.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewGetAction(petsetsResource, c.ns, name), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
||||
|
||||
func (c *FakePetSets) List(opts v1.ListOptions) (result *v1alpha1.PetSetList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewListAction(petsetsResource, c.ns, opts), &v1alpha1.PetSetList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := core.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.PetSetList{}
|
||||
for _, item := range obj.(*v1alpha1.PetSetList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested petSets.
|
||||
func (c *FakePetSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(core.NewWatchAction(petsetsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched petSet.
|
||||
func (c *FakePetSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.PetSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewPatchSubresourceAction(petsetsResource, c.ns, name, data, subresources...), &v1alpha1.PetSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PetSet), err
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 fake
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
v1alpha1 "k8s.io/kubernetes/pkg/apis/apps/v1alpha1"
|
||||
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||
labels "k8s.io/kubernetes/pkg/labels"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// FakeStatefulSets implements StatefulSetInterface
|
||||
type FakeStatefulSets struct {
|
||||
Fake *FakeApps
|
||||
ns string
|
||||
}
|
||||
|
||||
var statefulsetsResource = unversioned.GroupVersionResource{Group: "apps", Version: "v1alpha1", Resource: "statefulsets"}
|
||||
|
||||
func (c *FakeStatefulSets) Create(statefulSet *v1alpha1.StatefulSet) (result *v1alpha1.StatefulSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewCreateAction(statefulsetsResource, c.ns, statefulSet), &v1alpha1.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.StatefulSet), err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) Update(statefulSet *v1alpha1.StatefulSet) (result *v1alpha1.StatefulSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateAction(statefulsetsResource, c.ns, statefulSet), &v1alpha1.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.StatefulSet), err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) UpdateStatus(statefulSet *v1alpha1.StatefulSet) (*v1alpha1.StatefulSet, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateSubresourceAction(statefulsetsResource, "status", c.ns, statefulSet), &v1alpha1.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.StatefulSet), err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(core.NewDeleteAction(statefulsetsResource, c.ns, name), &v1alpha1.StatefulSet{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := core.NewDeleteCollectionAction(statefulsetsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.StatefulSetList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) Get(name string) (result *v1alpha1.StatefulSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewGetAction(statefulsetsResource, c.ns, name), &v1alpha1.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.StatefulSet), err
|
||||
}
|
||||
|
||||
func (c *FakeStatefulSets) List(opts v1.ListOptions) (result *v1alpha1.StatefulSetList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewListAction(statefulsetsResource, c.ns, opts), &v1alpha1.StatefulSetList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := core.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.StatefulSetList{}
|
||||
for _, item := range obj.(*v1alpha1.StatefulSetList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested statefulSets.
|
||||
func (c *FakeStatefulSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(core.NewWatchAction(statefulsetsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched statefulSet.
|
||||
func (c *FakeStatefulSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.StatefulSet, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewPatchSubresourceAction(statefulsetsResource, c.ns, name, data, subresources...), &v1alpha1.StatefulSet{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.StatefulSet), err
|
||||
}
|
@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
type PetSetExpansion interface{}
|
||||
type StatefulSetExpansion interface{}
|
||||
|
@ -1,167 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 v1alpha1
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
v1alpha1 "k8s.io/kubernetes/pkg/apis/apps/v1alpha1"
|
||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// PetSetsGetter has a method to return a PetSetInterface.
|
||||
// A group's client should implement this interface.
|
||||
type PetSetsGetter interface {
|
||||
PetSets(namespace string) PetSetInterface
|
||||
}
|
||||
|
||||
// PetSetInterface has methods to work with PetSet resources.
|
||||
type PetSetInterface interface {
|
||||
Create(*v1alpha1.PetSet) (*v1alpha1.PetSet, error)
|
||||
Update(*v1alpha1.PetSet) (*v1alpha1.PetSet, error)
|
||||
UpdateStatus(*v1alpha1.PetSet) (*v1alpha1.PetSet, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string) (*v1alpha1.PetSet, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.PetSetList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.PetSet, err error)
|
||||
PetSetExpansion
|
||||
}
|
||||
|
||||
// petSets implements PetSetInterface
|
||||
type petSets struct {
|
||||
client restclient.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newPetSets returns a PetSets
|
||||
func newPetSets(c *AppsClient, namespace string) *petSets {
|
||||
return &petSets{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Create takes the representation of a petSet and creates it. Returns the server's representation of the petSet, and an error, if there is any.
|
||||
func (c *petSets) Create(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Body(petSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a petSet and updates it. Returns the server's representation of the petSet, and an error, if there is any.
|
||||
func (c *petSets) Update(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(petSet.Name).
|
||||
Body(petSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *petSets) UpdateStatus(petSet *v1alpha1.PetSet) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(petSet.Name).
|
||||
SubResource("status").
|
||||
Body(petSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the petSet and deletes it. Returns an error if one occurs.
|
||||
func (c *petSets) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *petSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
VersionedParams(&listOptions, api.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Get takes name of the petSet, and returns the corresponding petSet object, and an error if there is any.
|
||||
func (c *petSets) Get(name string) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
Name(name).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of PetSets that match those selectors.
|
||||
func (c *petSets) List(opts v1.ListOptions) (result *v1alpha1.PetSetList, err error) {
|
||||
result = &v1alpha1.PetSetList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested petSets.
|
||||
func (c *petSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched petSet.
|
||||
func (c *petSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.PetSet, err error) {
|
||||
result = &v1alpha1.PetSet{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("petsets").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
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 v1alpha1
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
v1alpha1 "k8s.io/kubernetes/pkg/apis/apps/v1alpha1"
|
||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// StatefulSetsGetter has a method to return a StatefulSetInterface.
|
||||
// A group's client should implement this interface.
|
||||
type StatefulSetsGetter interface {
|
||||
StatefulSets(namespace string) StatefulSetInterface
|
||||
}
|
||||
|
||||
// StatefulSetInterface has methods to work with StatefulSet resources.
|
||||
type StatefulSetInterface interface {
|
||||
Create(*v1alpha1.StatefulSet) (*v1alpha1.StatefulSet, error)
|
||||
Update(*v1alpha1.StatefulSet) (*v1alpha1.StatefulSet, error)
|
||||
UpdateStatus(*v1alpha1.StatefulSet) (*v1alpha1.StatefulSet, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string) (*v1alpha1.StatefulSet, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.StatefulSetList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.StatefulSet, err error)
|
||||
StatefulSetExpansion
|
||||
}
|
||||
|
||||
// statefulSets implements StatefulSetInterface
|
||||
type statefulSets struct {
|
||||
client restclient.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newStatefulSets returns a StatefulSets
|
||||
func newStatefulSets(c *AppsClient, namespace string) *statefulSets {
|
||||
return &statefulSets{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any.
|
||||
func (c *statefulSets) Create(statefulSet *v1alpha1.StatefulSet) (result *v1alpha1.StatefulSet, err error) {
|
||||
result = &v1alpha1.StatefulSet{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Body(statefulSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any.
|
||||
func (c *statefulSets) Update(statefulSet *v1alpha1.StatefulSet) (result *v1alpha1.StatefulSet, err error) {
|
||||
result = &v1alpha1.StatefulSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSet.Name).
|
||||
Body(statefulSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *statefulSets) UpdateStatus(statefulSet *v1alpha1.StatefulSet) (result *v1alpha1.StatefulSet, err error) {
|
||||
result = &v1alpha1.StatefulSet{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSet.Name).
|
||||
SubResource("status").
|
||||
Body(statefulSet).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
|
||||
func (c *statefulSets) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *statefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
VersionedParams(&listOptions, api.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any.
|
||||
func (c *statefulSets) Get(name string) (result *v1alpha1.StatefulSet, err error) {
|
||||
result = &v1alpha1.StatefulSet{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Name(name).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
|
||||
func (c *statefulSets) List(opts v1.ListOptions) (result *v1alpha1.StatefulSetList, err error) {
|
||||
result = &v1alpha1.StatefulSetList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested statefulSets.
|
||||
func (c *statefulSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched statefulSet.
|
||||
func (c *statefulSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.StatefulSet, err error) {
|
||||
result = &v1alpha1.StatefulSet{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
@ -77,11 +77,11 @@ func ReplicaSetHasDesiredReplicas(rsClient extensionsclient.ReplicaSetsGetter, r
|
||||
}
|
||||
}
|
||||
|
||||
// PetSetHasDesiredPets returns a conditon that checks the number of petset replicas
|
||||
func PetSetHasDesiredPets(psClient appsclient.PetSetsGetter, petset *apps.PetSet) wait.ConditionFunc {
|
||||
// StatefulSetHasDesiredPets returns a conditon that checks the number of petset replicas
|
||||
func StatefulSetHasDesiredPets(psClient appsclient.StatefulSetsGetter, petset *apps.StatefulSet) wait.ConditionFunc {
|
||||
// TODO: Differentiate between 0 pets and a really quick scale down using generation.
|
||||
return func() (bool, error) {
|
||||
ps, err := psClient.PetSets(petset.Namespace).Get(petset.Name)
|
||||
ps, err := psClient.StatefulSets(petset.Namespace).Get(petset.Name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ const (
|
||||
|
||||
// An annotation on the Service denoting if the endpoints controller should
|
||||
// go ahead and create endpoints for unready pods. This annotation is
|
||||
// currently only used by PetSets, where we need the pet to be DNS
|
||||
// currently only used by StatefulSets, where we need the pod to be DNS
|
||||
// resolvable during initialization. In this situation we create a headless
|
||||
// service just for the PetSet, and clients shouldn't be using this Service
|
||||
// service just for the StatefulSet, and clients shouldn't be using this Service
|
||||
// for anything so unready endpoints don't matter.
|
||||
TolerateUnreadyEndpointsAnnotation = "service.alpha.kubernetes.io/tolerate-unready-endpoints"
|
||||
)
|
||||
|
@ -51,7 +51,7 @@ func newPVC(name string) api.PersistentVolumeClaim {
|
||||
}
|
||||
}
|
||||
|
||||
func newPetSetWithVolumes(replicas int, name string, petMounts []api.VolumeMount, podMounts []api.VolumeMount) *apps.PetSet {
|
||||
func newStatefulSetWithVolumes(replicas int, name string, petMounts []api.VolumeMount, podMounts []api.VolumeMount) *apps.StatefulSet {
|
||||
mounts := append(petMounts, podMounts...)
|
||||
claims := []api.PersistentVolumeClaim{}
|
||||
for _, m := range petMounts {
|
||||
@ -70,9 +70,9 @@ func newPetSetWithVolumes(replicas int, name string, petMounts []api.VolumeMount
|
||||
})
|
||||
}
|
||||
|
||||
return &apps.PetSet{
|
||||
return &apps.StatefulSet{
|
||||
TypeMeta: unversioned.TypeMeta{
|
||||
Kind: "PetSet",
|
||||
Kind: "StatefulSet",
|
||||
APIVersion: "apps/v1beta1",
|
||||
},
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
@ -80,7 +80,7 @@ func newPetSetWithVolumes(replicas int, name string, petMounts []api.VolumeMount
|
||||
Namespace: api.NamespaceDefault,
|
||||
UID: types.UID("test"),
|
||||
},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{
|
||||
MatchLabels: map[string]string{"foo": "bar"},
|
||||
},
|
||||
@ -110,7 +110,7 @@ func runningPod(ns, name string) *api.Pod {
|
||||
return p
|
||||
}
|
||||
|
||||
func newPodList(ps *apps.PetSet, num int) []*api.Pod {
|
||||
func newPodList(ps *apps.StatefulSet, num int) []*api.Pod {
|
||||
// knownPods are pods in the system
|
||||
knownPods := []*api.Pod{}
|
||||
for i := 0; i < num; i++ {
|
||||
@ -120,14 +120,14 @@ func newPodList(ps *apps.PetSet, num int) []*api.Pod {
|
||||
return knownPods
|
||||
}
|
||||
|
||||
func newPetSet(replicas int) *apps.PetSet {
|
||||
func newStatefulSet(replicas int) *apps.StatefulSet {
|
||||
petMounts := []api.VolumeMount{
|
||||
{Name: "datadir", MountPath: "/tmp/zookeeper"},
|
||||
}
|
||||
podMounts := []api.VolumeMount{
|
||||
{Name: "home", MountPath: "/home"},
|
||||
}
|
||||
return newPetSetWithVolumes(replicas, "foo", petMounts, podMounts)
|
||||
return newStatefulSetWithVolumes(replicas, "foo", petMounts, podMounts)
|
||||
}
|
||||
|
||||
func checkPodForMount(pod *api.Pod, mountName string) error {
|
||||
@ -168,14 +168,14 @@ func (f *fakePetClient) Delete(p *pcb) error {
|
||||
for i, pet := range f.pets {
|
||||
if p.pod.Name == pet.pod.Name {
|
||||
found = true
|
||||
f.recorder.Eventf(pet.parent, api.EventTypeNormal, "SuccessfulDelete", "pet: %v", pet.pod.Name)
|
||||
f.recorder.Eventf(pet.parent, api.EventTypeNormal, "SuccessfulDelete", "pod: %v", pet.pod.Name)
|
||||
continue
|
||||
}
|
||||
pets = append(pets, f.pets[i])
|
||||
}
|
||||
if !found {
|
||||
// TODO: Return proper not found error
|
||||
return fmt.Errorf("Delete failed: pet %v doesn't exist", p.pod.Name)
|
||||
return fmt.Errorf("Delete failed: pod %v doesn't exist", p.pod.Name)
|
||||
}
|
||||
f.pets = pets
|
||||
f.petsDeleted++
|
||||
@ -196,10 +196,10 @@ func (f *fakePetClient) Get(p *pcb) (*pcb, bool, error) {
|
||||
func (f *fakePetClient) Create(p *pcb) error {
|
||||
for _, pet := range f.pets {
|
||||
if p.pod.Name == pet.pod.Name {
|
||||
return fmt.Errorf("Create failed: pet %v already exists", p.pod.Name)
|
||||
return fmt.Errorf("Create failed: pod %v already exists", p.pod.Name)
|
||||
}
|
||||
}
|
||||
f.recorder.Eventf(p.parent, api.EventTypeNormal, "SuccessfulCreate", "pet: %v", p.pod.Name)
|
||||
f.recorder.Eventf(p.parent, api.EventTypeNormal, "SuccessfulCreate", "pod: %v", p.pod.Name)
|
||||
f.pets = append(f.pets, p)
|
||||
f.petsCreated++
|
||||
return nil
|
||||
@ -220,7 +220,7 @@ func (f *fakePetClient) Update(expected, wanted *pcb) error {
|
||||
}
|
||||
f.pets = pets
|
||||
if !found {
|
||||
return fmt.Errorf("Cannot update pet %v not found", wanted.pod.Name)
|
||||
return fmt.Errorf("Cannot update pod %v not found", wanted.pod.Name)
|
||||
}
|
||||
// TODO: Delete pvcs/volumes that are in wanted but not in expected.
|
||||
return nil
|
||||
@ -252,7 +252,7 @@ func (f *fakePetClient) setHealthy(index int) error {
|
||||
return fmt.Errorf("Index out of range, len %v index %v", len(f.pets), index)
|
||||
}
|
||||
f.pets[index].pod.Status.Phase = api.PodRunning
|
||||
f.pets[index].pod.Annotations[PetSetInitAnnotation] = "true"
|
||||
f.pets[index].pod.Annotations[StatefulSetInitAnnotation] = "true"
|
||||
f.pets[index].pod.Status.Conditions = []api.PodCondition{
|
||||
{Type: api.PodReady, Status: api.ConditionTrue},
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import (
|
||||
)
|
||||
|
||||
// identityMapper is an interface for assigning identities to a pet.
|
||||
// All existing identity mappers just append "-(index)" to the petset name to
|
||||
// All existing identity mappers just append "-(index)" to the statefulset name to
|
||||
// generate a unique identity. This is used in claims/DNS/hostname/petname
|
||||
// etc. There's a more elegant way to achieve this mapping, but we're
|
||||
// taking the simplest route till we have data on whether users will need
|
||||
@ -39,15 +39,15 @@ import (
|
||||
// your pet a unique identity. You must run them all. Order doesn't matter.
|
||||
type identityMapper interface {
|
||||
// SetIdentity takes an id and assigns the given pet an identity based
|
||||
// on the pet set spec. The is must be unique amongst members of the
|
||||
// pet set.
|
||||
// on the stateful set spec. The is must be unique amongst members of the
|
||||
// stateful set.
|
||||
SetIdentity(id string, pet *api.Pod)
|
||||
|
||||
// Identity returns the identity of the pet.
|
||||
Identity(pod *api.Pod) string
|
||||
}
|
||||
|
||||
func newIdentityMappers(ps *apps.PetSet) []identityMapper {
|
||||
func newIdentityMappers(ps *apps.StatefulSet) []identityMapper {
|
||||
return []identityMapper{
|
||||
&NameIdentityMapper{ps},
|
||||
&NetworkIdentityMapper{ps},
|
||||
@ -57,7 +57,7 @@ func newIdentityMappers(ps *apps.PetSet) []identityMapper {
|
||||
|
||||
// NetworkIdentityMapper assigns network identity to pets.
|
||||
type NetworkIdentityMapper struct {
|
||||
ps *apps.PetSet
|
||||
ps *apps.StatefulSet
|
||||
}
|
||||
|
||||
// SetIdentity sets network identity on the pet.
|
||||
@ -81,7 +81,7 @@ func (n *NetworkIdentityMapper) String(pet *api.Pod) string {
|
||||
|
||||
// VolumeIdentityMapper assigns storage identity to pets.
|
||||
type VolumeIdentityMapper struct {
|
||||
ps *apps.PetSet
|
||||
ps *apps.StatefulSet
|
||||
}
|
||||
|
||||
// SetIdentity sets storge identity on the pet.
|
||||
@ -90,16 +90,16 @@ func (v *VolumeIdentityMapper) SetIdentity(id string, pet *api.Pod) {
|
||||
petClaims := v.GetClaims(id)
|
||||
|
||||
// These volumes will all go down with the pod. If a name matches one of
|
||||
// the claims in the pet set, it gets clobbered.
|
||||
// the claims in the stateful set, it gets clobbered.
|
||||
podVolumes := map[string]api.Volume{}
|
||||
for _, podVol := range pet.Spec.Volumes {
|
||||
podVolumes[podVol.Name] = podVol
|
||||
}
|
||||
|
||||
// Insert claims for the idempotent petSet volumes
|
||||
// Insert claims for the idempotent statefulset volumes
|
||||
for name, claim := range petClaims {
|
||||
// Volumes on a pet for which there are no associated claims on the
|
||||
// petset are pod local, and die with the pod.
|
||||
// statefulset are pod local, and die with the pod.
|
||||
podVol, ok := podVolumes[name]
|
||||
if ok {
|
||||
// TODO: Validate and reject this.
|
||||
@ -143,7 +143,7 @@ func (v *VolumeIdentityMapper) String(pet *api.Pod) string {
|
||||
}
|
||||
for _, podVol := range pet.Spec.Volumes {
|
||||
// Volumes on a pet for which there are no associated claims on the
|
||||
// petset are pod local, and die with the pod.
|
||||
// statefulset are pod local, and die with the pod.
|
||||
if !petVols.Has(podVol.Name) {
|
||||
continue
|
||||
}
|
||||
@ -159,7 +159,7 @@ func (v *VolumeIdentityMapper) String(pet *api.Pod) string {
|
||||
}
|
||||
|
||||
// GetClaims returns the volume claims associated with the given id.
|
||||
// The claims belong to the petset. The id should be unique within a petset.
|
||||
// The claims belong to the statefulset. The id should be unique within a statefulset.
|
||||
func (v *VolumeIdentityMapper) GetClaims(id string) map[string]api.PersistentVolumeClaim {
|
||||
petClaims := map[string]api.PersistentVolumeClaim{}
|
||||
for _, pvc := range v.ps.Spec.VolumeClaimTemplates {
|
||||
@ -192,7 +192,7 @@ func (v *VolumeIdentityMapper) GetClaimsForPet(pet *api.Pod) []api.PersistentVol
|
||||
// NameIdentityMapper assigns names to pets.
|
||||
// It also puts the pet in the same namespace as the parent.
|
||||
type NameIdentityMapper struct {
|
||||
ps *apps.PetSet
|
||||
ps *apps.StatefulSet
|
||||
}
|
||||
|
||||
// SetIdentity sets the pet namespace and name.
|
||||
@ -214,7 +214,7 @@ func (n *NameIdentityMapper) String(pet *api.Pod) string {
|
||||
|
||||
// identityHash computes a hash of the pet by running all the above identity
|
||||
// mappers.
|
||||
func identityHash(ps *apps.PetSet, pet *api.Pod) string {
|
||||
func identityHash(ps *apps.StatefulSet, pet *api.Pod) string {
|
||||
id := ""
|
||||
for _, idMapper := range newIdentityMappers(ps) {
|
||||
id += idMapper.Identity(pet)
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
|
||||
func TestPetIDName(t *testing.T) {
|
||||
replicas := 3
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
for i := 0; i < replicas; i++ {
|
||||
petName := fmt.Sprintf("%v-%d", ps.Name, i)
|
||||
pcb, err := newPCB(fmt.Sprintf("%d", i), ps)
|
||||
@ -45,7 +45,7 @@ func TestPetIDName(t *testing.T) {
|
||||
|
||||
func TestPetIDDNS(t *testing.T) {
|
||||
replicas := 3
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
for i := 0; i < replicas; i++ {
|
||||
petName := fmt.Sprintf("%v-%d", ps.Name, i)
|
||||
petSubdomain := ps.Spec.ServiceName
|
||||
@ -65,7 +65,7 @@ func TestPetIDDNS(t *testing.T) {
|
||||
}
|
||||
func TestPetIDVolume(t *testing.T) {
|
||||
replicas := 3
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
for i := 0; i < replicas; i++ {
|
||||
pcb, err := newPCB(fmt.Sprintf("%d", i), ps)
|
||||
if err != nil {
|
||||
@ -99,7 +99,7 @@ func TestPetIDVolume(t *testing.T) {
|
||||
|
||||
func TestPetIDVolumeClaims(t *testing.T) {
|
||||
replicas := 3
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
for i := 0; i < replicas; i++ {
|
||||
pcb, err := newPCB(fmt.Sprintf("%v", i), ps)
|
||||
if err != nil {
|
||||
@ -116,7 +116,7 @@ func TestPetIDVolumeClaims(t *testing.T) {
|
||||
|
||||
func TestPetIDCrossAssignment(t *testing.T) {
|
||||
replicas := 3
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
|
||||
nameMapper := &NameIdentityMapper{ps}
|
||||
volumeMapper := &VolumeIdentityMapper{ps}
|
||||
@ -144,7 +144,7 @@ func TestPetIDCrossAssignment(t *testing.T) {
|
||||
|
||||
func TestPetIDReset(t *testing.T) {
|
||||
replicas := 2
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
firstPCB, err := newPCB("1", ps)
|
||||
secondPCB, err := newPCB("2", ps)
|
||||
if identityHash(ps, firstPCB.pod) == identityHash(ps, secondPCB.pod) {
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
)
|
||||
|
||||
// newPCB generates a new PCB using the id string as a unique qualifier
|
||||
func newPCB(id string, ps *apps.PetSet) (*pcb, error) {
|
||||
func newPCB(id string, ps *apps.StatefulSet) (*pcb, error) {
|
||||
petPod, err := controller.GetPodFromTemplate(&ps.Spec.Template, ps, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -87,7 +87,7 @@ func (pt *petQueue) empty() bool {
|
||||
}
|
||||
|
||||
// NewPetQueue returns a queue for tracking pets
|
||||
func NewPetQueue(ps *apps.PetSet, podList []*api.Pod) *petQueue {
|
||||
func NewPetQueue(ps *apps.StatefulSet, podList []*api.Pod) *petQueue {
|
||||
pt := petQueue{pets: []*pcb{}, idMapper: &NameIdentityMapper{ps}}
|
||||
// Seed the queue with existing pets. Assume all pets are scheduled for
|
||||
// deletion, enqueuing a pet will "undelete" it. We always want to delete
|
||||
@ -102,10 +102,10 @@ func NewPetQueue(ps *apps.PetSet, podList []*api.Pod) *petQueue {
|
||||
return &pt
|
||||
}
|
||||
|
||||
// petsetIterator implements a simple iterator over pets in the given petset.
|
||||
type petSetIterator struct {
|
||||
// ps is the petset for this iterator.
|
||||
ps *apps.PetSet
|
||||
// statefulsetIterator implements a simple iterator over pets in the given statefulset.
|
||||
type statefulSetIterator struct {
|
||||
// ps is the statefulset for this iterator.
|
||||
ps *apps.StatefulSet
|
||||
// queue contains the elements to iterate over.
|
||||
queue *petQueue
|
||||
// errs is a list because we always want the iterator to drain.
|
||||
@ -115,7 +115,7 @@ type petSetIterator struct {
|
||||
}
|
||||
|
||||
// Next returns true for as long as there are elements in the underlying queue.
|
||||
func (pi *petSetIterator) Next() bool {
|
||||
func (pi *statefulSetIterator) Next() bool {
|
||||
var pet *pcb
|
||||
var err error
|
||||
if pi.petCount < pi.ps.Spec.Replicas {
|
||||
@ -133,14 +133,14 @@ func (pi *petSetIterator) Next() bool {
|
||||
}
|
||||
|
||||
// Value dequeues an element from the queue.
|
||||
func (pi *petSetIterator) Value() *pcb {
|
||||
func (pi *statefulSetIterator) Value() *pcb {
|
||||
return pi.queue.dequeue()
|
||||
}
|
||||
|
||||
// NewPetSetIterator returns a new iterator. All pods in the given podList
|
||||
// NewStatefulSetIterator returns a new iterator. All pods in the given podList
|
||||
// are used to seed the queue of the iterator.
|
||||
func NewPetSetIterator(ps *apps.PetSet, podList []*api.Pod) *petSetIterator {
|
||||
pi := &petSetIterator{
|
||||
func NewStatefulSetIterator(ps *apps.StatefulSet, podList []*api.Pod) *statefulSetIterator {
|
||||
pi := &statefulSetIterator{
|
||||
ps: ps,
|
||||
queue: NewPetQueue(ps, podList),
|
||||
errs: []error{},
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
|
||||
func TestPetQueueCreates(t *testing.T) {
|
||||
replicas := 3
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
q := NewPetQueue(ps, []*api.Pod{})
|
||||
for i := 0; i < replicas; i++ {
|
||||
pet, _ := newPCB(fmt.Sprintf("%v", i), ps)
|
||||
@ -38,13 +38,13 @@ func TestPetQueueCreates(t *testing.T) {
|
||||
}
|
||||
}
|
||||
if q.dequeue() != nil {
|
||||
t.Errorf("Expected no pets")
|
||||
t.Errorf("Expected no pods")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPetQueueScaleDown(t *testing.T) {
|
||||
replicas := 1
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
|
||||
// knownPods are the pods in the system
|
||||
knownPods := newPodList(ps, 3)
|
||||
@ -74,13 +74,13 @@ func TestPetQueueScaleDown(t *testing.T) {
|
||||
}
|
||||
}
|
||||
if q.dequeue() != nil {
|
||||
t.Errorf("Expected no pets")
|
||||
t.Errorf("Expected no pods")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPetQueueScaleUp(t *testing.T) {
|
||||
replicas := 5
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
|
||||
// knownPods are pods in the system
|
||||
knownPods := newPodList(ps, 2)
|
||||
@ -94,14 +94,14 @@ func TestPetQueueScaleUp(t *testing.T) {
|
||||
pet := q.dequeue()
|
||||
expectedName := fmt.Sprintf("%v-%d", ps.Name, i)
|
||||
if pet.event != syncPet || pet.pod.Name != expectedName {
|
||||
t.Errorf("Unexpected pet %+v, expected %v", pet.pod.Name, expectedName)
|
||||
t.Errorf("Unexpected pod %+v, expected %v", pet.pod.Name, expectedName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPetSetIteratorRelist(t *testing.T) {
|
||||
func TestStatefulSetIteratorRelist(t *testing.T) {
|
||||
replicas := 5
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
|
||||
// knownPods are pods in the system
|
||||
knownPods := newPodList(ps, 5)
|
||||
@ -109,7 +109,7 @@ func TestPetSetIteratorRelist(t *testing.T) {
|
||||
knownPods[i].Spec.NodeName = fmt.Sprintf("foo-node-%v", i)
|
||||
knownPods[i].Status.Phase = api.PodRunning
|
||||
}
|
||||
pi := NewPetSetIterator(ps, knownPods)
|
||||
pi := NewStatefulSetIterator(ps, knownPods)
|
||||
|
||||
// A simple resync should not change identity of pods in the system
|
||||
i := 0
|
||||
@ -124,12 +124,12 @@ func TestPetSetIteratorRelist(t *testing.T) {
|
||||
i++
|
||||
}
|
||||
if i != 5 {
|
||||
t.Errorf("Unexpected iterations %v, this probably means too many/few pets", i)
|
||||
t.Errorf("Unexpected iterations %v, this probably means too many/few pods", i)
|
||||
}
|
||||
|
||||
// Scale to 0 should delete all pods in system
|
||||
ps.Spec.Replicas = 0
|
||||
pi = NewPetSetIterator(ps, knownPods)
|
||||
pi = NewStatefulSetIterator(ps, knownPods)
|
||||
i = 0
|
||||
for pi.Next() {
|
||||
p := pi.Value()
|
||||
@ -139,11 +139,11 @@ func TestPetSetIteratorRelist(t *testing.T) {
|
||||
i++
|
||||
}
|
||||
if i != 5 {
|
||||
t.Errorf("Unexpected iterations %v, this probably means too many/few pets", i)
|
||||
t.Errorf("Unexpected iterations %v, this probably means too many/few pods", i)
|
||||
}
|
||||
|
||||
// Relist with 0 replicas should no-op
|
||||
pi = NewPetSetIterator(ps, []*api.Pod{})
|
||||
pi = NewStatefulSetIterator(ps, []*api.Pod{})
|
||||
if pi.Next() != false {
|
||||
t.Errorf("Unexpected iteration without any replicas or pods in system")
|
||||
}
|
||||
|
@ -41,10 +41,10 @@ const (
|
||||
// updateRetries is the number of Get/Update cycles we perform when an
|
||||
// update fails.
|
||||
updateRetries = 3
|
||||
// PetSetInitAnnotation is an annotation which when set, indicates that the
|
||||
// StatefulSetInitAnnotation is an annotation which when set, indicates that the
|
||||
// pet has finished initializing itself.
|
||||
// TODO: Replace this with init container status.
|
||||
PetSetInitAnnotation = "pod.alpha.kubernetes.io/initialized"
|
||||
StatefulSetInitAnnotation = "pod.alpha.kubernetes.io/initialized"
|
||||
)
|
||||
|
||||
// pcb is the control block used to transmit all updates about a single pet.
|
||||
@ -59,8 +59,8 @@ type pcb struct {
|
||||
event petLifeCycleEvent
|
||||
// id is the identity index of this pet.
|
||||
id string
|
||||
// parent is a pointer to the parent petset.
|
||||
parent *apps.PetSet
|
||||
// parent is a pointer to the parent statefulset.
|
||||
parent *apps.StatefulSet
|
||||
}
|
||||
|
||||
// pvcClient is a client for managing persistent volume claims.
|
||||
@ -113,12 +113,12 @@ func (p *petSyncer) Sync(pet *pcb) error {
|
||||
}
|
||||
} else if exists {
|
||||
if !p.isHealthy(realPet.pod) {
|
||||
glog.Infof("PetSet %v waiting on unhealthy pet %v", pet.parent.Name, realPet.pod.Name)
|
||||
glog.Infof("StatefulSet %v waiting on unhealthy pet %v", pet.parent.Name, realPet.pod.Name)
|
||||
}
|
||||
return p.Update(realPet, pet)
|
||||
}
|
||||
if p.blockingPet != nil {
|
||||
message := errUnhealthyPet(fmt.Sprintf("Create of %v in PetSet %v blocked by unhealthy pet %v", pet.pod.Name, pet.parent.Name, p.blockingPet.pod.Name))
|
||||
message := errUnhealthyPet(fmt.Sprintf("Create of %v in StatefulSet %v blocked by unhealthy pet %v", pet.pod.Name, pet.parent.Name, p.blockingPet.pod.Name))
|
||||
glog.Info(message)
|
||||
return message
|
||||
}
|
||||
@ -135,7 +135,7 @@ func (p *petSyncer) Sync(pet *pcb) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete deletes the given pet, if no other pet in the petset is blocking a
|
||||
// Delete deletes the given pet, if no other pet in the statefulset is blocking a
|
||||
// scale event.
|
||||
func (p *petSyncer) Delete(pet *pcb) error {
|
||||
if pet == nil {
|
||||
@ -149,17 +149,17 @@ func (p *petSyncer) Delete(pet *pcb) error {
|
||||
return nil
|
||||
}
|
||||
if p.blockingPet != nil {
|
||||
glog.Infof("Delete of %v in PetSet %v blocked by unhealthy pet %v", realPet.pod.Name, pet.parent.Name, p.blockingPet.pod.Name)
|
||||
glog.Infof("Delete of %v in StatefulSet %v blocked by unhealthy pet %v", realPet.pod.Name, pet.parent.Name, p.blockingPet.pod.Name)
|
||||
return nil
|
||||
}
|
||||
// This is counted as a delete, even if it fails.
|
||||
// The returned error will force a requeue.
|
||||
p.blockingPet = realPet
|
||||
if !p.isDying(realPet.pod) {
|
||||
glog.Infof("PetSet %v deleting pet %v", pet.parent.Name, pet.pod.Name)
|
||||
glog.Infof("StatefulSet %v deleting pet %v", pet.parent.Name, pet.pod.Name)
|
||||
return p.petClient.Delete(pet)
|
||||
}
|
||||
glog.Infof("PetSet %v waiting on pet %v to die in %v", pet.parent.Name, realPet.pod.Name, realPet.pod.DeletionTimestamp)
|
||||
glog.Infof("StatefulSet %v waiting on pet %v to die in %v", pet.parent.Name, realPet.pod.Name, realPet.pod.DeletionTimestamp)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ type petClient interface {
|
||||
Update(*pcb, *pcb) error
|
||||
}
|
||||
|
||||
// apiServerPetClient is a petset aware Kubernetes client.
|
||||
// apiServerPetClient is a statefulset aware Kubernetes client.
|
||||
type apiServerPetClient struct {
|
||||
c internalclientset.Interface
|
||||
recorder record.EventRecorder
|
||||
@ -223,7 +223,7 @@ func (p *apiServerPetClient) Update(pet *pcb, expectedPet *pcb) (updateErr error
|
||||
if err != nil || !needsUpdate {
|
||||
return err
|
||||
}
|
||||
glog.Infof("Resetting pet %v/%v to match PetSet %v spec", pet.pod.Namespace, pet.pod.Name, pet.parent.Name)
|
||||
glog.Infof("Resetting pet %v/%v to match StatefulSet %v spec", pet.pod.Namespace, pet.pod.Name, pet.parent.Name)
|
||||
_, updateErr = pc.Update(&updatePod)
|
||||
if updateErr == nil || i >= updateRetries {
|
||||
return updateErr
|
||||
@ -303,9 +303,9 @@ func (d *defaultPetHealthChecker) isHealthy(pod *api.Pod) bool {
|
||||
if pod == nil || pod.Status.Phase != api.PodRunning {
|
||||
return false
|
||||
}
|
||||
initialized, ok := pod.Annotations[PetSetInitAnnotation]
|
||||
initialized, ok := pod.Annotations[StatefulSetInitAnnotation]
|
||||
if !ok {
|
||||
glog.Infof("PetSet pod %v in %v, waiting on annotation %v", api.PodRunning, pod.Name, PetSetInitAnnotation)
|
||||
glog.Infof("StatefulSet pod %v in %v, waiting on annotation %v", api.PodRunning, pod.Name, StatefulSetInitAnnotation)
|
||||
return false
|
||||
}
|
||||
b, err := strconv.ParseBool(initialized)
|
||||
|
@ -46,12 +46,12 @@ const (
|
||||
PodStoreSyncedPollPeriod = 100 * time.Millisecond
|
||||
// number of retries for a status update.
|
||||
statusUpdateRetries = 2
|
||||
// period to relist petsets and verify pets
|
||||
petSetResyncPeriod = 30 * time.Second
|
||||
// period to relist statefulsets and verify pets
|
||||
statefulSetResyncPeriod = 30 * time.Second
|
||||
)
|
||||
|
||||
// PetSetController controls petsets.
|
||||
type PetSetController struct {
|
||||
// StatefulSetController controls statefulsets.
|
||||
type StatefulSetController struct {
|
||||
kubeClient internalclientset.Interface
|
||||
|
||||
// newSyncer returns an interface capable of syncing a single pet.
|
||||
@ -66,9 +66,9 @@ type PetSetController struct {
|
||||
// Watches changes to all pods.
|
||||
podController cache.ControllerInterface
|
||||
|
||||
// A store of PetSets, populated by the psController.
|
||||
psStore cache.StoreToPetSetLister
|
||||
// Watches changes to all PetSets.
|
||||
// A store of StatefulSets, populated by the psController.
|
||||
psStore cache.StoreToStatefulSetLister
|
||||
// Watches changes to all StatefulSets.
|
||||
psController *cache.Controller
|
||||
|
||||
// A store of the 1 unhealthy pet blocking progress for a given ps
|
||||
@ -77,34 +77,34 @@ type PetSetController struct {
|
||||
// Controllers that need to be synced.
|
||||
queue workqueue.RateLimitingInterface
|
||||
|
||||
// syncHandler handles sync events for petsets.
|
||||
// syncHandler handles sync events for statefulsets.
|
||||
// Abstracted as a func to allow injection for testing.
|
||||
syncHandler func(psKey string) error
|
||||
}
|
||||
|
||||
// NewPetSetController creates a new petset controller.
|
||||
func NewPetSetController(podInformer cache.SharedIndexInformer, kubeClient internalclientset.Interface, resyncPeriod time.Duration) *PetSetController {
|
||||
// NewStatefulSetController creates a new statefulset controller.
|
||||
func NewStatefulSetController(podInformer cache.SharedIndexInformer, kubeClient internalclientset.Interface, resyncPeriod time.Duration) *StatefulSetController {
|
||||
eventBroadcaster := record.NewBroadcaster()
|
||||
eventBroadcaster.StartLogging(glog.Infof)
|
||||
eventBroadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{Interface: kubeClient.Core().Events("")})
|
||||
recorder := eventBroadcaster.NewRecorder(api.EventSource{Component: "petset"})
|
||||
recorder := eventBroadcaster.NewRecorder(api.EventSource{Component: "statefulset"})
|
||||
pc := &apiServerPetClient{kubeClient, recorder, &defaultPetHealthChecker{}}
|
||||
|
||||
psc := &PetSetController{
|
||||
psc := &StatefulSetController{
|
||||
kubeClient: kubeClient,
|
||||
blockingPetStore: newUnHealthyPetTracker(pc),
|
||||
newSyncer: func(blockingPet *pcb) *petSyncer {
|
||||
return &petSyncer{pc, blockingPet}
|
||||
},
|
||||
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "petset"),
|
||||
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "statefulset"),
|
||||
}
|
||||
|
||||
podInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
// lookup the petset and enqueue
|
||||
// lookup the statefulset and enqueue
|
||||
AddFunc: psc.addPod,
|
||||
// lookup current and old petset if labels changed
|
||||
// lookup current and old statefulset if labels changed
|
||||
UpdateFunc: psc.updatePod,
|
||||
// lookup petset accounting for deletion tombstones
|
||||
// lookup statefulset accounting for deletion tombstones
|
||||
DeleteFunc: psc.deletePod,
|
||||
})
|
||||
psc.podStore.Indexer = podInformer.GetIndexer()
|
||||
@ -113,25 +113,25 @@ func NewPetSetController(podInformer cache.SharedIndexInformer, kubeClient inter
|
||||
psc.psStore.Store, psc.psController = cache.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options api.ListOptions) (runtime.Object, error) {
|
||||
return psc.kubeClient.Apps().PetSets(api.NamespaceAll).List(options)
|
||||
return psc.kubeClient.Apps().StatefulSets(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options api.ListOptions) (watch.Interface, error) {
|
||||
return psc.kubeClient.Apps().PetSets(api.NamespaceAll).Watch(options)
|
||||
return psc.kubeClient.Apps().StatefulSets(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&apps.PetSet{},
|
||||
petSetResyncPeriod,
|
||||
&apps.StatefulSet{},
|
||||
statefulSetResyncPeriod,
|
||||
cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: psc.enqueuePetSet,
|
||||
AddFunc: psc.enqueueStatefulSet,
|
||||
UpdateFunc: func(old, cur interface{}) {
|
||||
oldPS := old.(*apps.PetSet)
|
||||
curPS := cur.(*apps.PetSet)
|
||||
oldPS := old.(*apps.StatefulSet)
|
||||
curPS := cur.(*apps.StatefulSet)
|
||||
if oldPS.Status.Replicas != curPS.Status.Replicas {
|
||||
glog.V(4).Infof("Observed updated replica count for PetSet: %v, %d->%d", curPS.Name, oldPS.Status.Replicas, curPS.Status.Replicas)
|
||||
glog.V(4).Infof("Observed updated replica count for StatefulSet: %v, %d->%d", curPS.Name, oldPS.Status.Replicas, curPS.Status.Replicas)
|
||||
}
|
||||
psc.enqueuePetSet(cur)
|
||||
psc.enqueueStatefulSet(cur)
|
||||
},
|
||||
DeleteFunc: psc.enqueuePetSet,
|
||||
DeleteFunc: psc.enqueueStatefulSet,
|
||||
},
|
||||
)
|
||||
// TODO: Watch volumes
|
||||
@ -140,34 +140,34 @@ func NewPetSetController(podInformer cache.SharedIndexInformer, kubeClient inter
|
||||
return psc
|
||||
}
|
||||
|
||||
// Run runs the petset controller.
|
||||
func (psc *PetSetController) Run(workers int, stopCh <-chan struct{}) {
|
||||
// Run runs the statefulset controller.
|
||||
func (psc *StatefulSetController) Run(workers int, stopCh <-chan struct{}) {
|
||||
defer utilruntime.HandleCrash()
|
||||
glog.Infof("Starting petset controller")
|
||||
glog.Infof("Starting statefulset controller")
|
||||
go psc.podController.Run(stopCh)
|
||||
go psc.psController.Run(stopCh)
|
||||
for i := 0; i < workers; i++ {
|
||||
go wait.Until(psc.worker, time.Second, stopCh)
|
||||
}
|
||||
<-stopCh
|
||||
glog.Infof("Shutting down petset controller")
|
||||
glog.Infof("Shutting down statefulset controller")
|
||||
psc.queue.ShutDown()
|
||||
}
|
||||
|
||||
// addPod adds the petset for the pod to the sync queue
|
||||
func (psc *PetSetController) addPod(obj interface{}) {
|
||||
// addPod adds the statefulset for the pod to the sync queue
|
||||
func (psc *StatefulSetController) addPod(obj interface{}) {
|
||||
pod := obj.(*api.Pod)
|
||||
glog.V(4).Infof("Pod %s created, labels: %+v", pod.Name, pod.Labels)
|
||||
ps := psc.getPetSetForPod(pod)
|
||||
ps := psc.getStatefulSetForPod(pod)
|
||||
if ps == nil {
|
||||
return
|
||||
}
|
||||
psc.enqueuePetSet(ps)
|
||||
psc.enqueueStatefulSet(ps)
|
||||
}
|
||||
|
||||
// updatePod adds the petset for the current and old pods to the sync queue.
|
||||
// If the labels of the pod didn't change, this method enqueues a single petset.
|
||||
func (psc *PetSetController) updatePod(old, cur interface{}) {
|
||||
// updatePod adds the statefulset for the current and old pods to the sync queue.
|
||||
// If the labels of the pod didn't change, this method enqueues a single statefulset.
|
||||
func (psc *StatefulSetController) updatePod(old, cur interface{}) {
|
||||
curPod := cur.(*api.Pod)
|
||||
oldPod := old.(*api.Pod)
|
||||
if curPod.ResourceVersion == oldPod.ResourceVersion {
|
||||
@ -175,26 +175,26 @@ func (psc *PetSetController) updatePod(old, cur interface{}) {
|
||||
// Two different versions of the same pod will always have different RVs.
|
||||
return
|
||||
}
|
||||
ps := psc.getPetSetForPod(curPod)
|
||||
ps := psc.getStatefulSetForPod(curPod)
|
||||
if ps == nil {
|
||||
return
|
||||
}
|
||||
psc.enqueuePetSet(ps)
|
||||
psc.enqueueStatefulSet(ps)
|
||||
if !reflect.DeepEqual(curPod.Labels, oldPod.Labels) {
|
||||
if oldPS := psc.getPetSetForPod(oldPod); oldPS != nil {
|
||||
psc.enqueuePetSet(oldPS)
|
||||
if oldPS := psc.getStatefulSetForPod(oldPod); oldPS != nil {
|
||||
psc.enqueueStatefulSet(oldPS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// deletePod enqueues the petset for the pod accounting for deletion tombstones.
|
||||
func (psc *PetSetController) deletePod(obj interface{}) {
|
||||
// deletePod enqueues the statefulset for the pod accounting for deletion tombstones.
|
||||
func (psc *StatefulSetController) deletePod(obj interface{}) {
|
||||
pod, ok := obj.(*api.Pod)
|
||||
|
||||
// When a delete is dropped, the relist will notice a pod in the store not
|
||||
// in the list, leading to the insertion of a tombstone object which contains
|
||||
// the deleted key/value. Note that this value might be stale. If the pod
|
||||
// changed labels the new PetSet will not be woken up till the periodic resync.
|
||||
// changed labels the new StatefulSet will not be woken up till the periodic resync.
|
||||
if !ok {
|
||||
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
|
||||
if !ok {
|
||||
@ -208,14 +208,14 @@ func (psc *PetSetController) deletePod(obj interface{}) {
|
||||
}
|
||||
}
|
||||
glog.V(4).Infof("Pod %s/%s deleted through %v.", pod.Namespace, pod.Name, utilruntime.GetCaller())
|
||||
if ps := psc.getPetSetForPod(pod); ps != nil {
|
||||
psc.enqueuePetSet(ps)
|
||||
if ps := psc.getStatefulSetForPod(pod); ps != nil {
|
||||
psc.enqueueStatefulSet(ps)
|
||||
}
|
||||
}
|
||||
|
||||
// getPodsForPetSets returns the pods that match the selectors of the given petset.
|
||||
func (psc *PetSetController) getPodsForPetSet(ps *apps.PetSet) ([]*api.Pod, error) {
|
||||
// TODO: Do we want the petset to fight with RCs? check parent petset annoation, or name prefix?
|
||||
// getPodsForStatefulSets returns the pods that match the selectors of the given statefulset.
|
||||
func (psc *StatefulSetController) getPodsForStatefulSet(ps *apps.StatefulSet) ([]*api.Pod, error) {
|
||||
// TODO: Do we want the statefulset to fight with RCs? check parent statefulset annoation, or name prefix?
|
||||
sel, err := unversioned.LabelSelectorAsSelector(ps.Spec.Selector)
|
||||
if err != nil {
|
||||
return []*api.Pod{}, err
|
||||
@ -232,24 +232,24 @@ func (psc *PetSetController) getPodsForPetSet(ps *apps.PetSet) ([]*api.Pod, erro
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// getPetSetForPod returns the pet set managing the given pod.
|
||||
func (psc *PetSetController) getPetSetForPod(pod *api.Pod) *apps.PetSet {
|
||||
ps, err := psc.psStore.GetPodPetSets(pod)
|
||||
// getStatefulSetForPod returns the pet set managing the given pod.
|
||||
func (psc *StatefulSetController) getStatefulSetForPod(pod *api.Pod) *apps.StatefulSet {
|
||||
ps, err := psc.psStore.GetPodStatefulSets(pod)
|
||||
if err != nil {
|
||||
glog.V(4).Infof("No PetSets found for pod %v, PetSet controller will avoid syncing", pod.Name)
|
||||
glog.V(4).Infof("No StatefulSets found for pod %v, StatefulSet controller will avoid syncing", pod.Name)
|
||||
return nil
|
||||
}
|
||||
// Resolve a overlapping petset tie by creation timestamp.
|
||||
// Let's hope users don't create overlapping petsets.
|
||||
// Resolve a overlapping statefulset tie by creation timestamp.
|
||||
// Let's hope users don't create overlapping statefulsets.
|
||||
if len(ps) > 1 {
|
||||
glog.Errorf("user error! more than one PetSet is selecting pods with labels: %+v", pod.Labels)
|
||||
sort.Sort(overlappingPetSets(ps))
|
||||
glog.Errorf("user error! more than one StatefulSet is selecting pods with labels: %+v", pod.Labels)
|
||||
sort.Sort(overlappingStatefulSets(ps))
|
||||
}
|
||||
return &ps[0]
|
||||
}
|
||||
|
||||
// enqueuePetSet enqueues the given petset in the work queue.
|
||||
func (psc *PetSetController) enqueuePetSet(obj interface{}) {
|
||||
// enqueueStatefulSet enqueues the given statefulset in the work queue.
|
||||
func (psc *StatefulSetController) enqueueStatefulSet(obj interface{}) {
|
||||
key, err := controller.KeyFunc(obj)
|
||||
if err != nil {
|
||||
glog.Errorf("Cound't get key for object %+v: %v", obj, err)
|
||||
@ -260,7 +260,7 @@ func (psc *PetSetController) enqueuePetSet(obj interface{}) {
|
||||
|
||||
// worker runs a worker thread that just dequeues items, processes them, and marks them done.
|
||||
// It enforces that the syncHandler is never invoked concurrently with the same key.
|
||||
func (psc *PetSetController) worker() {
|
||||
func (psc *StatefulSetController) worker() {
|
||||
for {
|
||||
func() {
|
||||
key, quit := psc.queue.Get()
|
||||
@ -269,7 +269,7 @@ func (psc *PetSetController) worker() {
|
||||
}
|
||||
defer psc.queue.Done(key)
|
||||
if err := psc.syncHandler(key.(string)); err != nil {
|
||||
glog.Errorf("Error syncing PetSet %v, requeuing: %v", key.(string), err)
|
||||
glog.Errorf("Error syncing StatefulSet %v, requeuing: %v", key.(string), err)
|
||||
psc.queue.AddRateLimited(key)
|
||||
} else {
|
||||
psc.queue.Forget(key)
|
||||
@ -278,11 +278,11 @@ func (psc *PetSetController) worker() {
|
||||
}
|
||||
}
|
||||
|
||||
// Sync syncs the given petset.
|
||||
func (psc *PetSetController) Sync(key string) error {
|
||||
// Sync syncs the given statefulset.
|
||||
func (psc *StatefulSetController) Sync(key string) error {
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
glog.V(4).Infof("Finished syncing pet set %q (%v)", key, time.Now().Sub(startTime))
|
||||
glog.V(4).Infof("Finished syncing statefulset %q (%v)", key, time.Now().Sub(startTime))
|
||||
}()
|
||||
|
||||
if !psc.podStoreSynced() {
|
||||
@ -296,40 +296,40 @@ func (psc *PetSetController) Sync(key string) error {
|
||||
if err = psc.blockingPetStore.store.Delete(key); err != nil {
|
||||
return err
|
||||
}
|
||||
glog.Infof("PetSet has been deleted %v", key)
|
||||
glog.Infof("StatefulSet has been deleted %v", key)
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
glog.Errorf("Unable to retrieve PetSet %v from store: %v", key, err)
|
||||
glog.Errorf("Unable to retrieve StatefulSet %v from store: %v", key, err)
|
||||
return err
|
||||
}
|
||||
|
||||
ps := *obj.(*apps.PetSet)
|
||||
petList, err := psc.getPodsForPetSet(&ps)
|
||||
ps := *obj.(*apps.StatefulSet)
|
||||
petList, err := psc.getPodsForStatefulSet(&ps)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
numPets, syncErr := psc.syncPetSet(&ps, petList)
|
||||
numPets, syncErr := psc.syncStatefulSet(&ps, petList)
|
||||
if updateErr := updatePetCount(psc.kubeClient.Apps(), ps, numPets); updateErr != nil {
|
||||
glog.Infof("Failed to update replica count for petset %v/%v; requeuing; error: %v", ps.Namespace, ps.Name, updateErr)
|
||||
glog.Infof("Failed to update replica count for statefulset %v/%v; requeuing; error: %v", ps.Namespace, ps.Name, updateErr)
|
||||
return errors.NewAggregate([]error{syncErr, updateErr})
|
||||
}
|
||||
|
||||
return syncErr
|
||||
}
|
||||
|
||||
// syncPetSet syncs a tuple of (petset, pets).
|
||||
func (psc *PetSetController) syncPetSet(ps *apps.PetSet, pets []*api.Pod) (int, error) {
|
||||
glog.Infof("Syncing PetSet %v/%v with %d pets", ps.Namespace, ps.Name, len(pets))
|
||||
// syncStatefulSet syncs a tuple of (statefulset, pets).
|
||||
func (psc *StatefulSetController) syncStatefulSet(ps *apps.StatefulSet, pets []*api.Pod) (int, error) {
|
||||
glog.Infof("Syncing StatefulSet %v/%v with %d pods", ps.Namespace, ps.Name, len(pets))
|
||||
|
||||
it := NewPetSetIterator(ps, pets)
|
||||
it := NewStatefulSetIterator(ps, pets)
|
||||
blockingPet, err := psc.blockingPetStore.Get(ps, pets)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if blockingPet != nil {
|
||||
glog.Infof("PetSet %v blocked from scaling on pet %v", ps.Name, blockingPet.pod.Name)
|
||||
glog.Infof("StatefulSet %v blocked from scaling on pod %v", ps.Name, blockingPet.pod.Name)
|
||||
}
|
||||
petManager := psc.newSyncer(blockingPet)
|
||||
numPets := 0
|
||||
@ -351,7 +351,7 @@ func (psc *PetSetController) syncPetSet(ps *apps.PetSet, pets []*api.Pod) (int,
|
||||
switch err.(type) {
|
||||
case errUnhealthyPet:
|
||||
// We are not passing this error up, but we don't increment numPets if we encounter it,
|
||||
// since numPets directly translates to petset.status.replicas
|
||||
// since numPets directly translates to statefulset.status.replicas
|
||||
continue
|
||||
case nil:
|
||||
continue
|
||||
@ -364,7 +364,7 @@ func (psc *PetSetController) syncPetSet(ps *apps.PetSet, pets []*api.Pod) (int,
|
||||
it.errs = append(it.errs, err)
|
||||
}
|
||||
// TODO: GC pvcs. We can't delete them per pet because of grace period, and
|
||||
// in fact we *don't want to* till petset is stable to guarantee that bugs
|
||||
// in fact we *don't want to* till statefulset is stable to guarantee that bugs
|
||||
// in the controller don't corrupt user data.
|
||||
return numPets, errors.NewAggregate(it.errs)
|
||||
}
|
||||
|
@ -32,13 +32,13 @@ import (
|
||||
"k8s.io/kubernetes/pkg/util/errors"
|
||||
)
|
||||
|
||||
func newFakePetSetController() (*PetSetController, *fakePetClient) {
|
||||
func newFakeStatefulSetController() (*StatefulSetController, *fakePetClient) {
|
||||
fpc := newFakePetClient()
|
||||
return &PetSetController{
|
||||
return &StatefulSetController{
|
||||
kubeClient: nil,
|
||||
blockingPetStore: newUnHealthyPetTracker(fpc),
|
||||
podStoreSynced: func() bool { return true },
|
||||
psStore: cache.StoreToPetSetLister{Store: cache.NewStore(controller.KeyFunc)},
|
||||
psStore: cache.StoreToStatefulSetLister{Store: cache.NewStore(controller.KeyFunc)},
|
||||
podStore: cache.StoreToPodLister{Indexer: cache.NewIndexer(controller.KeyFunc, cache.Indexers{})},
|
||||
newSyncer: func(blockingPet *pcb) *petSyncer {
|
||||
return &petSyncer{fpc, blockingPet}
|
||||
@ -46,7 +46,7 @@ func newFakePetSetController() (*PetSetController, *fakePetClient) {
|
||||
}, fpc
|
||||
}
|
||||
|
||||
func checkPets(ps *apps.PetSet, creates, deletes int, fc *fakePetClient, t *testing.T) {
|
||||
func checkPets(ps *apps.StatefulSet, creates, deletes int, fc *fakePetClient, t *testing.T) {
|
||||
if fc.petsCreated != creates || fc.petsDeleted != deletes {
|
||||
t.Errorf("Found (creates: %d, deletes: %d), expected (creates: %d, deletes: %d)", fc.petsCreated, fc.petsDeleted, creates, deletes)
|
||||
}
|
||||
@ -57,12 +57,12 @@ func checkPets(ps *apps.PetSet, creates, deletes int, fc *fakePetClient, t *test
|
||||
for i := range fc.pets {
|
||||
expectedPet, _ := newPCB(fmt.Sprintf("%v", i), ps)
|
||||
if identityHash(ps, fc.pets[i].pod) != identityHash(ps, expectedPet.pod) {
|
||||
t.Errorf("Unexpected pet at index %d", i)
|
||||
t.Errorf("Unexpected pod at index %d", i)
|
||||
}
|
||||
for _, pvc := range expectedPet.pvcs {
|
||||
gotPVC, ok := gotClaims[pvc.Name]
|
||||
if !ok {
|
||||
t.Errorf("PVC %v not created for pet %v", pvc.Name, expectedPet.pod.Name)
|
||||
t.Errorf("PVC %v not created for pod %v", pvc.Name, expectedPet.pod.Name)
|
||||
}
|
||||
if !reflect.DeepEqual(gotPVC.Spec, pvc.Spec) {
|
||||
t.Errorf("got PVC %v differs from created pvc", pvc.Name)
|
||||
@ -71,14 +71,14 @@ func checkPets(ps *apps.PetSet, creates, deletes int, fc *fakePetClient, t *test
|
||||
}
|
||||
}
|
||||
|
||||
func scalePetSet(t *testing.T, ps *apps.PetSet, psc *PetSetController, fc *fakePetClient, scale int) error {
|
||||
func scaleStatefulSet(t *testing.T, ps *apps.StatefulSet, psc *StatefulSetController, fc *fakePetClient, scale int) error {
|
||||
errs := []error{}
|
||||
for i := 0; i < scale; i++ {
|
||||
pl := fc.getPodList()
|
||||
if len(pl) != i {
|
||||
t.Errorf("Unexpected number of pets, expected %d found %d", i, len(pl))
|
||||
t.Errorf("Unexpected number of pods, expected %d found %d", i, len(pl))
|
||||
}
|
||||
if _, syncErr := psc.syncPetSet(ps, pl); syncErr != nil {
|
||||
if _, syncErr := psc.syncStatefulSet(ps, pl); syncErr != nil {
|
||||
errs = append(errs, syncErr)
|
||||
}
|
||||
fc.setHealthy(i)
|
||||
@ -87,35 +87,35 @@ func scalePetSet(t *testing.T, ps *apps.PetSet, psc *PetSetController, fc *fakeP
|
||||
return errors.NewAggregate(errs)
|
||||
}
|
||||
|
||||
func saturatePetSet(t *testing.T, ps *apps.PetSet, psc *PetSetController, fc *fakePetClient) {
|
||||
err := scalePetSet(t, ps, psc, fc, int(ps.Spec.Replicas))
|
||||
func saturateStatefulSet(t *testing.T, ps *apps.StatefulSet, psc *StatefulSetController, fc *fakePetClient) {
|
||||
err := scaleStatefulSet(t, ps, psc, fc, int(ps.Spec.Replicas))
|
||||
if err != nil {
|
||||
t.Errorf("Error scalePetSet: %v", err)
|
||||
t.Errorf("Error scaleStatefulSet: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPetSetControllerCreates(t *testing.T) {
|
||||
psc, fc := newFakePetSetController()
|
||||
func TestStatefulSetControllerCreates(t *testing.T) {
|
||||
psc, fc := newFakeStatefulSetController()
|
||||
replicas := 3
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
|
||||
saturatePetSet(t, ps, psc, fc)
|
||||
saturateStatefulSet(t, ps, psc, fc)
|
||||
|
||||
podList := fc.getPodList()
|
||||
// Deleted pet gets recreated
|
||||
fc.pets = fc.pets[:replicas-1]
|
||||
if _, err := psc.syncPetSet(ps, podList); err != nil {
|
||||
t.Errorf("Error syncing PetSet: %v", err)
|
||||
if _, err := psc.syncStatefulSet(ps, podList); err != nil {
|
||||
t.Errorf("Error syncing StatefulSet: %v", err)
|
||||
}
|
||||
checkPets(ps, replicas+1, 0, fc, t)
|
||||
}
|
||||
|
||||
func TestPetSetControllerDeletes(t *testing.T) {
|
||||
psc, fc := newFakePetSetController()
|
||||
func TestStatefulSetControllerDeletes(t *testing.T) {
|
||||
psc, fc := newFakeStatefulSetController()
|
||||
replicas := 4
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
|
||||
saturatePetSet(t, ps, psc, fc)
|
||||
saturateStatefulSet(t, ps, psc, fc)
|
||||
|
||||
// Drain
|
||||
errs := []error{}
|
||||
@ -123,30 +123,30 @@ func TestPetSetControllerDeletes(t *testing.T) {
|
||||
knownPods := fc.getPodList()
|
||||
for i := replicas - 1; i >= 0; i-- {
|
||||
if len(fc.pets) != i+1 {
|
||||
t.Errorf("Unexpected number of pets, expected %d found %d", i+1, len(fc.pets))
|
||||
t.Errorf("Unexpected number of pods, expected %d found %d", i+1, len(fc.pets))
|
||||
}
|
||||
if _, syncErr := psc.syncPetSet(ps, knownPods); syncErr != nil {
|
||||
if _, syncErr := psc.syncStatefulSet(ps, knownPods); syncErr != nil {
|
||||
errs = append(errs, syncErr)
|
||||
}
|
||||
}
|
||||
if len(errs) != 0 {
|
||||
t.Errorf("Error syncing PetSet: %v", errors.NewAggregate(errs))
|
||||
t.Errorf("Error syncing StatefulSet: %v", errors.NewAggregate(errs))
|
||||
}
|
||||
checkPets(ps, replicas, replicas, fc, t)
|
||||
}
|
||||
|
||||
func TestPetSetControllerRespectsTermination(t *testing.T) {
|
||||
psc, fc := newFakePetSetController()
|
||||
func TestStatefulSetControllerRespectsTermination(t *testing.T) {
|
||||
psc, fc := newFakeStatefulSetController()
|
||||
replicas := 4
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
|
||||
saturatePetSet(t, ps, psc, fc)
|
||||
saturateStatefulSet(t, ps, psc, fc)
|
||||
|
||||
fc.setDeletionTimestamp(replicas - 1)
|
||||
ps.Spec.Replicas = 2
|
||||
_, err := psc.syncPetSet(ps, fc.getPodList())
|
||||
_, err := psc.syncStatefulSet(ps, fc.getPodList())
|
||||
if err != nil {
|
||||
t.Errorf("Error syncing PetSet: %v", err)
|
||||
t.Errorf("Error syncing StatefulSet: %v", err)
|
||||
}
|
||||
// Finding a pod with the deletion timestamp will pause all deletions.
|
||||
knownPods := fc.getPodList()
|
||||
@ -154,19 +154,19 @@ func TestPetSetControllerRespectsTermination(t *testing.T) {
|
||||
t.Errorf("Pods deleted prematurely before deletion timestamp expired, len %d", len(knownPods))
|
||||
}
|
||||
fc.pets = fc.pets[:replicas-1]
|
||||
_, err = psc.syncPetSet(ps, fc.getPodList())
|
||||
_, err = psc.syncStatefulSet(ps, fc.getPodList())
|
||||
if err != nil {
|
||||
t.Errorf("Error syncing PetSet: %v", err)
|
||||
t.Errorf("Error syncing StatefulSet: %v", err)
|
||||
}
|
||||
checkPets(ps, replicas, 1, fc, t)
|
||||
}
|
||||
|
||||
func TestPetSetControllerRespectsOrder(t *testing.T) {
|
||||
psc, fc := newFakePetSetController()
|
||||
func TestStatefulSetControllerRespectsOrder(t *testing.T) {
|
||||
psc, fc := newFakeStatefulSetController()
|
||||
replicas := 4
|
||||
ps := newPetSet(replicas)
|
||||
ps := newStatefulSet(replicas)
|
||||
|
||||
saturatePetSet(t, ps, psc, fc)
|
||||
saturateStatefulSet(t, ps, psc, fc)
|
||||
|
||||
errs := []error{}
|
||||
ps.Spec.Replicas = 0
|
||||
@ -179,36 +179,36 @@ func TestPetSetControllerRespectsOrder(t *testing.T) {
|
||||
|
||||
for i := 0; i < replicas; i++ {
|
||||
if len(fc.pets) != replicas-i {
|
||||
t.Errorf("Unexpected number of pets, expected %d found %d", i, len(fc.pets))
|
||||
t.Errorf("Unexpected number of pods, expected %d found %d", i, len(fc.pets))
|
||||
}
|
||||
if _, syncErr := psc.syncPetSet(ps, knownPods); syncErr != nil {
|
||||
if _, syncErr := psc.syncStatefulSet(ps, knownPods); syncErr != nil {
|
||||
errs = append(errs, syncErr)
|
||||
}
|
||||
checkPets(ps, replicas, i+1, fc, t)
|
||||
}
|
||||
if len(errs) != 0 {
|
||||
t.Errorf("Error syncing PetSet: %v", errors.NewAggregate(errs))
|
||||
t.Errorf("Error syncing StatefulSet: %v", errors.NewAggregate(errs))
|
||||
}
|
||||
}
|
||||
|
||||
func TestPetSetControllerBlocksScaling(t *testing.T) {
|
||||
psc, fc := newFakePetSetController()
|
||||
func TestStatefulSetControllerBlocksScaling(t *testing.T) {
|
||||
psc, fc := newFakeStatefulSetController()
|
||||
replicas := 5
|
||||
ps := newPetSet(replicas)
|
||||
scalePetSet(t, ps, psc, fc, 3)
|
||||
ps := newStatefulSet(replicas)
|
||||
scaleStatefulSet(t, ps, psc, fc, 3)
|
||||
|
||||
// Create 4th pet, then before flipping it to healthy, kill the first pet.
|
||||
// There should only be 1 not-healty pet at a time.
|
||||
pl := fc.getPodList()
|
||||
if _, err := psc.syncPetSet(ps, pl); err != nil {
|
||||
t.Errorf("Error syncing PetSet: %v", err)
|
||||
if _, err := psc.syncStatefulSet(ps, pl); err != nil {
|
||||
t.Errorf("Error syncing StatefulSet: %v", err)
|
||||
}
|
||||
|
||||
deletedPod := pl[0]
|
||||
fc.deletePetAtIndex(0)
|
||||
pl = fc.getPodList()
|
||||
if _, err := psc.syncPetSet(ps, pl); err != nil {
|
||||
t.Errorf("Error syncing PetSet: %v", err)
|
||||
if _, err := psc.syncStatefulSet(ps, pl); err != nil {
|
||||
t.Errorf("Error syncing StatefulSet: %v", err)
|
||||
}
|
||||
newPodList := fc.getPodList()
|
||||
for _, p := range newPodList {
|
||||
@ -218,8 +218,8 @@ func TestPetSetControllerBlocksScaling(t *testing.T) {
|
||||
}
|
||||
|
||||
fc.setHealthy(len(newPodList) - 1)
|
||||
if _, err := psc.syncPetSet(ps, pl); err != nil {
|
||||
t.Errorf("Error syncing PetSet: %v", err)
|
||||
if _, err := psc.syncStatefulSet(ps, pl); err != nil {
|
||||
t.Errorf("Error syncing StatefulSet: %v", err)
|
||||
}
|
||||
|
||||
found := false
|
||||
@ -234,55 +234,55 @@ func TestPetSetControllerBlocksScaling(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPetSetBlockingPetIsCleared(t *testing.T) {
|
||||
psc, fc := newFakePetSetController()
|
||||
ps := newPetSet(3)
|
||||
scalePetSet(t, ps, psc, fc, 1)
|
||||
func TestStatefulSetBlockingPetIsCleared(t *testing.T) {
|
||||
psc, fc := newFakeStatefulSetController()
|
||||
ps := newStatefulSet(3)
|
||||
scaleStatefulSet(t, ps, psc, fc, 1)
|
||||
|
||||
if blocking, err := psc.blockingPetStore.Get(ps, fc.getPodList()); err != nil || blocking != nil {
|
||||
t.Errorf("Unexpected blocking pet %v, err %v", blocking, err)
|
||||
t.Errorf("Unexpected blocking pod %v, err %v", blocking, err)
|
||||
}
|
||||
|
||||
// 1 not yet healthy pet
|
||||
psc.syncPetSet(ps, fc.getPodList())
|
||||
psc.syncStatefulSet(ps, fc.getPodList())
|
||||
|
||||
if blocking, err := psc.blockingPetStore.Get(ps, fc.getPodList()); err != nil || blocking == nil {
|
||||
t.Errorf("Expected blocking pet %v, err %v", blocking, err)
|
||||
t.Errorf("Expected blocking pod %v, err %v", blocking, err)
|
||||
}
|
||||
|
||||
// Deleting the petset should clear the blocking pet
|
||||
// Deleting the statefulset should clear the blocking pet
|
||||
if err := psc.psStore.Store.Delete(ps); err != nil {
|
||||
t.Fatalf("Unable to delete pet %v from petset controller store.", ps.Name)
|
||||
t.Fatalf("Unable to delete pod %v from statefulset controller store.", ps.Name)
|
||||
}
|
||||
if err := psc.Sync(fmt.Sprintf("%v/%v", ps.Namespace, ps.Name)); err != nil {
|
||||
t.Errorf("Error during sync of deleted petset %v", err)
|
||||
t.Errorf("Error during sync of deleted statefulset %v", err)
|
||||
}
|
||||
fc.pets = []*pcb{}
|
||||
fc.petsCreated = 0
|
||||
if blocking, err := psc.blockingPetStore.Get(ps, fc.getPodList()); err != nil || blocking != nil {
|
||||
t.Errorf("Unexpected blocking pet %v, err %v", blocking, err)
|
||||
t.Errorf("Unexpected blocking pod %v, err %v", blocking, err)
|
||||
}
|
||||
saturatePetSet(t, ps, psc, fc)
|
||||
saturateStatefulSet(t, ps, psc, fc)
|
||||
|
||||
// Make sure we don't leak the final blockin pet in the store
|
||||
psc.syncPetSet(ps, fc.getPodList())
|
||||
psc.syncStatefulSet(ps, fc.getPodList())
|
||||
if p, exists, err := psc.blockingPetStore.store.GetByKey(fmt.Sprintf("%v/%v", ps.Namespace, ps.Name)); err != nil || exists {
|
||||
t.Errorf("Unexpected blocking pet, err %v: %+v", err, p)
|
||||
t.Errorf("Unexpected blocking pod, err %v: %+v", err, p)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSyncPetSetBlockedPet(t *testing.T) {
|
||||
psc, fc := newFakePetSetController()
|
||||
ps := newPetSet(3)
|
||||
i, _ := psc.syncPetSet(ps, fc.getPodList())
|
||||
func TestSyncStatefulSetBlockedPet(t *testing.T) {
|
||||
psc, fc := newFakeStatefulSetController()
|
||||
ps := newStatefulSet(3)
|
||||
i, _ := psc.syncStatefulSet(ps, fc.getPodList())
|
||||
if i != len(fc.getPodList()) {
|
||||
t.Errorf("syncPetSet should return actual amount of pods")
|
||||
t.Errorf("syncStatefulSet should return actual amount of pods")
|
||||
}
|
||||
}
|
||||
|
||||
type fakeClient struct {
|
||||
fake_internal.Clientset
|
||||
petSetClient *fakePetSetClient
|
||||
statefulsetClient *fakeStatefulSetClient
|
||||
}
|
||||
|
||||
func (c *fakeClient) Apps() unversioned.AppsInterface {
|
||||
@ -294,38 +294,38 @@ type fakeApps struct {
|
||||
*fake.FakeApps
|
||||
}
|
||||
|
||||
func (c *fakeApps) PetSets(namespace string) unversioned.PetSetInterface {
|
||||
c.petSetClient.Namespace = namespace
|
||||
return c.petSetClient
|
||||
func (c *fakeApps) StatefulSets(namespace string) unversioned.StatefulSetInterface {
|
||||
c.statefulsetClient.Namespace = namespace
|
||||
return c.statefulsetClient
|
||||
}
|
||||
|
||||
type fakePetSetClient struct {
|
||||
*fake.FakePetSets
|
||||
type fakeStatefulSetClient struct {
|
||||
*fake.FakeStatefulSets
|
||||
Namespace string
|
||||
replicas int32
|
||||
}
|
||||
|
||||
func (f *fakePetSetClient) UpdateStatus(petSet *apps.PetSet) (*apps.PetSet, error) {
|
||||
f.replicas = petSet.Status.Replicas
|
||||
return petSet, nil
|
||||
func (f *fakeStatefulSetClient) UpdateStatus(statefulset *apps.StatefulSet) (*apps.StatefulSet, error) {
|
||||
f.replicas = statefulset.Status.Replicas
|
||||
return statefulset, nil
|
||||
}
|
||||
|
||||
func TestPetSetReplicaCount(t *testing.T) {
|
||||
fpsc := &fakePetSetClient{}
|
||||
psc, _ := newFakePetSetController()
|
||||
func TestStatefulSetReplicaCount(t *testing.T) {
|
||||
fpsc := &fakeStatefulSetClient{}
|
||||
psc, _ := newFakeStatefulSetController()
|
||||
psc.kubeClient = &fakeClient{
|
||||
petSetClient: fpsc,
|
||||
statefulsetClient: fpsc,
|
||||
}
|
||||
|
||||
ps := newPetSet(3)
|
||||
ps := newStatefulSet(3)
|
||||
psKey := fmt.Sprintf("%v/%v", ps.Namespace, ps.Name)
|
||||
psc.psStore.Store.Add(ps)
|
||||
|
||||
if err := psc.Sync(psKey); err != nil {
|
||||
t.Errorf("Error during sync of deleted petset %v", err)
|
||||
t.Errorf("Error during sync of deleted statefulset %v", err)
|
||||
}
|
||||
|
||||
if fpsc.replicas != 1 {
|
||||
t.Errorf("Replicas count sent as status update for PetSet should be 1, is %d instead", fpsc.replicas)
|
||||
t.Errorf("Replicas count sent as status update for StatefulSet should be 1, is %d instead", fpsc.replicas)
|
||||
}
|
||||
}
|
||||
|
@ -29,55 +29,55 @@ import (
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
// overlappingPetSets sorts a list of PetSets by creation timestamp, using their names as a tie breaker.
|
||||
// Generally used to tie break between PetSets that have overlapping selectors.
|
||||
type overlappingPetSets []apps.PetSet
|
||||
// overlappingStatefulSets sorts a list of StatefulSets by creation timestamp, using their names as a tie breaker.
|
||||
// Generally used to tie break between StatefulSets that have overlapping selectors.
|
||||
type overlappingStatefulSets []apps.StatefulSet
|
||||
|
||||
func (o overlappingPetSets) Len() int { return len(o) }
|
||||
func (o overlappingPetSets) Swap(i, j int) { o[i], o[j] = o[j], o[i] }
|
||||
func (o overlappingStatefulSets) Len() int { return len(o) }
|
||||
func (o overlappingStatefulSets) Swap(i, j int) { o[i], o[j] = o[j], o[i] }
|
||||
|
||||
func (o overlappingPetSets) Less(i, j int) bool {
|
||||
func (o overlappingStatefulSets) Less(i, j int) bool {
|
||||
if o[i].CreationTimestamp.Equal(o[j].CreationTimestamp) {
|
||||
return o[i].Name < o[j].Name
|
||||
}
|
||||
return o[i].CreationTimestamp.Before(o[j].CreationTimestamp)
|
||||
}
|
||||
|
||||
// updatePetCount attempts to update the Status.Replicas of the given PetSet, with a single GET/PUT retry.
|
||||
func updatePetCount(psClient appsclientset.PetSetsGetter, ps apps.PetSet, numPets int) (updateErr error) {
|
||||
// updatePetCount attempts to update the Status.Replicas of the given StatefulSet, with a single GET/PUT retry.
|
||||
func updatePetCount(psClient appsclientset.StatefulSetsGetter, ps apps.StatefulSet, numPets int) (updateErr error) {
|
||||
if ps.Status.Replicas == int32(numPets) || psClient == nil {
|
||||
return nil
|
||||
}
|
||||
var getErr error
|
||||
for i, ps := 0, &ps; ; i++ {
|
||||
glog.V(4).Infof(fmt.Sprintf("Updating replica count for PetSet: %s/%s, ", ps.Namespace, ps.Name) +
|
||||
glog.V(4).Infof(fmt.Sprintf("Updating replica count for StatefulSet: %s/%s, ", ps.Namespace, ps.Name) +
|
||||
fmt.Sprintf("replicas %d->%d (need %d), ", ps.Status.Replicas, numPets, ps.Spec.Replicas))
|
||||
|
||||
ps.Status = apps.PetSetStatus{Replicas: int32(numPets)}
|
||||
_, updateErr = psClient.PetSets(ps.Namespace).UpdateStatus(ps)
|
||||
ps.Status = apps.StatefulSetStatus{Replicas: int32(numPets)}
|
||||
_, updateErr = psClient.StatefulSets(ps.Namespace).UpdateStatus(ps)
|
||||
if updateErr == nil || i >= statusUpdateRetries {
|
||||
return updateErr
|
||||
}
|
||||
if ps, getErr = psClient.PetSets(ps.Namespace).Get(ps.Name); getErr != nil {
|
||||
if ps, getErr = psClient.StatefulSets(ps.Namespace).Get(ps.Name); getErr != nil {
|
||||
return getErr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unhealthyPetTracker tracks unhealthy pets for petsets.
|
||||
// unhealthyPetTracker tracks unhealthy pets for statefulsets.
|
||||
type unhealthyPetTracker struct {
|
||||
pc petClient
|
||||
store cache.Store
|
||||
storeLock sync.Mutex
|
||||
}
|
||||
|
||||
// Get returns a previously recorded blocking pet for the given petset.
|
||||
func (u *unhealthyPetTracker) Get(ps *apps.PetSet, knownPets []*api.Pod) (*pcb, error) {
|
||||
// Get returns a previously recorded blocking pet for the given statefulset.
|
||||
func (u *unhealthyPetTracker) Get(ps *apps.StatefulSet, knownPets []*api.Pod) (*pcb, error) {
|
||||
u.storeLock.Lock()
|
||||
defer u.storeLock.Unlock()
|
||||
|
||||
// We "Get" by key but "Add" by object because the store interface doesn't
|
||||
// allow us to Get/Add a related obj (eg petset: blocking pet).
|
||||
// allow us to Get/Add a related obj (eg statefulset: blocking pet).
|
||||
key, err := controller.KeyFunc(ps)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -93,16 +93,16 @@ func (u *unhealthyPetTracker) Get(ps *apps.PetSet, knownPets []*api.Pod) (*pcb,
|
||||
if !exists {
|
||||
for _, p := range knownPets {
|
||||
if hc.isHealthy(p) && !hc.isDying(p) {
|
||||
glog.V(4).Infof("Ignoring healthy pet %v for PetSet %v", p.Name, ps.Name)
|
||||
glog.V(4).Infof("Ignoring healthy pod %v for StatefulSet %v", p.Name, ps.Name)
|
||||
continue
|
||||
}
|
||||
glog.Infof("No recorded blocking pet, but found unhealthy pet %v for PetSet %v", p.Name, ps.Name)
|
||||
glog.Infof("No recorded blocking pod, but found unhealthy pod %v for StatefulSet %v", p.Name, ps.Name)
|
||||
return &pcb{pod: p, parent: ps}, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// This is a pet that's blocking further creates/deletes of a petset. If it
|
||||
// This is a pet that's blocking further creates/deletes of a statefulset. If it
|
||||
// disappears, it's no longer blocking. If it exists, it continues to block
|
||||
// till it turns healthy or disappears.
|
||||
bp := obj.(*pcb)
|
||||
@ -111,12 +111,12 @@ func (u *unhealthyPetTracker) Get(ps *apps.PetSet, knownPets []*api.Pod) (*pcb,
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
glog.V(4).Infof("Clearing blocking pet %v for PetSet %v because it's been deleted", bp.pod.Name, ps.Name)
|
||||
glog.V(4).Infof("Clearing blocking pod %v for StatefulSet %v because it's been deleted", bp.pod.Name, ps.Name)
|
||||
return nil, nil
|
||||
}
|
||||
blockingPetPod := blockingPet.pod
|
||||
if hc.isHealthy(blockingPetPod) && !hc.isDying(blockingPetPod) {
|
||||
glog.V(4).Infof("Clearing blocking pet %v for PetSet %v because it's healthy", bp.pod.Name, ps.Name)
|
||||
glog.V(4).Infof("Clearing blocking pod %v for StatefulSet %v because it's healthy", bp.pod.Name, ps.Name)
|
||||
u.store.Delete(blockingPet)
|
||||
blockingPet = nil
|
||||
}
|
||||
@ -131,11 +131,11 @@ func (u *unhealthyPetTracker) Add(blockingPet *pcb) error {
|
||||
if blockingPet == nil {
|
||||
return nil
|
||||
}
|
||||
glog.V(4).Infof("Adding blocking pet %v for PetSet %v", blockingPet.pod.Name, blockingPet.parent.Name)
|
||||
glog.V(4).Infof("Adding blocking pod %v for StatefulSet %v", blockingPet.pod.Name, blockingPet.parent.Name)
|
||||
return u.store.Add(blockingPet)
|
||||
}
|
||||
|
||||
// newUnHealthyPetTracker tracks unhealthy pets that block progress of petsets.
|
||||
// newUnHealthyPetTracker tracks unhealthy pets that block progress of statefulsets.
|
||||
func newUnHealthyPetTracker(pc petClient) *unhealthyPetTracker {
|
||||
return &unhealthyPetTracker{pc: pc, store: cache.NewStore(pcbKeyFunc)}
|
||||
}
|
||||
@ -148,10 +148,10 @@ func pcbKeyFunc(obj interface{}) (string, error) {
|
||||
}
|
||||
p, ok := obj.(*pcb)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("not a valid pet control block %#v", p)
|
||||
return "", fmt.Errorf("not a valid pod control block %#v", p)
|
||||
}
|
||||
if p.parent == nil {
|
||||
return "", fmt.Errorf("cannot compute pet control block key without parent pointer %#v", p)
|
||||
return "", fmt.Errorf("cannot compute pod control block key without parent pointer %#v", p)
|
||||
}
|
||||
return controller.KeyFunc(p.parent)
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ import (
|
||||
)
|
||||
|
||||
var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
"apps.PetSet": {
|
||||
"apps.StatefulSet": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "PetSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe PetSet guarantees that a given network identity will always map to the same storage identity. PetSet is currently in alpha and and subject to change without notice.",
|
||||
Description: "StatefulSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe StatefulSet guarantees that a given network identity will always map to the same storage identity. StatefulSet is currently in alpha and and subject to change without notice.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -41,26 +41,26 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Spec defines the desired identities of pets in this set.",
|
||||
Ref: spec.MustCreateRef("#/definitions/apps.PetSetSpec"),
|
||||
Description: "Spec defines the desired identities of pods in this set.",
|
||||
Ref: spec.MustCreateRef("#/definitions/apps.StatefulSetSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Status is the current status of Pets in this PetSet. This data may be out of date by some window of time.",
|
||||
Ref: spec.MustCreateRef("#/definitions/apps.PetSetStatus"),
|
||||
Description: "Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time.",
|
||||
Ref: spec.MustCreateRef("#/definitions/apps.StatefulSetStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"api.ObjectMeta", "apps.PetSetSpec", "apps.PetSetStatus"},
|
||||
"api.ObjectMeta", "apps.StatefulSetSpec", "apps.StatefulSetStatus"},
|
||||
},
|
||||
"apps.PetSetList": {
|
||||
"apps.StatefulSetList": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "PetSetList is a collection of PetSets.",
|
||||
Description: "StatefulSetList is a collection of StatefulSets.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -73,7 +73,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: spec.MustCreateRef("#/definitions/apps.PetSet"),
|
||||
Ref: spec.MustCreateRef("#/definitions/apps.StatefulSet"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -84,12 +84,12 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"apps.PetSet", "unversioned.ListMeta"},
|
||||
"apps.StatefulSet", "unversioned.ListMeta"},
|
||||
},
|
||||
"apps.PetSetSpec": {
|
||||
"apps.StatefulSetSpec": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "A PetSetSpec is the specification of a PetSet.",
|
||||
Description: "A StatefulSetSpec is the specification of a StatefulSet.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"replicas": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -106,13 +106,13 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
},
|
||||
"template": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the PetSet will fulfill this Template, but have a unique identity from the rest of the PetSet.",
|
||||
Description: "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet.",
|
||||
Ref: spec.MustCreateRef("#/definitions/api.PodTemplateSpec"),
|
||||
},
|
||||
},
|
||||
"volumeClaimTemplates": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "VolumeClaimTemplates is a list of claims that pets are allowed to reference. The PetSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pet. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.",
|
||||
Description: "VolumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
@ -125,7 +125,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
},
|
||||
"serviceName": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ServiceName is the name of the service that governs this PetSet. This service must exist before the PetSet, and is responsible for the network identity of the set. Pets get DNS/hostnames that follow the pattern: pet-specific-string.serviceName.default.svc.cluster.local where \"pet-specific-string\" is managed by the PetSet controller.",
|
||||
Description: "ServiceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
@ -137,10 +137,10 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
Dependencies: []string{
|
||||
"api.PersistentVolumeClaim", "api.PodTemplateSpec", "unversioned.LabelSelector"},
|
||||
},
|
||||
"apps.PetSetStatus": {
|
||||
"apps.StatefulSetStatus": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "PetSetStatus represents the current state of a PetSet.",
|
||||
Description: "StatefulSetStatus represents the current state of a StatefulSet.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"observedGeneration": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -14829,139 +14829,6 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
Dependencies: []string{
|
||||
"unversioned.Duration"},
|
||||
},
|
||||
"v1alpha1.PetSet": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "PetSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe PetSet guarantees that a given network identity will always map to the same storage identity. PetSet is currently in alpha and subject to change without notice.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: spec.MustCreateRef("#/definitions/v1.ObjectMeta"),
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Spec defines the desired identities of pets in this set.",
|
||||
Ref: spec.MustCreateRef("#/definitions/v1alpha1.PetSetSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Status is the current status of Pets in this PetSet. This data may be out of date by some window of time.",
|
||||
Ref: spec.MustCreateRef("#/definitions/v1alpha1.PetSetStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"v1.ObjectMeta", "v1alpha1.PetSetSpec", "v1alpha1.PetSetStatus"},
|
||||
},
|
||||
"v1alpha1.PetSetList": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "PetSetList is a collection of PetSets.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: spec.MustCreateRef("#/definitions/unversioned.ListMeta"),
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: spec.MustCreateRef("#/definitions/v1alpha1.PetSet"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"unversioned.ListMeta", "v1alpha1.PetSet"},
|
||||
},
|
||||
"v1alpha1.PetSetSpec": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "A PetSetSpec is the specification of a PetSet.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"replicas": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"selector": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors",
|
||||
Ref: spec.MustCreateRef("#/definitions/unversioned.LabelSelector"),
|
||||
},
|
||||
},
|
||||
"template": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the PetSet will fulfill this Template, but have a unique identity from the rest of the PetSet.",
|
||||
Ref: spec.MustCreateRef("#/definitions/v1.PodTemplateSpec"),
|
||||
},
|
||||
},
|
||||
"volumeClaimTemplates": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "VolumeClaimTemplates is a list of claims that pets are allowed to reference. The PetSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pet. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: spec.MustCreateRef("#/definitions/v1.PersistentVolumeClaim"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"serviceName": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ServiceName is the name of the service that governs this PetSet. This service must exist before the PetSet, and is responsible for the network identity of the set. Pets get DNS/hostnames that follow the pattern: pet-specific-string.serviceName.default.svc.cluster.local where \"pet-specific-string\" is managed by the PetSet controller.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"template", "serviceName"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"unversioned.LabelSelector", "v1.PersistentVolumeClaim", "v1.PodTemplateSpec"},
|
||||
},
|
||||
"v1alpha1.PetSetStatus": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "PetSetStatus represents the current state of a PetSet.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"observedGeneration": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "most recent generation observed by this autoscaler.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int64",
|
||||
},
|
||||
},
|
||||
"replicas": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Replicas is the number of actual replicas.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"replicas"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{},
|
||||
},
|
||||
"v1alpha1.PodDisruptionBudget": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -15331,6 +15198,139 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
},
|
||||
Dependencies: []string{},
|
||||
},
|
||||
"v1alpha1.StatefulSet": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "StatefulSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\nThe StatefulSet guarantees that a given network identity will always map to the same storage identity. StatefulSet is currently in alpha and subject to change without notice.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: spec.MustCreateRef("#/definitions/v1.ObjectMeta"),
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Spec defines the desired identities of pods in this set.",
|
||||
Ref: spec.MustCreateRef("#/definitions/v1alpha1.StatefulSetSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time.",
|
||||
Ref: spec.MustCreateRef("#/definitions/v1alpha1.StatefulSetStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"v1.ObjectMeta", "v1alpha1.StatefulSetSpec", "v1alpha1.StatefulSetStatus"},
|
||||
},
|
||||
"v1alpha1.StatefulSetList": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "StatefulSetList is a collection of StatefulSets.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: spec.MustCreateRef("#/definitions/unversioned.ListMeta"),
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: spec.MustCreateRef("#/definitions/v1alpha1.StatefulSet"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"unversioned.ListMeta", "v1alpha1.StatefulSet"},
|
||||
},
|
||||
"v1alpha1.StatefulSetSpec": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "A StatefulSetSpec is the specification of a StatefulSet.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"replicas": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"selector": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Selector is a label query over pods that should match the replica count. If empty, defaulted to labels on the pod template. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors",
|
||||
Ref: spec.MustCreateRef("#/definitions/unversioned.LabelSelector"),
|
||||
},
|
||||
},
|
||||
"template": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet.",
|
||||
Ref: spec.MustCreateRef("#/definitions/v1.PodTemplateSpec"),
|
||||
},
|
||||
},
|
||||
"volumeClaimTemplates": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "VolumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: spec.MustCreateRef("#/definitions/v1.PersistentVolumeClaim"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"serviceName": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ServiceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"template", "serviceName"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"unversioned.LabelSelector", "v1.PersistentVolumeClaim", "v1.PodTemplateSpec"},
|
||||
},
|
||||
"v1alpha1.StatefulSetStatus": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "StatefulSetStatus represents the current state of a StatefulSet.",
|
||||
Properties: map[string]spec.Schema{
|
||||
"observedGeneration": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "most recent generation observed by this autoscaler.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int64",
|
||||
},
|
||||
},
|
||||
"replicas": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Replicas is the number of actual replicas.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"replicas"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{},
|
||||
},
|
||||
"v1alpha1.Subject": {
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -183,7 +183,7 @@ __custom_func() {
|
||||
* limitranges (aka 'limits')
|
||||
* nodes (aka 'no')
|
||||
* namespaces (aka 'ns')
|
||||
* petsets (alpha feature, may be unstable)
|
||||
* statefulsets (alpha feature, may be unstable)
|
||||
* pods (aka 'po')
|
||||
* persistentvolumes (aka 'pv')
|
||||
* persistentvolumeclaims (aka 'pvc')
|
||||
|
@ -863,7 +863,7 @@ func (f *factory) UpdatePodSpecForObject(obj runtime.Object, fn func(*api.PodSpe
|
||||
return true, fn(&t.Spec.Template.Spec)
|
||||
case *extensions.ReplicaSet:
|
||||
return true, fn(&t.Spec.Template.Spec)
|
||||
case *apps.PetSet:
|
||||
case *apps.StatefulSet:
|
||||
return true, fn(&t.Spec.Template.Spec)
|
||||
case *batch.Job:
|
||||
return true, fn(&t.Spec.Template.Spec)
|
||||
|
@ -736,12 +736,12 @@ func TestDiscoveryReplaceAliases(t *testing.T) {
|
||||
{
|
||||
name: "all-replacement",
|
||||
arg: "all",
|
||||
expected: "pods,replicationcontrollers,services,petsets,horizontalpodautoscalers,jobs,deployments,replicasets",
|
||||
expected: "pods,replicationcontrollers,services,statefulsets,horizontalpodautoscalers,jobs,deployments,replicasets",
|
||||
},
|
||||
{
|
||||
name: "alias-in-comma-separated-arg",
|
||||
arg: "all,secrets",
|
||||
expected: "pods,replicationcontrollers,services,petsets,horizontalpodautoscalers,jobs,deployments,replicasets,secrets",
|
||||
expected: "pods,replicationcontrollers,services,statefulsets,horizontalpodautoscalers,jobs,deployments,replicasets,secrets",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ var userResources = []unversioned.GroupResource{
|
||||
{Group: "", Resource: "pods"},
|
||||
{Group: "", Resource: "replicationcontrollers"},
|
||||
{Group: "", Resource: "services"},
|
||||
{Group: "apps", Resource: "petsets"},
|
||||
{Group: "apps", Resource: "statefulsets"},
|
||||
{Group: "autoscaling", Resource: "horizontalpodautoscalers"},
|
||||
{Group: "extensions", Resource: "jobs"},
|
||||
{Group: "extensions", Resource: "deployments"},
|
||||
|
@ -37,12 +37,12 @@ func TestReplaceAliases(t *testing.T) {
|
||||
{
|
||||
name: "all-replacement",
|
||||
arg: "all",
|
||||
expected: "pods,replicationcontrollers,services,petsets,horizontalpodautoscalers,jobs,deployments,replicasets",
|
||||
expected: "pods,replicationcontrollers,services,statefulsets,horizontalpodautoscalers,jobs,deployments,replicasets",
|
||||
},
|
||||
{
|
||||
name: "alias-in-comma-separated-arg",
|
||||
arg: "all,secrets",
|
||||
expected: "pods,replicationcontrollers,services,petsets,horizontalpodautoscalers,jobs,deployments,replicasets,secrets",
|
||||
expected: "pods,replicationcontrollers,services,statefulsets,horizontalpodautoscalers,jobs,deployments,replicasets,secrets",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ func describerMap(c clientset.Interface) map[unversioned.GroupKind]Describer {
|
||||
extensions.Kind("Ingress"): &IngressDescriber{c},
|
||||
batch.Kind("Job"): &JobDescriber{c},
|
||||
batch.Kind("ScheduledJob"): &ScheduledJobDescriber{c},
|
||||
apps.Kind("PetSet"): &PetSetDescriber{c},
|
||||
apps.Kind("StatefulSet"): &StatefulSetDescriber{c},
|
||||
certificates.Kind("CertificateSigningRequest"): &CertificateSigningRequestDescriber{c},
|
||||
storage.Kind("StorageClass"): &StorageClassDescriber{c},
|
||||
}
|
||||
@ -1863,12 +1863,12 @@ func describeNode(node *api.Node, nodeNonTerminatedPodsList *api.PodList, events
|
||||
})
|
||||
}
|
||||
|
||||
type PetSetDescriber struct {
|
||||
type StatefulSetDescriber struct {
|
||||
client clientset.Interface
|
||||
}
|
||||
|
||||
func (p *PetSetDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) {
|
||||
ps, err := p.client.Apps().PetSets(namespace).Get(name)
|
||||
func (p *StatefulSetDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) {
|
||||
ps, err := p.client.Apps().StatefulSets(namespace).Get(name)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ var (
|
||||
scheduledJobColumns = []string{"NAME", "SCHEDULE", "SUSPEND", "ACTIVE", "LAST-SCHEDULE"}
|
||||
serviceColumns = []string{"NAME", "CLUSTER-IP", "EXTERNAL-IP", "PORT(S)", "AGE"}
|
||||
ingressColumns = []string{"NAME", "HOSTS", "ADDRESS", "PORTS", "AGE"}
|
||||
petSetColumns = []string{"NAME", "DESIRED", "CURRENT", "AGE"}
|
||||
statefulSetColumns = []string{"NAME", "DESIRED", "CURRENT", "AGE"}
|
||||
endpointColumns = []string{"NAME", "ENDPOINTS", "AGE"}
|
||||
nodeColumns = []string{"NAME", "STATUS", "AGE"}
|
||||
daemonSetColumns = []string{"NAME", "DESIRED", "CURRENT", "READY", "NODE-SELECTOR", "AGE"}
|
||||
@ -539,8 +539,8 @@ func (h *HumanReadablePrinter) addDefaultHandlers() {
|
||||
h.Handler(serviceColumns, printServiceList)
|
||||
h.Handler(ingressColumns, printIngress)
|
||||
h.Handler(ingressColumns, printIngressList)
|
||||
h.Handler(petSetColumns, printPetSet)
|
||||
h.Handler(petSetColumns, printPetSetList)
|
||||
h.Handler(statefulSetColumns, printStatefulSet)
|
||||
h.Handler(statefulSetColumns, printStatefulSetList)
|
||||
h.Handler(endpointColumns, printEndpoints)
|
||||
h.Handler(endpointColumns, printEndpointsList)
|
||||
h.Handler(nodeColumns, printNode)
|
||||
@ -1227,7 +1227,7 @@ func printIngressList(ingressList *extensions.IngressList, w io.Writer, options
|
||||
return nil
|
||||
}
|
||||
|
||||
func printPetSet(ps *apps.PetSet, w io.Writer, options PrintOptions) error {
|
||||
func printStatefulSet(ps *apps.StatefulSet, w io.Writer, options PrintOptions) error {
|
||||
name := formatResourceName(options.Kind, ps.Name, options.WithKind)
|
||||
|
||||
namespace := ps.Namespace
|
||||
@ -1266,9 +1266,9 @@ func printPetSet(ps *apps.PetSet, w io.Writer, options PrintOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func printPetSetList(petSetList *apps.PetSetList, w io.Writer, options PrintOptions) error {
|
||||
for _, ps := range petSetList.Items {
|
||||
if err := printPetSet(&ps, w, options); err != nil {
|
||||
func printStatefulSetList(statefulSetList *apps.StatefulSetList, w io.Writer, options PrintOptions) error {
|
||||
for _, ps := range statefulSetList.Items {
|
||||
if err := printStatefulSet(&ps, w, options); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ func ScalerFor(kind unversioned.GroupKind, c internalclientset.Interface) (Scale
|
||||
return &ReplicaSetScaler{c.Extensions()}, nil
|
||||
case extensions.Kind("Job"), batch.Kind("Job"):
|
||||
return &JobScaler{c.Batch()}, nil // Either kind of job can be scaled with Batch interface.
|
||||
case apps.Kind("PetSet"):
|
||||
return &PetSetScaler{c.Apps()}, nil
|
||||
case apps.Kind("StatefulSet"):
|
||||
return &StatefulSetScaler{c.Apps()}, nil
|
||||
case extensions.Kind("Deployment"):
|
||||
return &DeploymentScaler{c.Extensions()}, nil
|
||||
}
|
||||
@ -137,8 +137,8 @@ func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name s
|
||||
}
|
||||
}
|
||||
|
||||
// ValidatePetSet ensures that the preconditions match. Returns nil if they are valid, an error otherwise.
|
||||
func (precondition *ScalePrecondition) ValidatePetSet(ps *apps.PetSet) error {
|
||||
// ValidateStatefulSet ensures that the preconditions match. Returns nil if they are valid, an error otherwise.
|
||||
func (precondition *ScalePrecondition) ValidateStatefulSet(ps *apps.StatefulSet) error {
|
||||
if precondition.Size != -1 && int(ps.Spec.Replicas) != precondition.Size {
|
||||
return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(int(ps.Spec.Replicas))}
|
||||
}
|
||||
@ -328,34 +328,34 @@ func (precondition *ScalePrecondition) ValidateJob(job *batch.Job) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type PetSetScaler struct {
|
||||
c appsclient.PetSetsGetter
|
||||
type StatefulSetScaler struct {
|
||||
c appsclient.StatefulSetsGetter
|
||||
}
|
||||
|
||||
// ScaleSimple does a simple one-shot attempt at scaling. It returns the
|
||||
// resourceVersion of the petset if the update is successful.
|
||||
func (scaler *PetSetScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error) {
|
||||
ps, err := scaler.c.PetSets(namespace).Get(name)
|
||||
// resourceVersion of the statefulset if the update is successful.
|
||||
func (scaler *StatefulSetScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error) {
|
||||
ps, err := scaler.c.StatefulSets(namespace).Get(name)
|
||||
if err != nil {
|
||||
return "", ScaleError{ScaleGetFailure, "Unknown", err}
|
||||
}
|
||||
if preconditions != nil {
|
||||
if err := preconditions.ValidatePetSet(ps); err != nil {
|
||||
if err := preconditions.ValidateStatefulSet(ps); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
ps.Spec.Replicas = int32(newSize)
|
||||
updatedPetSet, err := scaler.c.PetSets(namespace).Update(ps)
|
||||
updatedStatefulSet, err := scaler.c.StatefulSets(namespace).Update(ps)
|
||||
if err != nil {
|
||||
if errors.IsConflict(err) {
|
||||
return "", ScaleError{ScaleUpdateConflictFailure, ps.ResourceVersion, err}
|
||||
}
|
||||
return "", ScaleError{ScaleUpdateFailure, ps.ResourceVersion, err}
|
||||
}
|
||||
return updatedPetSet.ResourceVersion, nil
|
||||
return updatedStatefulSet.ResourceVersion, nil
|
||||
}
|
||||
|
||||
func (scaler *PetSetScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error {
|
||||
func (scaler *StatefulSetScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error {
|
||||
if preconditions == nil {
|
||||
preconditions = &ScalePrecondition{-1, ""}
|
||||
}
|
||||
@ -368,11 +368,11 @@ func (scaler *PetSetScaler) Scale(namespace, name string, newSize uint, precondi
|
||||
return err
|
||||
}
|
||||
if waitForReplicas != nil {
|
||||
job, err := scaler.c.PetSets(namespace).Get(name)
|
||||
job, err := scaler.c.StatefulSets(namespace).Get(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = wait.Poll(waitForReplicas.Interval, waitForReplicas.Timeout, client.PetSetHasDesiredPets(scaler.c, job))
|
||||
err = wait.Poll(waitForReplicas.Interval, waitForReplicas.Timeout, client.StatefulSetHasDesiredPets(scaler.c, job))
|
||||
if err == wait.ErrWaitTimeout {
|
||||
return fmt.Errorf("timed out waiting for %q to be synced", name)
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ func ReaperFor(kind unversioned.GroupKind, c internalclientset.Interface) (Reape
|
||||
case extensions.Kind("Job"), batch.Kind("Job"):
|
||||
return &JobReaper{c.Batch(), c.Core(), Interval, Timeout}, nil
|
||||
|
||||
case apps.Kind("PetSet"):
|
||||
return &PetSetReaper{c.Apps(), c.Core(), Interval, Timeout}, nil
|
||||
case apps.Kind("StatefulSet"):
|
||||
return &StatefulSetReaper{c.Apps(), c.Core(), Interval, Timeout}, nil
|
||||
|
||||
case extensions.Kind("Deployment"):
|
||||
return &DeploymentReaper{c.Extensions(), c.Extensions(), Interval, Timeout}, nil
|
||||
@ -129,8 +129,8 @@ type PodReaper struct {
|
||||
type ServiceReaper struct {
|
||||
client coreclient.ServicesGetter
|
||||
}
|
||||
type PetSetReaper struct {
|
||||
client appsclient.PetSetsGetter
|
||||
type StatefulSetReaper struct {
|
||||
client appsclient.StatefulSetsGetter
|
||||
podClient coreclient.PodsGetter
|
||||
pollInterval, timeout time.Duration
|
||||
}
|
||||
@ -325,10 +325,10 @@ func (reaper *DaemonSetReaper) Stop(namespace, name string, timeout time.Duratio
|
||||
return reaper.client.DaemonSets(namespace).Delete(name, nil)
|
||||
}
|
||||
|
||||
func (reaper *PetSetReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error {
|
||||
petsets := reaper.client.PetSets(namespace)
|
||||
scaler := &PetSetScaler{reaper.client}
|
||||
ps, err := petsets.Get(name)
|
||||
func (reaper *StatefulSetReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error {
|
||||
statefulsets := reaper.client.StatefulSets(namespace)
|
||||
scaler := &StatefulSetScaler{reaper.client}
|
||||
ps, err := statefulsets.Get(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -337,13 +337,13 @@ func (reaper *PetSetReaper) Stop(namespace, name string, timeout time.Duration,
|
||||
timeout = Timeout + time.Duration(10*numPets)*time.Second
|
||||
}
|
||||
retry := NewRetryParams(reaper.pollInterval, reaper.timeout)
|
||||
waitForPetSet := NewRetryParams(reaper.pollInterval, reaper.timeout)
|
||||
if err = scaler.Scale(namespace, name, 0, nil, retry, waitForPetSet); err != nil {
|
||||
waitForStatefulSet := NewRetryParams(reaper.pollInterval, reaper.timeout)
|
||||
if err = scaler.Scale(namespace, name, 0, nil, retry, waitForStatefulSet); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO: This shouldn't be needed, see corresponding TODO in PetSetHasDesiredPets.
|
||||
// PetSet should track generation number.
|
||||
// TODO: This shouldn't be needed, see corresponding TODO in StatefulSetHasDesiredPets.
|
||||
// StatefulSet should track generation number.
|
||||
pods := reaper.podClient.Pods(namespace)
|
||||
selector, _ := unversioned.LabelSelectorAsSelector(ps.Spec.Selector)
|
||||
options := api.ListOptions{LabelSelector: selector}
|
||||
@ -365,8 +365,8 @@ func (reaper *PetSetReaper) Stop(namespace, name string, timeout time.Duration,
|
||||
}
|
||||
|
||||
// TODO: Cleanup volumes? We don't want to accidentally delete volumes from
|
||||
// stop, so just leave this up to the petset.
|
||||
return petsets.Delete(name, nil)
|
||||
// stop, so just leave this up to the statefulset.
|
||||
return statefulsets.Delete(name, nil)
|
||||
}
|
||||
|
||||
func (reaper *JobReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error {
|
||||
|
@ -37,11 +37,11 @@ type REST struct {
|
||||
func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
|
||||
prefix := "/" + opts.ResourcePrefix
|
||||
|
||||
newListFunc := func() runtime.Object { return &appsapi.PetSetList{} }
|
||||
newListFunc := func() runtime.Object { return &appsapi.StatefulSetList{} }
|
||||
storageInterface, dFunc := opts.Decorator(
|
||||
opts.StorageConfig,
|
||||
cachesize.GetWatchCacheSizeByResource(cachesize.PetSet),
|
||||
&appsapi.PetSet{},
|
||||
cachesize.GetWatchCacheSizeByResource(cachesize.StatefulSet),
|
||||
&appsapi.StatefulSet{},
|
||||
prefix,
|
||||
petset.Strategy,
|
||||
newListFunc,
|
||||
@ -49,27 +49,27 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
|
||||
)
|
||||
|
||||
store := ®istry.Store{
|
||||
NewFunc: func() runtime.Object { return &appsapi.PetSet{} },
|
||||
NewFunc: func() runtime.Object { return &appsapi.StatefulSet{} },
|
||||
|
||||
// NewListFunc returns an object capable of storing results of an etcd list.
|
||||
NewListFunc: newListFunc,
|
||||
// Produces a petSet that etcd understands, to the root of the resource
|
||||
// Produces a statefulSet that etcd understands, to the root of the resource
|
||||
// by combining the namespace in the context with the given prefix
|
||||
KeyRootFunc: func(ctx api.Context) string {
|
||||
return registry.NamespaceKeyRootFunc(ctx, prefix)
|
||||
},
|
||||
// Produces a petSet that etcd understands, to the resource by combining
|
||||
// Produces a statefulSet that etcd understands, to the resource by combining
|
||||
// the namespace in the context with the given prefix
|
||||
KeyFunc: func(ctx api.Context, name string) (string, error) {
|
||||
return registry.NamespaceKeyFunc(ctx, prefix, name)
|
||||
},
|
||||
// Retrieve the name field of a replication controller
|
||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
||||
return obj.(*appsapi.PetSet).Name, nil
|
||||
return obj.(*appsapi.StatefulSet).Name, nil
|
||||
},
|
||||
// Used to match objects based on labels/fields for list and watch
|
||||
PredicateFunc: petset.MatchPetSet,
|
||||
QualifiedResource: appsapi.Resource("petsets"),
|
||||
PredicateFunc: petset.MatchStatefulSet,
|
||||
QualifiedResource: appsapi.Resource("statefulsets"),
|
||||
EnableGarbageCollection: opts.EnableGarbageCollection,
|
||||
DeleteCollectionWorkers: opts.DeleteCollectionWorkers,
|
||||
|
||||
@ -88,13 +88,13 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
|
||||
return &REST{store}, &StatusREST{store: &statusStore}
|
||||
}
|
||||
|
||||
// StatusREST implements the REST endpoint for changing the status of an petSet
|
||||
// StatusREST implements the REST endpoint for changing the status of an statefulSet
|
||||
type StatusREST struct {
|
||||
store *registry.Store
|
||||
}
|
||||
|
||||
func (r *StatusREST) New() runtime.Object {
|
||||
return &appsapi.PetSet{}
|
||||
return &appsapi.StatefulSet{}
|
||||
}
|
||||
|
||||
// Get retrieves the object from the storage. It is required to support Patch.
|
||||
|
@ -33,30 +33,30 @@ import (
|
||||
|
||||
func newStorage(t *testing.T) (*REST, *StatusREST, *etcdtesting.EtcdTestServer) {
|
||||
etcdStorage, server := registrytest.NewEtcdStorage(t, apps.GroupName)
|
||||
restOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "petsets"}
|
||||
petSetStorage, statusStorage := NewREST(restOptions)
|
||||
return petSetStorage, statusStorage, server
|
||||
restOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "statefulsets"}
|
||||
statefulSetStorage, statusStorage := NewREST(restOptions)
|
||||
return statefulSetStorage, statusStorage, server
|
||||
}
|
||||
|
||||
// createPetSet is a helper function that returns a PetSet with the updated resource version.
|
||||
func createPetSet(storage *REST, ps apps.PetSet, t *testing.T) (apps.PetSet, error) {
|
||||
// createStatefulSet is a helper function that returns a StatefulSet with the updated resource version.
|
||||
func createStatefulSet(storage *REST, ps apps.StatefulSet, t *testing.T) (apps.StatefulSet, error) {
|
||||
ctx := api.WithNamespace(api.NewContext(), ps.Namespace)
|
||||
obj, err := storage.Create(ctx, &ps)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to create PetSet, %v", err)
|
||||
t.Errorf("Failed to create StatefulSet, %v", err)
|
||||
}
|
||||
newPS := obj.(*apps.PetSet)
|
||||
newPS := obj.(*apps.StatefulSet)
|
||||
return *newPS, nil
|
||||
}
|
||||
|
||||
func validNewPetSet() *apps.PetSet {
|
||||
return &apps.PetSet{
|
||||
func validNewStatefulSet() *apps.StatefulSet {
|
||||
return &apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "foo",
|
||||
Namespace: api.NamespaceDefault,
|
||||
Labels: map[string]string{"a": "b"},
|
||||
},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"a": "b"}},
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
@ -76,7 +76,7 @@ func validNewPetSet() *apps.PetSet {
|
||||
},
|
||||
Replicas: 7,
|
||||
},
|
||||
Status: apps.PetSetStatus{},
|
||||
Status: apps.StatefulSetStatus{},
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ func TestCreate(t *testing.T) {
|
||||
defer server.Terminate(t)
|
||||
defer storage.Store.DestroyFunc()
|
||||
test := registrytest.New(t, storage.Store)
|
||||
ps := validNewPetSet()
|
||||
ps := validNewStatefulSet()
|
||||
ps.ObjectMeta = api.ObjectMeta{}
|
||||
test.TestCreate(
|
||||
// valid
|
||||
@ -101,17 +101,17 @@ func TestStatusUpdate(t *testing.T) {
|
||||
defer server.Terminate(t)
|
||||
defer storage.Store.DestroyFunc()
|
||||
ctx := api.WithNamespace(api.NewContext(), api.NamespaceDefault)
|
||||
key := etcdtest.AddPrefix("/petsets/" + api.NamespaceDefault + "/foo")
|
||||
validPetSet := validNewPetSet()
|
||||
if err := storage.Storage.Create(ctx, key, validPetSet, nil, 0); err != nil {
|
||||
key := etcdtest.AddPrefix("/statefulsets/" + api.NamespaceDefault + "/foo")
|
||||
validStatefulSet := validNewStatefulSet()
|
||||
if err := storage.Storage.Create(ctx, key, validStatefulSet, nil, 0); err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
update := apps.PetSet{
|
||||
ObjectMeta: validPetSet.ObjectMeta,
|
||||
Spec: apps.PetSetSpec{
|
||||
update := apps.StatefulSet{
|
||||
ObjectMeta: validStatefulSet.ObjectMeta,
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: 7,
|
||||
},
|
||||
Status: apps.PetSetStatus{
|
||||
Status: apps.StatefulSetStatus{
|
||||
Replicas: 7,
|
||||
},
|
||||
}
|
||||
@ -124,7 +124,7 @@ func TestStatusUpdate(t *testing.T) {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
ps := obj.(*apps.PetSet)
|
||||
ps := obj.(*apps.StatefulSet)
|
||||
if ps.Spec.Replicas != 7 {
|
||||
t.Errorf("we expected .spec.replicas to not be updated but it was updated to %v", ps.Spec.Replicas)
|
||||
}
|
||||
@ -138,7 +138,7 @@ func TestGet(t *testing.T) {
|
||||
defer server.Terminate(t)
|
||||
defer storage.Store.DestroyFunc()
|
||||
test := registrytest.New(t, storage.Store)
|
||||
test.TestGet(validNewPetSet())
|
||||
test.TestGet(validNewStatefulSet())
|
||||
}
|
||||
|
||||
func TestList(t *testing.T) {
|
||||
@ -146,7 +146,7 @@ func TestList(t *testing.T) {
|
||||
defer server.Terminate(t)
|
||||
defer storage.Store.DestroyFunc()
|
||||
test := registrytest.New(t, storage.Store)
|
||||
test.TestList(validNewPetSet())
|
||||
test.TestList(validNewStatefulSet())
|
||||
}
|
||||
|
||||
func TestDelete(t *testing.T) {
|
||||
@ -154,7 +154,7 @@ func TestDelete(t *testing.T) {
|
||||
defer server.Terminate(t)
|
||||
defer storage.Store.DestroyFunc()
|
||||
test := registrytest.New(t, storage.Store)
|
||||
test.TestDelete(validNewPetSet())
|
||||
test.TestDelete(validNewStatefulSet())
|
||||
}
|
||||
|
||||
func TestWatch(t *testing.T) {
|
||||
@ -163,7 +163,7 @@ func TestWatch(t *testing.T) {
|
||||
defer storage.Store.DestroyFunc()
|
||||
test := registrytest.New(t, storage.Store)
|
||||
test.TestWatch(
|
||||
validNewPetSet(),
|
||||
validNewStatefulSet(),
|
||||
// matching labels
|
||||
[]labels.Set{
|
||||
{"a": "b"},
|
||||
|
@ -31,109 +31,109 @@ import (
|
||||
"k8s.io/kubernetes/pkg/util/validation/field"
|
||||
)
|
||||
|
||||
// petSetStrategy implements verification logic for Replication PetSets.
|
||||
type petSetStrategy struct {
|
||||
// statefulSetStrategy implements verification logic for Replication StatefulSets.
|
||||
type statefulSetStrategy struct {
|
||||
runtime.ObjectTyper
|
||||
api.NameGenerator
|
||||
}
|
||||
|
||||
// Strategy is the default logic that applies when creating and updating Replication PetSet objects.
|
||||
var Strategy = petSetStrategy{api.Scheme, api.SimpleNameGenerator}
|
||||
// Strategy is the default logic that applies when creating and updating Replication StatefulSet objects.
|
||||
var Strategy = statefulSetStrategy{api.Scheme, api.SimpleNameGenerator}
|
||||
|
||||
// NamespaceScoped returns true because all PetSet' need to be within a namespace.
|
||||
func (petSetStrategy) NamespaceScoped() bool {
|
||||
// NamespaceScoped returns true because all StatefulSet' need to be within a namespace.
|
||||
func (statefulSetStrategy) NamespaceScoped() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// PrepareForCreate clears the status of an PetSet before creation.
|
||||
func (petSetStrategy) PrepareForCreate(ctx api.Context, obj runtime.Object) {
|
||||
petSet := obj.(*apps.PetSet)
|
||||
// PrepareForCreate clears the status of an StatefulSet before creation.
|
||||
func (statefulSetStrategy) PrepareForCreate(ctx api.Context, obj runtime.Object) {
|
||||
statefulSet := obj.(*apps.StatefulSet)
|
||||
// create cannot set status
|
||||
petSet.Status = apps.PetSetStatus{}
|
||||
statefulSet.Status = apps.StatefulSetStatus{}
|
||||
|
||||
petSet.Generation = 1
|
||||
statefulSet.Generation = 1
|
||||
}
|
||||
|
||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||
func (petSetStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
|
||||
newPetSet := obj.(*apps.PetSet)
|
||||
oldPetSet := old.(*apps.PetSet)
|
||||
func (statefulSetStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
|
||||
newStatefulSet := obj.(*apps.StatefulSet)
|
||||
oldStatefulSet := old.(*apps.StatefulSet)
|
||||
// Update is not allowed to set status
|
||||
newPetSet.Status = oldPetSet.Status
|
||||
newStatefulSet.Status = oldStatefulSet.Status
|
||||
|
||||
// Any changes to the spec increment the generation number, any changes to the
|
||||
// status should reflect the generation number of the corresponding object.
|
||||
// See api.ObjectMeta description for more information on Generation.
|
||||
if !reflect.DeepEqual(oldPetSet.Spec, newPetSet.Spec) {
|
||||
newPetSet.Generation = oldPetSet.Generation + 1
|
||||
if !reflect.DeepEqual(oldStatefulSet.Spec, newStatefulSet.Spec) {
|
||||
newStatefulSet.Generation = oldStatefulSet.Generation + 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Validate validates a new PetSet.
|
||||
func (petSetStrategy) Validate(ctx api.Context, obj runtime.Object) field.ErrorList {
|
||||
petSet := obj.(*apps.PetSet)
|
||||
return validation.ValidatePetSet(petSet)
|
||||
// Validate validates a new StatefulSet.
|
||||
func (statefulSetStrategy) Validate(ctx api.Context, obj runtime.Object) field.ErrorList {
|
||||
statefulSet := obj.(*apps.StatefulSet)
|
||||
return validation.ValidateStatefulSet(statefulSet)
|
||||
}
|
||||
|
||||
// Canonicalize normalizes the object after validation.
|
||||
func (petSetStrategy) Canonicalize(obj runtime.Object) {
|
||||
func (statefulSetStrategy) Canonicalize(obj runtime.Object) {
|
||||
}
|
||||
|
||||
// AllowCreateOnUpdate is false for PetSet; this means POST is needed to create one.
|
||||
func (petSetStrategy) AllowCreateOnUpdate() bool {
|
||||
// AllowCreateOnUpdate is false for StatefulSet; this means POST is needed to create one.
|
||||
func (statefulSetStrategy) AllowCreateOnUpdate() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ValidateUpdate is the default update validation for an end user.
|
||||
func (petSetStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
|
||||
validationErrorList := validation.ValidatePetSet(obj.(*apps.PetSet))
|
||||
updateErrorList := validation.ValidatePetSetUpdate(obj.(*apps.PetSet), old.(*apps.PetSet))
|
||||
func (statefulSetStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
|
||||
validationErrorList := validation.ValidateStatefulSet(obj.(*apps.StatefulSet))
|
||||
updateErrorList := validation.ValidateStatefulSetUpdate(obj.(*apps.StatefulSet), old.(*apps.StatefulSet))
|
||||
return append(validationErrorList, updateErrorList...)
|
||||
}
|
||||
|
||||
// AllowUnconditionalUpdate is the default update policy for PetSet objects.
|
||||
func (petSetStrategy) AllowUnconditionalUpdate() bool {
|
||||
// AllowUnconditionalUpdate is the default update policy for StatefulSet objects.
|
||||
func (statefulSetStrategy) AllowUnconditionalUpdate() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// PetSetToSelectableFields returns a field set that represents the object.
|
||||
func PetSetToSelectableFields(petSet *apps.PetSet) fields.Set {
|
||||
return generic.ObjectMetaFieldsSet(&petSet.ObjectMeta, true)
|
||||
// StatefulSetToSelectableFields returns a field set that represents the object.
|
||||
func StatefulSetToSelectableFields(statefulSet *apps.StatefulSet) fields.Set {
|
||||
return generic.ObjectMetaFieldsSet(&statefulSet.ObjectMeta, true)
|
||||
}
|
||||
|
||||
// MatchPetSet is the filter used by the generic etcd backend to watch events
|
||||
// MatchStatefulSet is the filter used by the generic etcd backend to watch events
|
||||
// from etcd to clients of the apiserver only interested in specific labels/fields.
|
||||
func MatchPetSet(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
|
||||
func MatchStatefulSet(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
|
||||
return storage.SelectionPredicate{
|
||||
Label: label,
|
||||
Field: field,
|
||||
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
|
||||
petSet, ok := obj.(*apps.PetSet)
|
||||
statefulSet, ok := obj.(*apps.StatefulSet)
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("given object is not an PetSet.")
|
||||
return nil, nil, fmt.Errorf("given object is not an StatefulSet.")
|
||||
}
|
||||
return labels.Set(petSet.ObjectMeta.Labels), PetSetToSelectableFields(petSet), nil
|
||||
return labels.Set(statefulSet.ObjectMeta.Labels), StatefulSetToSelectableFields(statefulSet), nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type petSetStatusStrategy struct {
|
||||
petSetStrategy
|
||||
type statefulSetStatusStrategy struct {
|
||||
statefulSetStrategy
|
||||
}
|
||||
|
||||
var StatusStrategy = petSetStatusStrategy{Strategy}
|
||||
var StatusStrategy = statefulSetStatusStrategy{Strategy}
|
||||
|
||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update of status
|
||||
func (petSetStatusStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
|
||||
newPetSet := obj.(*apps.PetSet)
|
||||
oldPetSet := old.(*apps.PetSet)
|
||||
func (statefulSetStatusStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
|
||||
newStatefulSet := obj.(*apps.StatefulSet)
|
||||
oldStatefulSet := old.(*apps.StatefulSet)
|
||||
// status changes are not allowed to update spec
|
||||
newPetSet.Spec = oldPetSet.Spec
|
||||
newStatefulSet.Spec = oldStatefulSet.Spec
|
||||
}
|
||||
|
||||
// ValidateUpdate is the default update validation for an end user updating status
|
||||
func (petSetStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
|
||||
func (statefulSetStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
|
||||
// TODO: Validate status updates.
|
||||
return validation.ValidatePetSetStatusUpdate(obj.(*apps.PetSet), old.(*apps.PetSet))
|
||||
return validation.ValidateStatefulSetStatusUpdate(obj.(*apps.StatefulSet), old.(*apps.StatefulSet))
|
||||
}
|
||||
|
@ -24,13 +24,13 @@ import (
|
||||
"k8s.io/kubernetes/pkg/apis/apps"
|
||||
)
|
||||
|
||||
func TestPetSetStrategy(t *testing.T) {
|
||||
func TestStatefulSetStrategy(t *testing.T) {
|
||||
ctx := api.NewDefaultContext()
|
||||
if !Strategy.NamespaceScoped() {
|
||||
t.Errorf("PetSet must be namespace scoped")
|
||||
t.Errorf("StatefulSet must be namespace scoped")
|
||||
}
|
||||
if Strategy.AllowCreateOnUpdate() {
|
||||
t.Errorf("PetSet should not allow create on update")
|
||||
t.Errorf("StatefulSet should not allow create on update")
|
||||
}
|
||||
|
||||
validSelector := map[string]string{"a": "b"}
|
||||
@ -46,18 +46,18 @@ func TestPetSetStrategy(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
ps := &apps.PetSet{
|
||||
ps := &apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validSelector},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
Status: apps.PetSetStatus{Replicas: 3},
|
||||
Status: apps.StatefulSetStatus{Replicas: 3},
|
||||
}
|
||||
|
||||
Strategy.PrepareForCreate(ctx, ps)
|
||||
if ps.Status.Replicas != 0 {
|
||||
t.Error("PetSet should not allow setting status.pets on create")
|
||||
t.Error("StatefulSet should not allow setting status.replicas on create")
|
||||
}
|
||||
errs := Strategy.Validate(ctx, ps)
|
||||
if len(errs) != 0 {
|
||||
@ -65,35 +65,35 @@ func TestPetSetStrategy(t *testing.T) {
|
||||
}
|
||||
|
||||
// Just Spec.Replicas is allowed to change
|
||||
validPs := &apps.PetSet{
|
||||
validPs := &apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: ps.Name, Namespace: ps.Namespace, ResourceVersion: "1", Generation: 1},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: ps.Spec.Selector,
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
Status: apps.PetSetStatus{Replicas: 4},
|
||||
Status: apps.StatefulSetStatus{Replicas: 4},
|
||||
}
|
||||
Strategy.PrepareForUpdate(ctx, validPs, ps)
|
||||
errs = Strategy.ValidateUpdate(ctx, validPs, ps)
|
||||
if len(errs) != 0 {
|
||||
t.Errorf("Updating spec.Replicas is allowed on a petset: %v", errs)
|
||||
t.Errorf("Updating spec.Replicas is allowed on a statefulset: %v", errs)
|
||||
}
|
||||
|
||||
validPs.Spec.Selector = &unversioned.LabelSelector{MatchLabels: map[string]string{"a": "bar"}}
|
||||
Strategy.PrepareForUpdate(ctx, validPs, ps)
|
||||
errs = Strategy.ValidateUpdate(ctx, validPs, ps)
|
||||
if len(errs) == 0 {
|
||||
t.Errorf("Expected a validation error since updates are disallowed on petsets.")
|
||||
t.Errorf("Expected a validation error since updates are disallowed on statefulsets.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPetSetStatusStrategy(t *testing.T) {
|
||||
func TestStatefulSetStatusStrategy(t *testing.T) {
|
||||
ctx := api.NewDefaultContext()
|
||||
if !StatusStrategy.NamespaceScoped() {
|
||||
t.Errorf("PetSet must be namespace scoped")
|
||||
t.Errorf("StatefulSet must be namespace scoped")
|
||||
}
|
||||
if StatusStrategy.AllowCreateOnUpdate() {
|
||||
t.Errorf("PetSet should not allow create on update")
|
||||
t.Errorf("StatefulSet should not allow create on update")
|
||||
}
|
||||
validSelector := map[string]string{"a": "b"}
|
||||
validPodTemplate := api.PodTemplate{
|
||||
@ -108,34 +108,34 @@ func TestPetSetStatusStrategy(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
oldPS := &apps.PetSet{
|
||||
oldPS := &apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault, ResourceVersion: "10"},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: 3,
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validSelector},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
Status: apps.PetSetStatus{
|
||||
Status: apps.StatefulSetStatus{
|
||||
Replicas: 1,
|
||||
},
|
||||
}
|
||||
newPS := &apps.PetSet{
|
||||
newPS := &apps.StatefulSet{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault, ResourceVersion: "9"},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Replicas: 1,
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: validSelector},
|
||||
Template: validPodTemplate.Template,
|
||||
},
|
||||
Status: apps.PetSetStatus{
|
||||
Status: apps.StatefulSetStatus{
|
||||
Replicas: 2,
|
||||
},
|
||||
}
|
||||
StatusStrategy.PrepareForUpdate(ctx, newPS, oldPS)
|
||||
if newPS.Status.Replicas != 2 {
|
||||
t.Errorf("PetSet status updates should allow change of pets: %v", newPS.Status.Replicas)
|
||||
t.Errorf("StatefulSet status updates should allow change of pods: %v", newPS.Status.Replicas)
|
||||
}
|
||||
if newPS.Spec.Replicas != 3 {
|
||||
t.Errorf("PetSet status updates should not clobber spec: %v", newPS.Spec)
|
||||
t.Errorf("StatefulSet status updates should not clobber spec: %v", newPS.Spec)
|
||||
}
|
||||
errs := StatusStrategy.ValidateUpdate(ctx, newPS, oldPS)
|
||||
if len(errs) != 0 {
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/apis/apps"
|
||||
appsapiv1alpha1 "k8s.io/kubernetes/pkg/apis/apps/v1alpha1"
|
||||
"k8s.io/kubernetes/pkg/genericapiserver"
|
||||
petsetetcd "k8s.io/kubernetes/pkg/registry/apps/petset/etcd"
|
||||
statefulsetetcd "k8s.io/kubernetes/pkg/registry/apps/petset/etcd"
|
||||
)
|
||||
|
||||
type RESTStorageProvider struct{}
|
||||
@ -43,10 +43,10 @@ func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource genericapis
|
||||
version := appsapiv1alpha1.SchemeGroupVersion
|
||||
|
||||
storage := map[string]rest.Storage{}
|
||||
if apiResourceConfigSource.ResourceEnabled(version.WithResource("petsets")) {
|
||||
petsetStorage, petsetStatusStorage := petsetetcd.NewREST(restOptionsGetter(apps.Resource("petsets")))
|
||||
storage["petsets"] = petsetStorage
|
||||
storage["petsets/status"] = petsetStatusStorage
|
||||
if apiResourceConfigSource.ResourceEnabled(version.WithResource("statefulsets")) {
|
||||
statefulsetStorage, statefulsetStatusStorage := statefulsetetcd.NewREST(restOptionsGetter(apps.Resource("statefulsets")))
|
||||
storage["statefulsets"] = statefulsetStorage
|
||||
storage["statefulsets/status"] = statefulsetStatusStorage
|
||||
}
|
||||
return storage
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ const (
|
||||
HorizontalPodAutoscalers Resource = "horizontalpodautoscalers"
|
||||
Ingress Resource = "ingress"
|
||||
PodDisruptionBudget Resource = "poddisruptionbudgets"
|
||||
PetSet Resource = "petset"
|
||||
StatefulSet Resource = "statefulset"
|
||||
Jobs Resource = "jobs"
|
||||
LimitRanges Resource = "limitranges"
|
||||
Namespaces Resource = "namespaces"
|
||||
|
@ -274,7 +274,7 @@ func GetPath(mounter Mounter) (string, error) {
|
||||
// ChooseZone implements our heuristics for choosing a zone for volume creation based on the volume name
|
||||
// Volumes are generally round-robin-ed across all active zones, using the hash of the PVC Name.
|
||||
// However, if the PVCName ends with `-<integer>`, we will hash the prefix, and then add the integer to the hash.
|
||||
// This means that a PetSet's volumes (`claimname-petsetname-id`) will spread across available zones,
|
||||
// This means that a StatefulSet's volumes (`claimname-statefulsetname-id`) will spread across available zones,
|
||||
// assuming the id values are consecutive.
|
||||
func ChooseZoneForVolume(zones sets.String, pvcName string) string {
|
||||
// We create the volume in a zone determined by the name
|
||||
@ -290,8 +290,8 @@ func ChooseZoneForVolume(zones sets.String, pvcName string) string {
|
||||
} else {
|
||||
hashString := pvcName
|
||||
|
||||
// Heuristic to make sure that volumes in a PetSet are spread across zones
|
||||
// PetSet PVCs are (currently) named ClaimName-PetSetName-Id,
|
||||
// Heuristic to make sure that volumes in a StatefulSet are spread across zones
|
||||
// StatefulSet PVCs are (currently) named ClaimName-StatefulSetName-Id,
|
||||
// where Id is an integer index
|
||||
lastDash := strings.LastIndexByte(pvcName, '-')
|
||||
if lastDash != -1 {
|
||||
@ -302,7 +302,7 @@ func ChooseZoneForVolume(zones sets.String, pvcName string) string {
|
||||
index = uint32(petID)
|
||||
// We still hash the volume name, but only the base
|
||||
hashString = pvcName[:lastDash]
|
||||
glog.V(2).Infof("Detected PetSet-style volume name %q; index=%d", pvcName, index)
|
||||
glog.V(2).Infof("Detected StatefulSet-style volume name %q; index=%d", pvcName, index)
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ func ChooseZoneForVolume(zones sets.String, pvcName string) string {
|
||||
|
||||
// Zones.List returns zones in a consistent order (sorted)
|
||||
// We do have a potential failure case where volumes will not be properly spread,
|
||||
// if the set of zones changes during PetSet volume creation. However, this is
|
||||
// if the set of zones changes during StatefulSet volume creation. However, this is
|
||||
// probably relatively unlikely because we expect the set of zones to be essentially
|
||||
// static for clusters.
|
||||
// Hopefully we can address this problem if/when we do full scheduler integration of
|
||||
|
@ -82,7 +82,7 @@ func ClusterRoles() []rbac.ClusterRole {
|
||||
rbac.NewRule(Read...).Groups(legacyGroup).Resources("namespaces").RuleOrDie(),
|
||||
rbac.NewRule("impersonate").Groups(legacyGroup).Resources("serviceaccounts").RuleOrDie(),
|
||||
|
||||
rbac.NewRule(ReadWrite...).Groups(appsGroup).Resources("petsets").RuleOrDie(),
|
||||
rbac.NewRule(ReadWrite...).Groups(appsGroup).Resources("statefulsets").RuleOrDie(),
|
||||
|
||||
rbac.NewRule(ReadWrite...).Groups(autoscalingGroup).Resources("horizontalpodautoscalers").RuleOrDie(),
|
||||
|
||||
@ -112,7 +112,7 @@ func ClusterRoles() []rbac.ClusterRole {
|
||||
rbac.NewRule(Read...).Groups(legacyGroup).Resources("namespaces").RuleOrDie(),
|
||||
rbac.NewRule("impersonate").Groups(legacyGroup).Resources("serviceaccounts").RuleOrDie(),
|
||||
|
||||
rbac.NewRule(ReadWrite...).Groups(appsGroup).Resources("petsets").RuleOrDie(),
|
||||
rbac.NewRule(ReadWrite...).Groups(appsGroup).Resources("statefulsets").RuleOrDie(),
|
||||
|
||||
rbac.NewRule(ReadWrite...).Groups(autoscalingGroup).Resources("horizontalpodautoscalers").RuleOrDie(),
|
||||
|
||||
@ -135,7 +135,7 @@ func ClusterRoles() []rbac.ClusterRole {
|
||||
// indicator of which namespaces you have access to.
|
||||
rbac.NewRule(Read...).Groups(legacyGroup).Resources("namespaces").RuleOrDie(),
|
||||
|
||||
rbac.NewRule(Read...).Groups(appsGroup).Resources("petsets").RuleOrDie(),
|
||||
rbac.NewRule(Read...).Groups(appsGroup).Resources("statefulsets").RuleOrDie(),
|
||||
|
||||
rbac.NewRule(Read...).Groups(autoscalingGroup).Resources("horizontalpodautoscalers").RuleOrDie(),
|
||||
|
||||
|
@ -37,7 +37,7 @@ const (
|
||||
// GCE instances can have up to 16 PD volumes attached.
|
||||
DefaultMaxGCEPDVolumes = 16
|
||||
ClusterAutoscalerProvider = "ClusterAutoscalerProvider"
|
||||
PetSetKind = "PetSet"
|
||||
StatefulSetKind = "StatefulSet"
|
||||
)
|
||||
|
||||
// getMaxVols checks the max PD volumes environment variable, otherwise returning a default value
|
||||
@ -239,7 +239,7 @@ func GetEquivalencePod(pod *api.Pod) interface{} {
|
||||
func isValidControllerKind(kind string) bool {
|
||||
switch kind {
|
||||
// list of kinds that we cannot handle
|
||||
case PetSetKind:
|
||||
case StatefulSetKind:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
|
@ -244,8 +244,8 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
|
||||
})
|
||||
})
|
||||
|
||||
framework.KubeDescribe("CassandraPetSet", func() {
|
||||
It("should create petset", func() {
|
||||
framework.KubeDescribe("CassandraStatefulSet", func() {
|
||||
It("should create statefulset", func() {
|
||||
mkpath := func(file string) string {
|
||||
return filepath.Join(framework.TestContext.RepoRoot, "examples/storage/cassandra", file)
|
||||
}
|
||||
@ -258,9 +258,9 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
|
||||
|
||||
output := strings.Replace(string(input), "cassandra-0.cassandra.default.svc.cluster.local", "cassandra-0.cassandra."+ns+".svc.cluster.local", -1)
|
||||
|
||||
petSetYaml := "/tmp/cassandra-petset.yaml"
|
||||
statefulsetYaml := "/tmp/cassandra-petset.yaml"
|
||||
|
||||
err = ioutil.WriteFile(petSetYaml, []byte(output), 0644)
|
||||
err = ioutil.WriteFile(statefulsetYaml, []byte(output), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
By("Starting the cassandra service")
|
||||
@ -269,21 +269,21 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
|
||||
err = framework.WaitForService(c, ns, "cassandra", true, framework.Poll, framework.ServiceRespondingTimeout)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
// Create an PetSet with n nodes in it. Each node will then be verified.
|
||||
By("Creating a Cassandra PetSet")
|
||||
// Create an StatefulSet with n nodes in it. Each node will then be verified.
|
||||
By("Creating a Cassandra StatefulSet")
|
||||
|
||||
framework.RunKubectlOrDie("create", "-f", petSetYaml, nsFlag)
|
||||
framework.RunKubectlOrDie("create", "-f", statefulsetYaml, nsFlag)
|
||||
|
||||
petsetPoll := 30 * time.Second
|
||||
petsetTimeout := 10 * time.Minute
|
||||
statefulsetPoll := 30 * time.Second
|
||||
statefulsetTimeout := 10 * time.Minute
|
||||
// TODO - parse this number out of the yaml
|
||||
numPets := 3
|
||||
label := labels.SelectorFromSet(labels.Set(map[string]string{"app": "cassandra"}))
|
||||
err = wait.PollImmediate(petsetPoll, petsetTimeout,
|
||||
err = wait.PollImmediate(statefulsetPoll, statefulsetTimeout,
|
||||
func() (bool, error) {
|
||||
podList, err := c.Core().Pods(ns).List(api.ListOptions{LabelSelector: label})
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("Unable to get list of pods in petset %s", label)
|
||||
return false, fmt.Errorf("Unable to get list of pods in statefulset %s", label)
|
||||
}
|
||||
ExpectNoError(err)
|
||||
if len(podList.Items) < numPets {
|
||||
@ -312,8 +312,8 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
|
||||
framework.Failf("Cassandra pod ip %s is not reporting Up and Normal 'UN' via nodetool status", pod.Status.PodIP)
|
||||
}
|
||||
})
|
||||
// using out of petset e2e as deleting pvc is a pain
|
||||
deleteAllPetSets(c, ns)
|
||||
// using out of statefulset e2e as deleting pvc is a pain
|
||||
deleteAllStatefulSets(c, ns)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -110,7 +110,7 @@ func verifyExpectedRcsExistAndGetExpectedPods(c clientset.Interface) ([]string,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
psList, err := c.Apps().PetSets(api.NamespaceSystem).List(options)
|
||||
psList, err := c.Apps().StatefulSets(api.NamespaceSystem).List(options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -46,15 +46,15 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
petsetPoll = 10 * time.Second
|
||||
statefulsetPoll = 10 * time.Second
|
||||
// Some pets install base packages via wget
|
||||
petsetTimeout = 10 * time.Minute
|
||||
statefulsetTimeout = 10 * time.Minute
|
||||
// Timeout for pet pods to change state
|
||||
petPodTimeout = 5 * time.Minute
|
||||
zookeeperManifestPath = "test/e2e/testing-manifests/petset/zookeeper"
|
||||
mysqlGaleraManifestPath = "test/e2e/testing-manifests/petset/mysql-galera"
|
||||
redisManifestPath = "test/e2e/testing-manifests/petset/redis"
|
||||
// Should the test restart petset clusters?
|
||||
// Should the test restart statefulset clusters?
|
||||
// TODO: enable when we've productionzed bringup of pets in this e2e.
|
||||
restartCluster = false
|
||||
|
||||
@ -65,7 +65,7 @@ const (
|
||||
// Time: 25m, slow by design.
|
||||
// GCE Quota requirements: 3 pds, one per pet manifest declared above.
|
||||
// GCE Api requirements: nodes and master need storage r/w permissions.
|
||||
var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
||||
var _ = framework.KubeDescribe("StatefulSet [Slow] [Feature:PetSet]", func() {
|
||||
options := framework.FrameworkOptions{
|
||||
GroupVersion: &unversioned.GroupVersion{Group: apps.GroupName, Version: "v1alpha1"},
|
||||
}
|
||||
@ -74,19 +74,19 @@ var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
||||
var c clientset.Interface
|
||||
|
||||
BeforeEach(func() {
|
||||
// PetSet is in alpha, so it's disabled on some platforms. We skip this
|
||||
// StatefulSet is in alpha, so it's disabled on some platforms. We skip this
|
||||
// test if a resource get fails on non-GCE platforms.
|
||||
// In theory, tests that restart pets should pass on any platform with a
|
||||
// dynamic volume provisioner.
|
||||
if !framework.ProviderIs("gce") {
|
||||
framework.SkipIfMissingResource(f.ClientPool, unversioned.GroupVersionResource{Group: apps.GroupName, Version: "v1alpha1", Resource: "petsets"}, f.Namespace.Name)
|
||||
framework.SkipIfMissingResource(f.ClientPool, unversioned.GroupVersionResource{Group: apps.GroupName, Version: "v1alpha1", Resource: "statefulsets"}, f.Namespace.Name)
|
||||
}
|
||||
|
||||
c = f.ClientSet
|
||||
ns = f.Namespace.Name
|
||||
})
|
||||
|
||||
framework.KubeDescribe("Basic PetSet functionality", func() {
|
||||
framework.KubeDescribe("Basic StatefulSet functionality", func() {
|
||||
psName := "pet"
|
||||
labels := map[string]string{
|
||||
"foo": "bar",
|
||||
@ -105,24 +105,24 @@ var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
||||
if CurrentGinkgoTestDescription().Failed {
|
||||
dumpDebugInfo(c, ns)
|
||||
}
|
||||
framework.Logf("Deleting all petset in ns %v", ns)
|
||||
deleteAllPetSets(c, ns)
|
||||
framework.Logf("Deleting all statefulset in ns %v", ns)
|
||||
deleteAllStatefulSets(c, ns)
|
||||
})
|
||||
|
||||
It("should provide basic identity [Feature:PetSet]", func() {
|
||||
By("creating petset " + psName + " in namespace " + ns)
|
||||
It("should provide basic identity [Feature:StatefulSet]", func() {
|
||||
By("creating statefulset " + psName + " in namespace " + ns)
|
||||
petMounts := []api.VolumeMount{{Name: "datadir", MountPath: "/data/"}}
|
||||
podMounts := []api.VolumeMount{{Name: "home", MountPath: "/home"}}
|
||||
ps := newPetSet(psName, ns, headlessSvcName, 3, petMounts, podMounts, labels)
|
||||
_, err := c.Apps().PetSets(ns).Create(ps)
|
||||
ps := newStatefulSet(psName, ns, headlessSvcName, 3, petMounts, podMounts, labels)
|
||||
_, err := c.Apps().StatefulSets(ns).Create(ps)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
pst := petSetTester{c: c}
|
||||
pst := statefulSetTester{c: c}
|
||||
|
||||
By("Saturating pet set " + ps.Name)
|
||||
pst.saturate(ps)
|
||||
|
||||
By("Verifying petset mounted data directory is usable")
|
||||
By("Verifying statefulset mounted data directory is usable")
|
||||
ExpectNoError(pst.checkMount(ps, "/data"))
|
||||
|
||||
cmd := "echo $(hostname) > /data/hostname; sync;"
|
||||
@ -133,7 +133,7 @@ var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
||||
pst.restart(ps)
|
||||
pst.saturate(ps)
|
||||
|
||||
By("Verifying petset mounted data directory is usable")
|
||||
By("Verifying statefulset mounted data directory is usable")
|
||||
ExpectNoError(pst.checkMount(ps, "/data"))
|
||||
|
||||
cmd = "if [ \"$(cat /data/hostname)\" = \"$(hostname)\" ]; then exit 0; else exit 1; fi"
|
||||
@ -142,15 +142,15 @@ var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
||||
})
|
||||
|
||||
It("should handle healthy pet restarts during scale [Feature:PetSet]", func() {
|
||||
By("creating petset " + psName + " in namespace " + ns)
|
||||
By("creating statefulset " + psName + " in namespace " + ns)
|
||||
|
||||
petMounts := []api.VolumeMount{{Name: "datadir", MountPath: "/data/"}}
|
||||
podMounts := []api.VolumeMount{{Name: "home", MountPath: "/home"}}
|
||||
ps := newPetSet(psName, ns, headlessSvcName, 2, petMounts, podMounts, labels)
|
||||
_, err := c.Apps().PetSets(ns).Create(ps)
|
||||
ps := newStatefulSet(psName, ns, headlessSvcName, 2, petMounts, podMounts, labels)
|
||||
_, err := c.Apps().StatefulSets(ns).Create(ps)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
pst := petSetTester{c: c}
|
||||
pst := statefulSetTester{c: c}
|
||||
|
||||
pst.waitForRunning(1, ps)
|
||||
|
||||
@ -173,7 +173,7 @@ var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
||||
By("Deleting unhealthy pet at index 1.")
|
||||
pst.deletePetAtIndex(1, ps)
|
||||
|
||||
By("Confirming all pets in petset are created.")
|
||||
By("Confirming all pets in statefulset are created.")
|
||||
pst.saturate(ps)
|
||||
})
|
||||
})
|
||||
@ -183,12 +183,12 @@ var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
||||
if CurrentGinkgoTestDescription().Failed {
|
||||
dumpDebugInfo(c, ns)
|
||||
}
|
||||
framework.Logf("Deleting all petset in ns %v", ns)
|
||||
deleteAllPetSets(c, ns)
|
||||
framework.Logf("Deleting all statefulset in ns %v", ns)
|
||||
deleteAllStatefulSets(c, ns)
|
||||
})
|
||||
|
||||
It("should creating a working zookeeper cluster [Feature:PetSet]", func() {
|
||||
pst := &petSetTester{c: c}
|
||||
pst := &statefulSetTester{c: c}
|
||||
pet := &zookeeperTester{tester: pst}
|
||||
By("Deploying " + pet.name())
|
||||
ps := pet.deploy(ns)
|
||||
@ -209,7 +209,7 @@ var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
||||
})
|
||||
|
||||
It("should creating a working redis cluster [Feature:PetSet]", func() {
|
||||
pst := &petSetTester{c: c}
|
||||
pst := &statefulSetTester{c: c}
|
||||
pet := &redisTester{tester: pst}
|
||||
By("Deploying " + pet.name())
|
||||
ps := pet.deploy(ns)
|
||||
@ -230,7 +230,7 @@ var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
||||
})
|
||||
|
||||
It("should creating a working mysql cluster [Feature:PetSet]", func() {
|
||||
pst := &petSetTester{c: c}
|
||||
pst := &statefulSetTester{c: c}
|
||||
pet := &mysqlGaleraTester{tester: pst}
|
||||
By("Deploying " + pet.name())
|
||||
ps := pet.deploy(ns)
|
||||
@ -263,7 +263,7 @@ var _ = framework.KubeDescribe("Pet set recreate [Slow] [Feature:PetSet]", func(
|
||||
}
|
||||
headlessSvcName := "test"
|
||||
podName := "test-pod"
|
||||
petSetName := "web"
|
||||
statefulSetName := "web"
|
||||
petPodName := "web-0"
|
||||
|
||||
BeforeEach(func() {
|
||||
@ -280,11 +280,11 @@ var _ = framework.KubeDescribe("Pet set recreate [Slow] [Feature:PetSet]", func(
|
||||
if CurrentGinkgoTestDescription().Failed {
|
||||
dumpDebugInfo(c, ns)
|
||||
}
|
||||
By("Deleting all petset in ns " + ns)
|
||||
deleteAllPetSets(c, ns)
|
||||
By("Deleting all statefulset in ns " + ns)
|
||||
deleteAllStatefulSets(c, ns)
|
||||
})
|
||||
|
||||
It("should recreate evicted petset", func() {
|
||||
It("should recreate evicted statefulset", func() {
|
||||
By("looking for a node to schedule pet set and pod")
|
||||
nodes := framework.GetReadySchedulableNodesOrDie(f.ClientSet)
|
||||
node := nodes.Items[0]
|
||||
@ -309,12 +309,12 @@ var _ = framework.KubeDescribe("Pet set recreate [Slow] [Feature:PetSet]", func(
|
||||
pod, err := f.ClientSet.Core().Pods(f.Namespace.Name).Create(pod)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
By("creating petset with conflicting port in namespace " + f.Namespace.Name)
|
||||
ps := newPetSet(petSetName, f.Namespace.Name, headlessSvcName, 1, nil, nil, labels)
|
||||
By("creating statefulset with conflicting port in namespace " + f.Namespace.Name)
|
||||
ps := newStatefulSet(statefulSetName, f.Namespace.Name, headlessSvcName, 1, nil, nil, labels)
|
||||
petContainer := &ps.Spec.Template.Spec.Containers[0]
|
||||
petContainer.Ports = append(petContainer.Ports, conflictingPort)
|
||||
ps.Spec.Template.Spec.NodeName = node.Name
|
||||
_, err = f.ClientSet.Apps().PetSets(f.Namespace.Name).Create(ps)
|
||||
_, err = f.ClientSet.Apps().StatefulSets(f.Namespace.Name).Create(ps)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
By("waiting until pod " + podName + " will start running in namespace " + f.Namespace.Name)
|
||||
@ -337,7 +337,7 @@ var _ = framework.KubeDescribe("Pet set recreate [Slow] [Feature:PetSet]", func(
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
framework.Logf("Observed pet pod in namespace: %v, name: %v, uid: %v, status phase: %v. Waiting for petset controller to delete.",
|
||||
framework.Logf("Observed pet pod in namespace: %v, name: %v, uid: %v, status phase: %v. Waiting for statefulset controller to delete.",
|
||||
pod.Namespace, pod.Name, pod.UID, pod.Status.Phase)
|
||||
initialPetPodUID = pod.UID
|
||||
return false, nil
|
||||
@ -391,23 +391,23 @@ func kubectlExecWithRetries(args ...string) (out string) {
|
||||
}
|
||||
|
||||
type petTester interface {
|
||||
deploy(ns string) *apps.PetSet
|
||||
deploy(ns string) *apps.StatefulSet
|
||||
write(petIndex int, kv map[string]string)
|
||||
read(petIndex int, key string) string
|
||||
name() string
|
||||
}
|
||||
|
||||
type zookeeperTester struct {
|
||||
ps *apps.PetSet
|
||||
tester *petSetTester
|
||||
ps *apps.StatefulSet
|
||||
tester *statefulSetTester
|
||||
}
|
||||
|
||||
func (z *zookeeperTester) name() string {
|
||||
return "zookeeper"
|
||||
}
|
||||
|
||||
func (z *zookeeperTester) deploy(ns string) *apps.PetSet {
|
||||
z.ps = z.tester.createPetSet(zookeeperManifestPath, ns)
|
||||
func (z *zookeeperTester) deploy(ns string) *apps.StatefulSet {
|
||||
z.ps = z.tester.createStatefulSet(zookeeperManifestPath, ns)
|
||||
return z.ps
|
||||
}
|
||||
|
||||
@ -428,8 +428,8 @@ func (z *zookeeperTester) read(petIndex int, key string) string {
|
||||
}
|
||||
|
||||
type mysqlGaleraTester struct {
|
||||
ps *apps.PetSet
|
||||
tester *petSetTester
|
||||
ps *apps.StatefulSet
|
||||
tester *statefulSetTester
|
||||
}
|
||||
|
||||
func (m *mysqlGaleraTester) name() string {
|
||||
@ -444,13 +444,13 @@ func (m *mysqlGaleraTester) mysqlExec(cmd, ns, podName string) string {
|
||||
return kubectlExecWithRetries(fmt.Sprintf("--namespace=%v", ns), "exec", podName, "--", "/bin/sh", "-c", cmd)
|
||||
}
|
||||
|
||||
func (m *mysqlGaleraTester) deploy(ns string) *apps.PetSet {
|
||||
m.ps = m.tester.createPetSet(mysqlGaleraManifestPath, ns)
|
||||
func (m *mysqlGaleraTester) deploy(ns string) *apps.StatefulSet {
|
||||
m.ps = m.tester.createStatefulSet(mysqlGaleraManifestPath, ns)
|
||||
|
||||
framework.Logf("Deployed petset %v, initializing database", m.ps.Name)
|
||||
framework.Logf("Deployed statefulset %v, initializing database", m.ps.Name)
|
||||
for _, cmd := range []string{
|
||||
"create database petset;",
|
||||
"use petset; create table pet (k varchar(20), v varchar(20));",
|
||||
"create database statefulset;",
|
||||
"use statefulset; create table pet (k varchar(20), v varchar(20));",
|
||||
} {
|
||||
framework.Logf(m.mysqlExec(cmd, ns, fmt.Sprintf("%v-0", m.ps.Name)))
|
||||
}
|
||||
@ -460,19 +460,19 @@ func (m *mysqlGaleraTester) deploy(ns string) *apps.PetSet {
|
||||
func (m *mysqlGaleraTester) write(petIndex int, kv map[string]string) {
|
||||
name := fmt.Sprintf("%v-%d", m.ps.Name, petIndex)
|
||||
for k, v := range kv {
|
||||
cmd := fmt.Sprintf("use petset; insert into pet (k, v) values (\"%v\", \"%v\");", k, v)
|
||||
cmd := fmt.Sprintf("use statefulset; insert into pet (k, v) values (\"%v\", \"%v\");", k, v)
|
||||
framework.Logf(m.mysqlExec(cmd, m.ps.Namespace, name))
|
||||
}
|
||||
}
|
||||
|
||||
func (m *mysqlGaleraTester) read(petIndex int, key string) string {
|
||||
name := fmt.Sprintf("%v-%d", m.ps.Name, petIndex)
|
||||
return lastLine(m.mysqlExec(fmt.Sprintf("use petset; select v from pet where k=\"%v\";", key), m.ps.Namespace, name))
|
||||
return lastLine(m.mysqlExec(fmt.Sprintf("use statefulset; select v from pet where k=\"%v\";", key), m.ps.Namespace, name))
|
||||
}
|
||||
|
||||
type redisTester struct {
|
||||
ps *apps.PetSet
|
||||
tester *petSetTester
|
||||
ps *apps.StatefulSet
|
||||
tester *statefulSetTester
|
||||
}
|
||||
|
||||
func (m *redisTester) name() string {
|
||||
@ -484,8 +484,8 @@ func (m *redisTester) redisExec(cmd, ns, podName string) string {
|
||||
return framework.RunKubectlOrDie(fmt.Sprintf("--namespace=%v", ns), "exec", podName, "--", "/bin/sh", "-c", cmd)
|
||||
}
|
||||
|
||||
func (m *redisTester) deploy(ns string) *apps.PetSet {
|
||||
m.ps = m.tester.createPetSet(redisManifestPath, ns)
|
||||
func (m *redisTester) deploy(ns string) *apps.StatefulSet {
|
||||
m.ps = m.tester.createStatefulSet(redisManifestPath, ns)
|
||||
return m.ps
|
||||
}
|
||||
|
||||
@ -506,9 +506,9 @@ func lastLine(out string) string {
|
||||
return outLines[len(outLines)-1]
|
||||
}
|
||||
|
||||
func petSetFromManifest(fileName, ns string) *apps.PetSet {
|
||||
var ps apps.PetSet
|
||||
framework.Logf("Parsing petset from %v", fileName)
|
||||
func statefulSetFromManifest(fileName, ns string) *apps.StatefulSet {
|
||||
var ps apps.StatefulSet
|
||||
framework.Logf("Parsing statefulset from %v", fileName)
|
||||
data, err := ioutil.ReadFile(fileName)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
json, err := utilyaml.ToJSON(data)
|
||||
@ -524,27 +524,27 @@ func petSetFromManifest(fileName, ns string) *apps.PetSet {
|
||||
return &ps
|
||||
}
|
||||
|
||||
// petSetTester has all methods required to test a single petset.
|
||||
type petSetTester struct {
|
||||
// statefulSetTester has all methods required to test a single statefulset.
|
||||
type statefulSetTester struct {
|
||||
c clientset.Interface
|
||||
}
|
||||
|
||||
func (p *petSetTester) createPetSet(manifestPath, ns string) *apps.PetSet {
|
||||
func (p *statefulSetTester) createStatefulSet(manifestPath, ns string) *apps.StatefulSet {
|
||||
mkpath := func(file string) string {
|
||||
return filepath.Join(framework.TestContext.RepoRoot, manifestPath, file)
|
||||
}
|
||||
ps := petSetFromManifest(mkpath("petset.yaml"), ns)
|
||||
ps := statefulSetFromManifest(mkpath("petset.yaml"), ns)
|
||||
|
||||
framework.Logf(fmt.Sprintf("creating " + ps.Name + " service"))
|
||||
framework.RunKubectlOrDie("create", "-f", mkpath("service.yaml"), fmt.Sprintf("--namespace=%v", ns))
|
||||
|
||||
framework.Logf(fmt.Sprintf("creating petset %v/%v with %d replicas and selector %+v", ps.Namespace, ps.Name, ps.Spec.Replicas, ps.Spec.Selector))
|
||||
framework.Logf(fmt.Sprintf("creating statefulset %v/%v with %d replicas and selector %+v", ps.Namespace, ps.Name, ps.Spec.Replicas, ps.Spec.Selector))
|
||||
framework.RunKubectlOrDie("create", "-f", mkpath("petset.yaml"), fmt.Sprintf("--namespace=%v", ns))
|
||||
p.waitForRunning(ps.Spec.Replicas, ps)
|
||||
return ps
|
||||
}
|
||||
|
||||
func (p *petSetTester) checkMount(ps *apps.PetSet, mountPath string) error {
|
||||
func (p *statefulSetTester) checkMount(ps *apps.StatefulSet, mountPath string) error {
|
||||
for _, cmd := range []string{
|
||||
// Print inode, size etc
|
||||
fmt.Sprintf("ls -idlh %v", mountPath),
|
||||
@ -560,7 +560,7 @@ func (p *petSetTester) checkMount(ps *apps.PetSet, mountPath string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *petSetTester) execInPets(ps *apps.PetSet, cmd string) error {
|
||||
func (p *statefulSetTester) execInPets(ps *apps.StatefulSet, cmd string) error {
|
||||
podList := p.getPodList(ps)
|
||||
for _, pet := range podList.Items {
|
||||
stdout, err := framework.RunHostCmd(pet.Namespace, pet.Name, cmd)
|
||||
@ -572,7 +572,7 @@ func (p *petSetTester) execInPets(ps *apps.PetSet, cmd string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *petSetTester) saturate(ps *apps.PetSet) {
|
||||
func (p *statefulSetTester) saturate(ps *apps.StatefulSet) {
|
||||
// TODO: Watch events and check that creation timestamps don't overlap
|
||||
var i int32
|
||||
for i = 0; i < ps.Spec.Replicas; i++ {
|
||||
@ -583,23 +583,23 @@ func (p *petSetTester) saturate(ps *apps.PetSet) {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *petSetTester) deletePetAtIndex(index int, ps *apps.PetSet) {
|
||||
func (p *statefulSetTester) deletePetAtIndex(index int, ps *apps.StatefulSet) {
|
||||
// TODO: we won't use "-index" as the name strategy forever,
|
||||
// pull the name out from an identity mapper.
|
||||
name := fmt.Sprintf("%v-%v", ps.Name, index)
|
||||
noGrace := int64(0)
|
||||
if err := p.c.Core().Pods(ps.Namespace).Delete(name, &api.DeleteOptions{GracePeriodSeconds: &noGrace}); err != nil {
|
||||
framework.Failf("Failed to delete pet %v for PetSet %v: %v", name, ps.Name, ps.Namespace, err)
|
||||
framework.Failf("Failed to delete pet %v for StatefulSet %v: %v", name, ps.Name, ps.Namespace, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *petSetTester) scale(ps *apps.PetSet, count int32) error {
|
||||
func (p *statefulSetTester) scale(ps *apps.StatefulSet, count int32) error {
|
||||
name := ps.Name
|
||||
ns := ps.Namespace
|
||||
p.update(ns, name, func(ps *apps.PetSet) { ps.Spec.Replicas = count })
|
||||
p.update(ns, name, func(ps *apps.StatefulSet) { ps.Spec.Replicas = count })
|
||||
|
||||
var petList *api.PodList
|
||||
pollErr := wait.PollImmediate(petsetPoll, petsetTimeout, func() (bool, error) {
|
||||
pollErr := wait.PollImmediate(statefulsetPoll, statefulsetTimeout, func() (bool, error) {
|
||||
petList = p.getPodList(ps)
|
||||
if int32(len(petList.Items)) == count {
|
||||
return true, nil
|
||||
@ -614,36 +614,36 @@ func (p *petSetTester) scale(ps *apps.PetSet, count int32) error {
|
||||
unhealthy = append(unhealthy, fmt.Sprintf("%v: deletion %v, phase %v, readiness %v", pet.Name, delTs, phase, readiness))
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("Failed to scale petset to %d in %v. Remaining pods:\n%v", count, petsetTimeout, unhealthy)
|
||||
return fmt.Errorf("Failed to scale statefulset to %d in %v. Remaining pods:\n%v", count, statefulsetTimeout, unhealthy)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *petSetTester) restart(ps *apps.PetSet) {
|
||||
func (p *statefulSetTester) restart(ps *apps.StatefulSet) {
|
||||
oldReplicas := ps.Spec.Replicas
|
||||
ExpectNoError(p.scale(ps, 0))
|
||||
p.update(ps.Namespace, ps.Name, func(ps *apps.PetSet) { ps.Spec.Replicas = oldReplicas })
|
||||
p.update(ps.Namespace, ps.Name, func(ps *apps.StatefulSet) { ps.Spec.Replicas = oldReplicas })
|
||||
}
|
||||
|
||||
func (p *petSetTester) update(ns, name string, update func(ps *apps.PetSet)) {
|
||||
func (p *statefulSetTester) update(ns, name string, update func(ps *apps.StatefulSet)) {
|
||||
for i := 0; i < 3; i++ {
|
||||
ps, err := p.c.Apps().PetSets(ns).Get(name)
|
||||
ps, err := p.c.Apps().StatefulSets(ns).Get(name)
|
||||
if err != nil {
|
||||
framework.Failf("failed to get petset %q: %v", name, err)
|
||||
framework.Failf("failed to get statefulset %q: %v", name, err)
|
||||
}
|
||||
update(ps)
|
||||
ps, err = p.c.Apps().PetSets(ns).Update(ps)
|
||||
ps, err = p.c.Apps().StatefulSets(ns).Update(ps)
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
if !apierrs.IsConflict(err) && !apierrs.IsServerTimeout(err) {
|
||||
framework.Failf("failed to update petset %q: %v", name, err)
|
||||
framework.Failf("failed to update statefulset %q: %v", name, err)
|
||||
}
|
||||
}
|
||||
framework.Failf("too many retries draining petset %q", name)
|
||||
framework.Failf("too many retries draining statefulset %q", name)
|
||||
}
|
||||
|
||||
func (p *petSetTester) getPodList(ps *apps.PetSet) *api.PodList {
|
||||
func (p *statefulSetTester) getPodList(ps *apps.StatefulSet) *api.PodList {
|
||||
selector, err := unversioned.LabelSelectorAsSelector(ps.Spec.Selector)
|
||||
ExpectNoError(err)
|
||||
podList, err := p.c.Core().Pods(ps.Namespace).List(api.ListOptions{LabelSelector: selector})
|
||||
@ -651,22 +651,22 @@ func (p *petSetTester) getPodList(ps *apps.PetSet) *api.PodList {
|
||||
return podList
|
||||
}
|
||||
|
||||
func (p *petSetTester) confirmPetCount(count int, ps *apps.PetSet, timeout time.Duration) {
|
||||
func (p *statefulSetTester) confirmPetCount(count int, ps *apps.StatefulSet, timeout time.Duration) {
|
||||
start := time.Now()
|
||||
deadline := start.Add(timeout)
|
||||
for t := time.Now(); t.Before(deadline); t = time.Now() {
|
||||
podList := p.getPodList(ps)
|
||||
petCount := len(podList.Items)
|
||||
if petCount != count {
|
||||
framework.Failf("PetSet %v scaled unexpectedly scaled to %d -> %d replicas: %+v", ps.Name, count, len(podList.Items), podList)
|
||||
framework.Failf("StatefulSet %v scaled unexpectedly scaled to %d -> %d replicas: %+v", ps.Name, count, len(podList.Items), podList)
|
||||
}
|
||||
framework.Logf("Verifying petset %v doesn't scale past %d for another %+v", ps.Name, count, deadline.Sub(t))
|
||||
framework.Logf("Verifying statefulset %v doesn't scale past %d for another %+v", ps.Name, count, deadline.Sub(t))
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *petSetTester) waitForRunning(numPets int32, ps *apps.PetSet) {
|
||||
pollErr := wait.PollImmediate(petsetPoll, petsetTimeout,
|
||||
func (p *statefulSetTester) waitForRunning(numPets int32, ps *apps.StatefulSet) {
|
||||
pollErr := wait.PollImmediate(statefulsetPoll, statefulsetTimeout,
|
||||
func() (bool, error) {
|
||||
podList := p.getPodList(ps)
|
||||
if int32(len(podList.Items)) < numPets {
|
||||
@ -692,7 +692,7 @@ func (p *petSetTester) waitForRunning(numPets int32, ps *apps.PetSet) {
|
||||
p.waitForStatus(ps, numPets)
|
||||
}
|
||||
|
||||
func (p *petSetTester) setHealthy(ps *apps.PetSet) {
|
||||
func (p *statefulSetTester) setHealthy(ps *apps.StatefulSet) {
|
||||
podList := p.getPodList(ps)
|
||||
markedHealthyPod := ""
|
||||
for _, pod := range podList.Items {
|
||||
@ -706,21 +706,21 @@ func (p *petSetTester) setHealthy(ps *apps.PetSet) {
|
||||
framework.Failf("Found multiple non-healthy pets: %v and %v", pod.Name, markedHealthyPod)
|
||||
}
|
||||
p, err := framework.UpdatePodWithRetries(p.c, pod.Namespace, pod.Name, func(up *api.Pod) {
|
||||
up.Annotations[petset.PetSetInitAnnotation] = "true"
|
||||
up.Annotations[petset.StatefulSetInitAnnotation] = "true"
|
||||
})
|
||||
ExpectNoError(err)
|
||||
framework.Logf("Set annotation %v to %v on pod %v", petset.PetSetInitAnnotation, p.Annotations[petset.PetSetInitAnnotation], pod.Name)
|
||||
framework.Logf("Set annotation %v to %v on pod %v", petset.StatefulSetInitAnnotation, p.Annotations[petset.StatefulSetInitAnnotation], pod.Name)
|
||||
markedHealthyPod = pod.Name
|
||||
}
|
||||
}
|
||||
|
||||
func (p *petSetTester) waitForStatus(ps *apps.PetSet, expectedReplicas int32) {
|
||||
framework.Logf("Waiting for petset status.replicas updated to %d", expectedReplicas)
|
||||
func (p *statefulSetTester) waitForStatus(ps *apps.StatefulSet, expectedReplicas int32) {
|
||||
framework.Logf("Waiting for statefulset status.replicas updated to %d", expectedReplicas)
|
||||
|
||||
ns, name := ps.Namespace, ps.Name
|
||||
pollErr := wait.PollImmediate(petsetPoll, petsetTimeout,
|
||||
pollErr := wait.PollImmediate(statefulsetPoll, statefulsetTimeout,
|
||||
func() (bool, error) {
|
||||
psGet, err := p.c.Apps().PetSets(ns).Get(name)
|
||||
psGet, err := p.c.Apps().StatefulSets(ns).Get(name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@ -735,30 +735,30 @@ func (p *petSetTester) waitForStatus(ps *apps.PetSet, expectedReplicas int32) {
|
||||
}
|
||||
}
|
||||
|
||||
func deleteAllPetSets(c clientset.Interface, ns string) {
|
||||
pst := &petSetTester{c: c}
|
||||
psList, err := c.Apps().PetSets(ns).List(api.ListOptions{LabelSelector: labels.Everything()})
|
||||
func deleteAllStatefulSets(c clientset.Interface, ns string) {
|
||||
pst := &statefulSetTester{c: c}
|
||||
psList, err := c.Apps().StatefulSets(ns).List(api.ListOptions{LabelSelector: labels.Everything()})
|
||||
ExpectNoError(err)
|
||||
|
||||
// Scale down each petset, then delete it completely.
|
||||
// Scale down each statefulset, then delete it completely.
|
||||
// Deleting a pvc without doing this will leak volumes, #25101.
|
||||
errList := []string{}
|
||||
for _, ps := range psList.Items {
|
||||
framework.Logf("Scaling petset %v to 0", ps.Name)
|
||||
framework.Logf("Scaling statefulset %v to 0", ps.Name)
|
||||
if err := pst.scale(&ps, 0); err != nil {
|
||||
errList = append(errList, fmt.Sprintf("%v", err))
|
||||
}
|
||||
pst.waitForStatus(&ps, 0)
|
||||
framework.Logf("Deleting petset %v", ps.Name)
|
||||
if err := c.Apps().PetSets(ps.Namespace).Delete(ps.Name, nil); err != nil {
|
||||
framework.Logf("Deleting statefulset %v", ps.Name)
|
||||
if err := c.Apps().StatefulSets(ps.Namespace).Delete(ps.Name, nil); err != nil {
|
||||
errList = append(errList, fmt.Sprintf("%v", err))
|
||||
}
|
||||
}
|
||||
|
||||
// pvs are global, so we need to wait for the exact ones bound to the petset pvcs.
|
||||
// pvs are global, so we need to wait for the exact ones bound to the statefulset pvcs.
|
||||
pvNames := sets.NewString()
|
||||
// TODO: Don't assume all pvcs in the ns belong to a petset
|
||||
pvcPollErr := wait.PollImmediate(petsetPoll, petsetTimeout, func() (bool, error) {
|
||||
// TODO: Don't assume all pvcs in the ns belong to a statefulset
|
||||
pvcPollErr := wait.PollImmediate(statefulsetPoll, statefulsetTimeout, func() (bool, error) {
|
||||
pvcList, err := c.Core().PersistentVolumeClaims(ns).List(api.ListOptions{LabelSelector: labels.Everything()})
|
||||
if err != nil {
|
||||
framework.Logf("WARNING: Failed to list pvcs, retrying %v", err)
|
||||
@ -778,7 +778,7 @@ func deleteAllPetSets(c clientset.Interface, ns string) {
|
||||
errList = append(errList, fmt.Sprintf("Timeout waiting for pvc deletion."))
|
||||
}
|
||||
|
||||
pollErr := wait.PollImmediate(petsetPoll, petsetTimeout, func() (bool, error) {
|
||||
pollErr := wait.PollImmediate(statefulsetPoll, statefulsetTimeout, func() (bool, error) {
|
||||
pvList, err := c.Core().PersistentVolumes().List(api.ListOptions{LabelSelector: labels.Everything()})
|
||||
if err != nil {
|
||||
framework.Logf("WARNING: Failed to list pvs, retrying %v", err)
|
||||
@ -793,7 +793,7 @@ func deleteAllPetSets(c clientset.Interface, ns string) {
|
||||
if len(waitingFor) == 0 {
|
||||
return true, nil
|
||||
}
|
||||
framework.Logf("Still waiting for pvs of petset to disappear:\n%v", strings.Join(waitingFor, "\n"))
|
||||
framework.Logf("Still waiting for pvs of statefulset to disappear:\n%v", strings.Join(waitingFor, "\n"))
|
||||
return false, nil
|
||||
})
|
||||
if pollErr != nil {
|
||||
@ -826,13 +826,13 @@ func pollReadWithTimeout(pet petTester, petNumber int, key, expectedVal string)
|
||||
}
|
||||
|
||||
func isInitialized(pod api.Pod) bool {
|
||||
initialized, ok := pod.Annotations[petset.PetSetInitAnnotation]
|
||||
initialized, ok := pod.Annotations[petset.StatefulSetInitAnnotation]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
inited, err := strconv.ParseBool(initialized)
|
||||
if err != nil {
|
||||
framework.Failf("Couldn't parse petset init annotations %v", initialized)
|
||||
framework.Failf("Couldn't parse statefulset init annotations %v", initialized)
|
||||
}
|
||||
return inited
|
||||
}
|
||||
@ -862,7 +862,7 @@ func newPVC(name string) api.PersistentVolumeClaim {
|
||||
}
|
||||
}
|
||||
|
||||
func newPetSet(name, ns, governingSvcName string, replicas int32, petMounts []api.VolumeMount, podMounts []api.VolumeMount, labels map[string]string) *apps.PetSet {
|
||||
func newStatefulSet(name, ns, governingSvcName string, replicas int32, petMounts []api.VolumeMount, podMounts []api.VolumeMount, labels map[string]string) *apps.StatefulSet {
|
||||
mounts := append(petMounts, podMounts...)
|
||||
claims := []api.PersistentVolumeClaim{}
|
||||
for _, m := range petMounts {
|
||||
@ -881,16 +881,16 @@ func newPetSet(name, ns, governingSvcName string, replicas int32, petMounts []ap
|
||||
})
|
||||
}
|
||||
|
||||
return &apps.PetSet{
|
||||
return &apps.StatefulSet{
|
||||
TypeMeta: unversioned.TypeMeta{
|
||||
Kind: "PetSet",
|
||||
Kind: "StatefulSet",
|
||||
APIVersion: "apps/v1beta1",
|
||||
},
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: ns,
|
||||
},
|
||||
Spec: apps.PetSetSpec{
|
||||
Spec: apps.StatefulSetSpec{
|
||||
Selector: &unversioned.LabelSelector{
|
||||
MatchLabels: labels,
|
||||
},
|
||||
|
@ -1,5 +1,5 @@
|
||||
apiVersion: apps/v1alpha1
|
||||
kind: PetSet
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: mysql
|
||||
spec:
|
||||
|
@ -1,5 +1,5 @@
|
||||
apiVersion: apps/v1alpha1
|
||||
kind: PetSet
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: rd
|
||||
spec:
|
||||
|
@ -1,5 +1,5 @@
|
||||
apiVersion: apps/v1alpha1
|
||||
kind: PetSet
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: zoo
|
||||
spec:
|
||||
|
@ -7,7 +7,7 @@ AppArmor when running with AppArmor should reject an unloaded profile,kargakis,1
|
||||
AppArmor when running without AppArmor should reject a pod with an AppArmor profile,vulpecula,1
|
||||
Cadvisor should be healthy on every node.,vishh,0
|
||||
Cassandra should create and scale cassandra,fabioy,1
|
||||
CassandraPetSet should create petset,erictune,1
|
||||
CassandraStatefulSet should create statefulset,alex-mohr,1
|
||||
Cluster level logging using Elasticsearch should check that logs from containers are ingested into Elasticsearch,crassirostris,0
|
||||
Cluster level logging using GCL should check that logs from containers are ingested in GCL,crassirostris,0
|
||||
Cluster size autoscaling should add node to the particular mig,spxtr,1
|
||||
@ -285,12 +285,7 @@ PersistentVolumes with multiple PVs and PVCs all in same ns should create 2 PVs
|
||||
PersistentVolumes with multiple PVs and PVCs all in same ns should create 3 PVs and 3 PVCs: test write access,ghodss,1
|
||||
PersistentVolumes with multiple PVs and PVCs all in same ns should create 4 PVs and 2 PVCs: test write access,andyzheng0831,1
|
||||
Pet Store should scale to persist a nominal number ( * ) of transactions in * seconds,xiang90,1
|
||||
Pet set recreate should recreate evicted petset,hurf,1
|
||||
PetSet Basic PetSet functionality should handle healthy pet restarts during scale,kevin-wangzefeng,1
|
||||
PetSet Basic PetSet functionality should provide basic identity,girishkalele,1
|
||||
PetSet Deploy clustered applications should creating a working mysql cluster,bprashanth,1
|
||||
PetSet Deploy clustered applications should creating a working redis cluster,mtaufen,1
|
||||
PetSet Deploy clustered applications should creating a working zookeeper cluster,rmmh,1
|
||||
Pet set recreate should recreate evicted statefulset,rmmh,1
|
||||
"Pod Disks Should schedule a pod w/ a RW PD, gracefully remove it, then schedule it on another host",saad-ali,0
|
||||
"Pod Disks Should schedule a pod w/ a readonly PD on two hosts, then remove both gracefully.",saad-ali,0
|
||||
"Pod Disks should schedule a pod w/ a RW PD shared between multiple containers, write to PD, delete pod, verify contents, and repeat in rapid succession",saad-ali,0
|
||||
@ -411,6 +406,11 @@ Services should work after restarting kube-proxy,bprashanth,0
|
||||
SimpleMount should be able to mount an emptydir on a container,jdef,1
|
||||
"Spark should start spark master, driver and workers",girishkalele,1
|
||||
"Staging client repo client should create pods, delete pods, watch pods",jbeda,1
|
||||
StatefulSet Basic StatefulSet functionality should handle healthy pet restarts during scale,brendandburns,1
|
||||
StatefulSet Basic StatefulSet functionality should provide basic identity,smarterclayton,1
|
||||
StatefulSet Deploy clustered applications should creating a working mysql cluster,girishkalele,1
|
||||
StatefulSet Deploy clustered applications should creating a working redis cluster,krousey,1
|
||||
StatefulSet Deploy clustered applications should creating a working zookeeper cluster,caesarxuchao,1
|
||||
"Storm should create and stop Zookeeper, Nimbus and Storm worker servers",mtaufen,1
|
||||
Summary API when querying /stats/summary should report resource usage through the stats api,apelisse,1
|
||||
"Sysctls should not launch unsafe, but not explicitly enabled sysctls on the node",madhusudancs,1
|
||||
|
|
Loading…
Reference in New Issue
Block a user