diff --git a/etcd-operator/etcd-cluster.libsonnet b/etcd-operator/etcd-cluster.libsonnet index e323efb1b..e5cbf5e52 100644 --- a/etcd-operator/etcd-cluster.libsonnet +++ b/etcd-operator/etcd-cluster.libsonnet @@ -1,5 +1,6 @@ { - local podAntiAffinity = $.apps.v1.deployment.mixin.spec.template.spec.affinity.podAntiAffinity, + local k = import 'ksonnet-util/kausal.libsonnet', + local podAntiAffinity = k.apps.v1.deployment.mixin.spec.template.spec.affinity.podAntiAffinity, etcd_cluster(name, size=3, version='3.3.13', env=[]):: { apiVersion: 'etcd.database.coreos.com/v1beta2', @@ -29,8 +30,8 @@ } + ( // Run etcd with the Burstable QoS class, and without a CPU limit // to avoid CFS throttling (best for low latency) - $.util.resourcesRequests('500m', '512Mi') + - $.util.resourcesLimits(null, '512Mi') + k.util.resourcesRequests('500m', '512Mi') + + k.util.resourcesLimits(null, '512Mi') ), }, }, diff --git a/etcd-operator/etcd-operator.libsonnet b/etcd-operator/etcd-operator.libsonnet index 102a63c37..514e7403e 100644 --- a/etcd-operator/etcd-operator.libsonnet +++ b/etcd-operator/etcd-operator.libsonnet @@ -1,3 +1,2 @@ -(import 'ksonnet-util/kausal.libsonnet') + (import 'operator.libsonnet') + (import 'etcd-cluster.libsonnet') diff --git a/etcd-operator/operator.libsonnet b/etcd-operator/operator.libsonnet index c00dae010..8d172a91b 100644 --- a/etcd-operator/operator.libsonnet +++ b/etcd-operator/operator.libsonnet @@ -3,10 +3,11 @@ operator: 'quay.io/coreos/etcd-operator:v0.9.4', }, - local policyRule = $.rbac.v1beta1.policyRule, + local k = import 'ksonnet-util/kausal.libsonnet', + local policyRule = k.rbac.v1beta1.policyRule, operator_rbac: - $.util.rbac('etcd-operator', [ + k.util.rbac('etcd-operator', [ policyRule.new() + policyRule.withApiGroups(['etcd.database.coreos.com']) + policyRule.withResources(['etcdclusters', 'etcdbackups', 'etcdrestores']) + @@ -28,7 +29,7 @@ policyRule.withVerbs(['*']), ]), - local container = $.core.v1.container, + local container = k.core.v1.container, local env = container.envType, operator_container:: container.new('operator', $._images.operator) + @@ -38,11 +39,11 @@ env.fromFieldPath('MY_POD_NAMESPACE', 'metadata.namespace'), env.fromFieldPath('MY_POD_NAME', 'metadata.name'), ]) + - container.withPorts([$.core.v1.containerPort.new('http-metrics', 8080)]) + - $.util.resourcesRequests('500m', '200Mi') + - $.util.resourcesLimits('1', '500Mi'), + container.withPorts([k.core.v1.containerPort.new('http-metrics', 8080)]) + + k.util.resourcesRequests('500m', '200Mi') + + k.util.resourcesLimits('1', '500Mi'), - local deployment = $.apps.v1.deployment, + local deployment = k.apps.v1.deployment, operator_deployment: deployment.new('etcd-operator', 1, [$.operator_container]) +