In the latter case, the field isn't changed in the resulting object in Kubernetes. Thus, if you have a deployment replica count managed by an HPA (or similar), you want to exclude that field.
When a deployment is first deployed and the field doesn't exist, it it set to 1 in the final object in k8s.
If the deployment already exists and the field doesn't exist in the manifest being reapplied, the field remains unchanged.
replicas: null is essentially equivalent to replicas: 1.
So there's no way, if using this library to easily remove the replicas field in order to get the desired behavior of having that field managed externally.
https://github.com/bitnami-labs/kube-libsonnet/blob/master/kube.libsonnet#L448
Since it's not easy to remove fields from a jsonnet obj (https://github.com/google/jsonnet/issues/312), and there's different behavior between:
and when the
replicas
field is missing.In the latter case, the field isn't changed in the resulting object in Kubernetes. Thus, if you have a deployment replica count managed by an HPA (or similar), you want to exclude that field.
When a deployment is first deployed and the field doesn't exist, it it set to 1 in the final object in k8s. If the deployment already exists and the field doesn't exist in the manifest being reapplied, the field remains unchanged.
replicas: null
is essentially equivalent toreplicas: 1
.So there's no way, if using this library to easily remove the
replicas
field in order to get the desired behavior of having that field managed externally.