Skip to content

Instantly share code, notes, and snippets.

View bergerx's full-sized avatar
🙂

Bekir Dogan bergerx

🙂
View GitHub Profile
@bergerx
bergerx / gist:e8b20a2fbd3c47074bf5861b7e2fa598
Last active August 11, 2016 14:57
zip(*(iter(items),)*2)
items=[1,2,3,4]
items --> [1,2,3,4]
iter(items) --> <listiterator at 0x7f4d642273d0>
(iter(items) ) --> <listiterator at 0x7f4d64227690>
(iter(items), ) --> (<listiterator at 0x7f4d64227690>,)
(iter(items), ) * 2 --> (<listiterator at 0x7f4d64227590>, <listiterator at 0x7f4d64227590>)
zip(* (iter(items),)*2 ) --> zip(<listiterator at 0x7f4d64227590>, <listiterator at 0x7f4d64227590>)
@bergerx
bergerx / gist:6ecd9e7fb2cc6b5c5f26fede5397d7de
Last active December 2, 2016 13:37
DC/OS metrics system
1. cluster-level metrics and health (mesos-master, mesos-slave,
marathon, marathon-lb, mesos-dns, kafka ...)
Metrics for cluster components like mesos-master, mesos-slave,
frameworks (DC/OS services like zookeeper, marathon, marathon-lb,
mesos-dns, kafka,...).
These will be used to troubleshoot any problems at cluster-level.
Having each component's version as a metric label could help with
@bergerx
bergerx / README.md
Last active November 23, 2017 19:16
AWS tags as DC/OS agent attributes

We use this service to populate Agent attributes to DC/OS agent nodes during first boot.

This service populates the tags only during first boot and doesn't trigger changes afterwards, since Mesos Agent config change forces the agent to be re-bootstrapped.

@bergerx
bergerx / metrics-aggregate
Created February 10, 2018 23:04
sensu-plugins-sensu use-generic-metrics-classes
# removed some "Broken pipe" error messages for clarity, which are caused by "head; kill"
[dcos-infra]sensu-plugins-sensu: (master *+ u=) $ set -x; for i in json graphite statsd dogstatsd influxdb; do { head; kill "$$"; } < <(bundle exec bin/metrics-aggregate.rb --metric_format $i); done; set +x
+ for i in json graphite statsd dogstatsd influxdb
+ head
++ bundle exec bin/metrics-aggregate.rb --metric_format json
{"metric_name":"clients","value":4,"tags":{"check":"dcos.cluster-management.mesos.master","host":"Bekirs-MacBook-Pro-2.local"},"timestamp":1518300677}
{"metric_name":"checks","value":6,"tags":{"check":"dcos.cluster-management.mesos.master","host":"Bekirs-MacBook-Pro-2.local"},"timestamp":1518300677}
{"metric_name":"ok","value":2,"tags":{"check":"dcos.cluster-management.mesos.master","host":"Bekirs-MacBook-Pro-2.local"},"timestamp":1518300677}
{"metric_name":"warning","value":0,"tags":{"check":"dcos.cluster-management.mesos.master","host":"Bekirs-MacBook-Pro-2.local"},"timestamp":1518300677}
{"metric_n
@bergerx
bergerx / keybase.md
Created July 31, 2018 16:11
keybase.md

Keybase proof

I hereby claim:

  • I am bergerx on github.
  • I am bergerx (https://keybase.io/bergerx) on keybase.
  • I have a public key ASDOFqkSX0xxXCA1uPCCcSyaU-4aAQVdJoskMG0FPGGfCgo

To claim this, I am signing this object:

@bergerx
bergerx / kube-bench-on-aks-1.15.7-on-2020-01-20.txt
Last active January 20, 2020 21:54
kube-bench on AKS 1.15.7
kube-bench: (master u=) $ kubectl node-shell aks-cpuworkers-18754171-vmss000000
spawning "nsenter-kru76j" on "aks-cpuworkers-18754171-vmss000000"
If you don't see a command prompt, try pressing enter.
root@aks-cpuworkers-18754171-vmss000000:/#
root@aks-cpuworkers-18754171-vmss000000:/# docker run --rm -v `pwd`:/host aquasec/kube-bench:latest install
===============================================
kube-bench is now installed on your host
Run ./kube-bench to perform a security check
===============================================
root@aks-cpuworkers-18754171-vmss000000:/# ./kube-bench node
@bergerx
bergerx / release1.bash-session
Created November 4, 2020 22:16
Helmsman seems to be unintentionally running as it should be on chart renames https://github.com/Praqma/helmsman/issues/538
[cluster-bekir-test:]/tmp $ cat <<EOF > helmsman.yaml
> namespaces:
> default:
> apps:
> testing-helmsman:
> chart: testing-chart
> version: 0.1.0
> namespace: default
> enabled: true
> EOF
@bergerx
bergerx / aws-spot-price-2017-05-20.out
Last active January 9, 2021 20:56
aws spot instance cheapest core price finder
ap-southeast-1a d2.8xlarge ecpu:116 vcpu:36 monthly:85.3193883495 max:1090.728 price_count:824 --> 0.73551196853$/month/ecpu
us-east-2b c4.xlarge ecpu:16 vcpu:4 monthly:17.229996 max:19.008 price_count:1000 --> 1.07687475$/month/ecpu
us-east-2c c4.xlarge ecpu:16 vcpu:4 monthly:17.247312 max:18.72 price_count:1000 --> 1.077957$/month/ecpu
us-east-2c c4.large ecpu:8 vcpu:2 monthly:8.981424 max:10.656 price_count:1000 --> 1.122678$/month/ecpu
us-east-2a c4.xlarge ecpu:16 vcpu:4 monthly:18.167256 max:18.864 price_count:1000 --> 1.1354535$/month/ecpu
us-east-2b c4.2xlarge ecpu:31 vcpu:8 monthly:35.26795008 max:39.59136 price_count:1000 --> 1.13767580903$/month/ecpu
eu-west-2b c4.xlarge ecpu:16 vcpu:4 monthly:18.251064 max:27.864 price_count:1000 --> 1.1406915$/month/ecpu
us-east-2b c4.large ecpu:8 vcpu:2 monthly:9.128448 max:10.656 price_count:1000 --> 1.141056$/month/ecpu
us-east-2c c4.2xlarge ecpu:31 vcpu:8 monthly:35.5776192 max:40.176 price_count:1000 --> 1.14766513548$/month/ecpu
us-east-2a c4.large ecpu:8 vc
@bergerx
bergerx / README.md
Created November 23, 2017 18:59
mesos-graceful-shutdown for running DCOS nodes in ASG

Shut mesos down gracefully only when the node is shutting down but NOT rebooting.

A clean shutdown will cause the tasks that were scheduled on this node to be rescheduled to another node. Since a rebooting node will return to the cluster shortly, it's better to leave the rebooting node in an unhealthy state so that its tasks continue running on it when it rejoins the cluster.

This has particular importance when you manage your nodes in AWS autoscale groups. When scaling an ASG down you'll find stale agents around.

@bergerx
bergerx / README.md
Last active November 3, 2023 17:24
repeated TYPE decleration in kube-state-metrics
minikube start
kubectl apply -f crd-foo.example.com.yaml -f crd-bar.example.com.yaml 
kubectl apply -f cr-foo.yaml -f cr-bar.yaml
go run main.go --custom-resource-state-only --custom-resource-state-config-file custom-resource-config-file.yaml --kubeconfig ~/.kube/config