@@ -29,6 +29,13 @@ local consul = import 'consul/consul.libsonnet';
2929 local deployment = $.apps.v1.deployment,
3030 local podAntiAffinity = deployment.mixin.spec.template.spec.affinity.podAntiAffinity,
3131 local volume = $.core.v1.volume,
32+
33+ // backwards compatibility with ksonnet
34+ local podAffinityTerm =
35+ if std.objectHasAll ($.core.v1, 'podAffinityTerm' )
36+ then $.core.v1.podAffinityTerm
37+ else podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecutionType,
38+
3239 consul_deployment+:
3340
3441 // Keep the consul state on a ramdisk, as they are ephemeral to us.
@@ -41,10 +48,9 @@ local consul = import 'consul/consul.libsonnet';
4148 // Ensure Consul is not scheduled on the same host as an ingester
4249 // (in any namespace - hence other_namespaces).
4350 podAntiAffinity.withRequiredDuringSchedulingIgnoredDuringExecutionMixin([
44- podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecutionType.new() +
45- podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecutionType.mixin.labelSelector.withMatchLabels({ name: 'ingester' }) +
46- podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecutionType.withNamespaces([$._config.namespace] + $._config.other_namespaces) +
47- podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecutionType.withTopologyKey('kubernetes.io/hostname' ),
51+ podAffinityTerm.mixin.labelSelector.withMatchLabels({ name: 'ingester' }) +
52+ podAffinityTerm.withNamespaces([$._config.namespace] + $._config.other_namespaces) +
53+ podAffinityTerm.withTopologyKey('kubernetes.io/hostname' ),
4854 ]) +
4955
5056 $.util.podPriority('high' ),
0 commit comments