Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Influxdb migrated to PetSet and PersistentVolumes. #28109

Merged
merged 1 commit into from
Jun 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cluster/addons/cluster-monitoring/influxdb/influxdb-claim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: influxdb-claim
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwielgus do you think this value is reasonable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe :)

volumeName: influxdb-pv

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1alpha1
kind: PetSet
metadata:
name: monitoring-influxdb-grafana-v3
namespace: kube-system
Expand All @@ -9,9 +9,6 @@ metadata:
kubernetes.io/cluster-service: "true"
spec:
replicas: 1
selector:
k8s-app: influxGrafana
version: v3
template:
metadata:
labels:
Expand Down Expand Up @@ -68,7 +65,8 @@ spec:
mountPath: /var
volumes:
- name: influxdb-persistent-storage
emptyDir: {}
persistentVolumeClaim:
claimName: influxdb-claim
- name: grafana-persistent-storage
emptyDir: {}

serviceName: monitoring-influxdb
20 changes: 20 additions & 0 deletions cluster/addons/cluster-monitoring/influxdb/influxdb-pv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% set pd_prefix = pillar.get('master_name', '') -%}
{% set pd_name = pd_prefix + '-influxdb-pd') -%}

kind: PersistentVolume
apiVersion: v1
metadata:
name: influxdb-pv
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
- ReadOnlyMany
gcePersistentDisk:
pdName: {{ pd_name }}
fsType: ext4
persistentVolumeReclaimPolicy: Delete
1 change: 1 addition & 0 deletions cluster/gce/configure-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ network_policy_provider: '$(echo "$NETWORK_POLICY_PROVIDER" | sed -e "s/'/''/g")
enable_manifest_url: '$(echo "${ENABLE_MANIFEST_URL:-}" | sed -e "s/'/''/g")'
manifest_url: '$(echo "${MANIFEST_URL:-}" | sed -e "s/'/''/g")'
manifest_url_header: '$(echo "${MANIFEST_URL_HEADER:-}" | sed -e "s/'/''/g")'
master_name: '$(echo "${MASTER_NAME:-}" | sed -e "s/'/''/g")'
num_nodes: $(echo "${NUM_NODES:-}" | sed -e "s/'/''/g")
e2e_storage_test_environment: '$(echo "$E2E_STORAGE_TEST_ENVIRONMENT" | sed -e "s/'/''/g")'
kube_uid: '$(echo "${KUBE_UID}" | sed -e "s/'/''/g")'
Expand Down

This file was deleted.

6 changes: 6 additions & 0 deletions cluster/gce/gci/configure-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,12 @@ function start-kube-addons {
sed -i -e "s@{{ *nanny_memory *}}@${nanny_memory}@g" "${controller_yaml}"
sed -i -e "s@{{ *metrics_cpu_per_node *}}@${metrics_cpu_per_node}@g" "${controller_yaml}"
fi
if [[ "${ENABLE_CLUSTER_MONITORING:-}" == "influxdb" ]]; then
pv_yaml="${dst_dir}/${file_dir}/influxdb-pv.yaml"
pd_name="${INSTANCE_PREFIX}-influxdb-pd"
remove-salt-config-comments "${pv_yaml}"
sed -i -e "s@{{ *pd_name *}}@${pd_name}@g" "${pv_yaml}"
fi
if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then
setup-addon-manifests "addons" "dns"
local -r dns_rc_file="${dst_dir}/dns/skydns-rc.yaml"
Expand Down
22 changes: 22 additions & 0 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,14 @@ function create-master() {
--size "${CLUSTER_REGISTRY_DISK_SIZE}" &
fi

# Create disk for influxdb if enabled
if [[ "${ENABLE_CLUSTER_MONITORING:-}" == "influxdb" ]]; then
gcloud compute disks create "${INSTANCE_PREFIX}-influxdb-pd" \
--project "${PROJECT}" \
--zone "${ZONE}" \
--size "10GiB" &
fi

# Generate a bearer token for this cluster. We push this separately
# from the other cluster variables so that the client (this
# computer) can forget it later. This should disappear with
Expand Down Expand Up @@ -1076,6 +1084,15 @@ function kube-down {
"${MASTER_NAME}-ip"
fi

# Delete persistent disk for influx-db.
if gcloud compute disks describe "${INSTANCE_PREFIX}"-influxdb-pd --zone "${ZONE}" --project "${PROJECT}" &>/dev/null; then
gcloud compute disks delete \
--project "${PROJECT}" \
--quiet \
--zone "${ZONE}" \
"${INSTANCE_PREFIX}"-influxdb-pd
fi

export CONTEXT="${PROJECT}_${INSTANCE_PREFIX}"
clear-kubeconfig
set -e
Expand Down Expand Up @@ -1132,6 +1149,11 @@ function check-resources {
return 1
fi

if gcloud compute disks describe --project "${PROJECT}" "${INSTANCE_PREFIX}-influxdb-pd" --zone "${ZONE}" &>/dev/null; then
KUBE_RESOURCE_FOUND="Persistent disk ${INSTANCE_PREFIX}-influxdb-pd"
return 1
fi

# Find out what minions are running.
local -a minions
minions=( $(gcloud compute instances list \
Expand Down
2 changes: 1 addition & 1 deletion cluster/saltbase/salt/kube-addons/kube-addon-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
hostNetwork: true
containers:
- name: kube-addon-manager
image: gcr.io/google-containers/kube-addon-manager:v4
image: gcr.io/google-containers/kube-addon-manager:v5
resources:
requests:
cpu: 5m
Expand Down
21 changes: 20 additions & 1 deletion test/e2e/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ func verifyExpectedRcsExistAndGetExpectedPods(c *client.Client) ([]string, error
if err != nil {
return nil, err
}
if (len(rcList.Items) + len(deploymentList.Items)) != 1 {
psList, err := c.Apps().PetSets(api.NamespaceSystem).List(options)
if err != nil {
return nil, err
}
if (len(rcList.Items) + len(deploymentList.Items) + len(psList.Items)) != 1 {
return nil, fmt.Errorf("expected to find one replica for RC or deployment with label %s but got %d",
rcLabel, len(rcList.Items))
}
Expand Down Expand Up @@ -144,6 +148,21 @@ func verifyExpectedRcsExistAndGetExpectedPods(c *client.Client) ([]string, error
expectedPods = append(expectedPods, string(pod.UID))
}
}
// And for pet sets.
for _, ps := range psList.Items {
selector := labels.Set(ps.Spec.Selector.MatchLabels).AsSelector()
options := api.ListOptions{LabelSelector: selector}
podList, err := c.Pods(api.NamespaceSystem).List(options)
if err != nil {
return nil, err
}
for _, pod := range podList.Items {
if pod.DeletionTimestamp != nil {
continue
}
expectedPods = append(expectedPods, string(pod.UID))
}
}
}
return expectedPods, nil
}
Expand Down