Skip to content

Instantly share code, notes, and snippets.

View cezarsa's full-sized avatar

Cezar Sá Espinola cezarsa

  • Brasília - DF / Brazil
  • 20:23 (UTC -03:00)
View GitHub Profile
ticker := time.NewTicker(time.Minute)
defer ticker.Stop()
for {
select {
case <-ticker.C:
// poll the image build status
case evt := <-webhookRequest:
ticker.Reset(time.Minute)
// update the image build status with evt
case <-time.After(30*time.Minute):
func BenchmarkClusterIP(b *testing.B) {
nSvcs := 1000
endpointsPerSvc := 2
var allSvcs []*v1.Service
var allEndpoints []*v1.Endpoints
for i := 0; i < nSvcs; i++ {
allSvcs = append(allSvcs, makeTestService("ns1", fmt.Sprintf("svc-%d", i), func(svc *v1.Service) {
ip := net.ParseIP("10.0.0.0").To4()
ip[2] = byte(uint32(i+1) >> 8 & 0xff)
ip[3] = byte(uint32(i+1) & 0xff)
#!/bin/bash
set -eo pipefail
TSURU_TARGET=${TSURU_TARGET:-https://tsuru.globoi.com}
TSURU_TOKEN=${TSURU_TOKEN:-$(cat ~/.tsuru/token)}
target=$(sed "s|/$||g" <<<$TSURU_TARGET)
clusters="$(curl -fsS -H"Authorization: bearer ${TSURU_TOKEN}" ${target}/provisioner/clusters)"
$ TF_LOG=trace terraform plan
2019/08/19 18:46:11 [INFO] Terraform version: 0.12.6
2019/08/19 18:46:11 [INFO] Go runtime version: go1.12.7
2019/08/19 18:46:11 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"}
2019/08/19 18:46:11 [DEBUG] Attempting to open CLI config file: /Users/cezarsa/.terraformrc
2019/08/19 18:46:11 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/08/19 18:46:11 [INFO] CLI command args: []string{"plan"}
2019/08/19 18:46:11 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/08/19 18:46:11 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/08/19 18:46:11 [DEBUG] New state was assigned lineage "f206e877-0e66-9514-49b4-031d2e56c320"
import os
from datetime import datetime, timedelta
import slack
import holidays
SLACK_TOKEN = os.environ.get('SLACK_TOKEN')
SLACK_USER = os.environ.get('SLACK_USER')
from_date = datetime.strptime('2019-01-01', '%Y-%m-%d')
to_date = datetime.strptime('2019-06-18', '%Y-%m-%d')
package main
import (
"context"
"fmt"
"github.com/tsuru/rpaas-operator/pkg/apis"
"github.com/tsuru/rpaas-operator/pkg/apis/extensions/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
#!/bin/bash
trap 'echo "Done user data script."' EXIT
echo "Running user data script..."
sleep 30
diff --git a/provision/kubernetes/deploy.go b/provision/kubernetes/deploy.go
index 587eac2e0..f729c2682 100644
--- a/provision/kubernetes/deploy.go
+++ b/provision/kubernetes/deploy.go
@@ -455,8 +455,12 @@ func monitorDeployment(client *clusterClient, dep *v1beta1.Deployment, a provisi
fmt.Fprintf(w, " ---> %d of %d new units created\n", dep.Status.UpdatedReplicas, specReplicas)
}
if healthcheckTimeout == nil && dep.Status.UpdatedReplicas == specReplicas {
- healthcheckTimeout = time.After(maxWaitTimeDuration)
- fmt.Fprintf(w, " ---> waiting healthcheck on %d created units\n", specReplicas)
func (s *S) TestRoundTripSNI(c *check.C) {
var receivedReq *http.Request
ts := httptest.NewTLSServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
receivedReq = req
rw.Header().Set("X-Some-Rsp-Header", "rspvalue")
rw.WriteHeader(200)
rw.Write([]byte("my result"))
}))
defer ts.Close()
router := &recoderRouter{dst: ts.URL}
diff --git a/provision/swarm/docker.go b/provision/swarm/docker.go
index 8d7b4eb..64b4bcf 100644
--- a/provision/swarm/docker.go
+++ b/provision/swarm/docker.go
@@ -601,7 +601,7 @@ func serviceSpecForNodeContainer(name, pool string) (*swarm.ServiceSpec, error)
return service, nil
}
-func upsertService(spec *swarm.ServiceSpec, client *docker.Client) (error, bool) {
+func upsertService(spec *swarm.ServiceSpec, client *docker.Client, placementOnly bool) (error, bool) {