Remove ksonnet from prometheus-pvc.jsonnet

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
This commit is contained in:
Kemal Akkoyun
2020-11-06 14:14:59 +01:00
parent 6d641706de
commit c236fec779
2 changed files with 20 additions and 41 deletions

View File

@@ -1,10 +1,3 @@
// Reference info: documentation for https://github.com/ksonnet/ksonnet-lib can be found at http://g.bryan.dev.hepti.center
//
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; // https://github.com/ksonnet/ksonnet-lib/blob/master/ksonnet.beta.3/k.libsonnet - imports k8s.libsonnet
// * https://github.com/ksonnet/ksonnet-lib/blob/master/ksonnet.beta.3/k8s.libsonnet defines things such as "persistentVolumeClaim:: {"
//
local pvc = k.core.v1.persistentVolumeClaim; // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#persistentvolumeclaim-v1-core (defines variable named 'spec' of type 'PersistentVolumeClaimSpec')
local kp = local kp =
(import 'kube-prometheus/kube-prometheus.libsonnet') + (import 'kube-prometheus/kube-prometheus.libsonnet') +
// Uncomment the following imports to enable its patches // Uncomment the following imports to enable its patches
@@ -32,22 +25,22 @@ local kp =
// * PersistentVolumeClaim (and a corresponding PersistentVolume) // * PersistentVolumeClaim (and a corresponding PersistentVolume)
// * the actual volume (per the StorageClassName specified below) // * the actual volume (per the StorageClassName specified below)
storage: { // https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#storagespec storage: { // https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#storagespec
volumeClaimTemplate: // (same link as above where the 'pvc' variable is defined) volumeClaimTemplate: { // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#persistentvolumeclaim-v1-core (defines variable named 'spec' of type 'PersistentVolumeClaimSpec')
pvc.new() + // http://g.bryan.dev.hepti.center/core/v1/persistentVolumeClaim/#core.v1.persistentVolumeClaim.new apiVersion: 'v1',
kind: 'PersistentVolumeClaim',
pvc.mixin.spec.withAccessModes('ReadWriteOnce') + spec: {
accessModes: ['ReadWriteOnce'],
// https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#resourcerequirements-v1-core (defines 'requests'), // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#resourcerequirements-v1-core (defines 'requests'),
// and https://kubernetes.io/docs/concepts/policy/resource-quotas/#storage-resource-quota (defines 'requests.storage') // and https://kubernetes.io/docs/concepts/policy/resource-quotas/#storage-resource-quota (defines 'requests.storage')
pvc.mixin.spec.resources.withRequests({ storage: '100Gi' }) + resources: { requests: { storage: '100Gi' } },
// A StorageClass of the following name (which can be seen via `kubectl get storageclass` from a node in the given K8s cluster) must exist prior to kube-prometheus being deployed.
// A StorageClass of the following name (which can be seen via `kubectl get storageclass` from a node in the given K8s cluster) must exist prior to kube-prometheus being deployed. storageClassName: 'ssd',
pvc.mixin.spec.withStorageClassName('ssd'), // The following 'selector' is only needed if you're using manual storage provisioning (https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/storage.md#manual-storage-provisioning).
// And note that this is not supported/allowed by AWS - uncommenting the following 'selector' line (when deploying kube-prometheus to a K8s cluster in AWS) will cause the pvc to be stuck in the Pending status and have the following error:
// The following 'selector' is only needed if you're using manual storage provisioning (https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/storage.md#manual-storage-provisioning). // * 'Failed to provision volume with StorageClass "ssd": claim.Spec.Selector is not supported for dynamic provisioning on AWS'
// And note that this is not supported/allowed by AWS - uncommenting the following 'selector' line (when deploying kube-prometheus to a K8s cluster in AWS) will cause the pvc to be stuck in the Pending status and have the following error: // selector: { matchLabels: {} },
// * 'Failed to provision volume with StorageClass "ssd": claim.Spec.Selector is not supported for dynamic provisioning on AWS' },
//pvc.mixin.spec.selector.withMatchLabels({}), },
}, // storage }, // storage
}, // spec }, // spec
}, // prometheus }, // prometheus

View File

@@ -1,7 +1,3 @@
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
local statefulSet = k.apps.v1beta2.statefulSet;
local toleration = statefulSet.mixin.spec.template.spec.tolerationsType;
{ {
_config+:: { _config+:: {
tolerations+:: [ tolerations+:: [
@@ -15,24 +11,14 @@ local toleration = statefulSet.mixin.spec.template.spec.tolerationsType;
key: 'key2', key: 'key2',
operator: 'Exists', operator: 'Exists',
}, },
]
},
local withTolerations() = {
tolerations: [
toleration.new() + (
if std.objectHas(t, 'key') then toleration.withKey(t.key) else toleration) + (
if std.objectHas(t, 'operator') then toleration.withOperator(t.operator) else toleration) + (
if std.objectHas(t, 'value') then toleration.withValue(t.value) else toleration) + (
if std.objectHas(t, 'effect') then toleration.withEffect(t.effect) else toleration),
for t in $._config.tolerations
], ],
}, },
prometheus+: { prometheus+: {
prometheus+: { prometheus+: {
spec+: spec+: {
withTolerations(), tolerations: [t for t in $._config.tolerations],
},
}, },
}, },
} }