Drop PetSet support

Change-Id: I2547c925671ce411acf68a1e8a2020064aaf8608
This commit is contained in:
Andrey Pavlov 2016-11-10 16:04:35 +03:00
parent 95d2484ed4
commit 06a012c593
6 changed files with 8 additions and 56 deletions

View File

@ -85,8 +85,7 @@ service
+---------------+-----------------------------------------------+----------+------------------+------------+
| kind | Kind of k8s object to use for containers | false | one of: | Deployment |
| | deployment | | ["Deployment", | |
| | | | "Daemonset", | |
| | | | "PetSet"] | |
| | | | "DaemonSet"] | |
+---------------+-----------------------------------------------+----------+------------------+------------+
| containers | List of containers under multi-container pod | true | container_ array | |
+---------------+-----------------------------------------------+----------+------------------+------------+

View File

@ -1,4 +1,3 @@
import itertools
import logging
import os
import pkg_resources
@ -94,8 +93,7 @@ def get_deploy_components_info(rendering_context=None):
def get_deployed_components():
"""Returns set of deployed components."""
deployed_deployments = kubernetes.list_cluster_deployments()
deployed_petsets = kubernetes.list_cluster_petsets()
deployed_components = set(kubernetes.get_object_names(
itertools.chain(deployed_deployments, deployed_petsets))
deployed_components = set(
kubernetes.get_object_names(deployed_deployments)
)
return deployed_components

View File

@ -109,18 +109,11 @@ def parse_role(component, topology, configmaps):
raise RuntimeError("Replicas couldn't be specified for services "
"implemented using Kubernetes DaemonSet")
replicas = len(set(topology[service_name]))
obj = templates.serialize_deployment(service_name, cont_spec,
affinity, replicas,
component_name)
elif service.get("kind") == "PetSet":
replicas = replicas or 1
obj = templates.serialize_petset(service_name, cont_spec,
affinity, replicas, component_name)
else:
replicas = replicas or 1
obj = templates.serialize_deployment(service_name, cont_spec,
affinity, replicas,
component_name)
obj = templates.serialize_deployment(service_name, cont_spec,
affinity, replicas, component_name)
kubernetes.process_object(obj)
_process_ports(service)
@ -186,8 +179,7 @@ def _process_ports(service):
if ingress_host:
ingress_rules.append(templates.serialize_ingress_rule(
service["name"], ingress_host, source_port))
service_template = templates.serialize_service(
service["name"], ports, service.get("kind") == "PetSet")
service_template = templates.serialize_service(service["name"], ports)
kubernetes.process_object(service_template)
if ingress_rules:

View File

@ -151,13 +151,6 @@ def list_cluster_services():
selector="ccp=true")
def list_cluster_petsets():
client = get_client()
return pykube.PetSet.objects(client).filter(
namespace=CONF.kubernetes.namespace,
selector="ccp=true")
def get_object_names(items):
names = []
for item in items:

View File

@ -318,36 +318,6 @@ def serialize_deployment(name, spec, affinity, replicas, component_name):
}
def serialize_petset(name, spec, affinity, replicas, component_name):
annotations = {
"pod.alpha.kubernetes.io/initialized": "true"
}
annotations.update(affinity)
return {
"apiVersion": "apps/v1alpha1",
"kind": "PetSet",
"metadata": {
"name": name
},
"spec": {
"serviceName": name,
"replicas": replicas,
"template": {
"metadata": {
"annotations": annotations,
"labels": {
"ccp": "true",
"app": name,
"ccp-component": component_name
}
},
"spec": spec
}
}
}
def serialize_affinity(service, topology):
policy = {
"nodeAffinity": {

View File

@ -183,7 +183,7 @@ SERVICE_SCHEMA = {
}
},
"kind": {
"enum": ["Deployment", "DaemonSet", "PetSet"]
"enum": ["Deployment", "DaemonSet"]
},
"hostNetwork": {
"type": "boolean"