Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@jmillikin-stripe @dilyevsky
48 lines (40 sloc) 1.25 KB
# Copyright 2018 The Skycfg 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.
#
# SPDX-License-Identifier: Apache-2.0
appsv1 = proto.package("k8s.io.api.apps.v1")
corev1 = proto.package("k8s.io.api.core.v1")
metav1 = proto.package("k8s.io.apimachinery.pkg.apis.meta.v1")
def container(name):
return corev1.Container(
name = name,
image = name + ":latest",
ports = [
corev1.ContainerPort(containerPort = 80)
],
)
def deployment(name):
d = appsv1.Deployment()
d.metadata.name = name
spec = d.spec
spec.selector = metav1.LabelSelector(
matchLabels = {"app": name},
)
spec.replicas = 1
tmpl = spec.template
tmpl.metadata.labels = {"app": name}
tmpl.spec.containers = [
container(name),
]
return d
You can’t perform that action at this time.