Skip to content

Instantly share code, notes, and snippets.

Aslak Knutsen aslakknutsen

View GitHub Profile
@aslakknutsen
aslakknutsen / vs_test.go
Last active Mar 6, 2019
istio API duplication on DeepCopy
View vs_test.go
import (
"testing"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
v1alpha3 "istio.io/api/networking/v1alpha3"
istionetwork "istio.io/api/pkg/kube/apis/networking/v1alpha3"
)
View deployment_test.go
var objects []runtime.Object
var ctx model.SessionContext
BeforeEach(func() {
ctx = model.SessionContext{
Context: context.TODO(),
Name: "test",
Namespace: "test",
Log: logf.Log.WithName("test"),
Client: fake.NewFakeClient(objects...),
}
View deployment_test.go
var objects []runtime.Object
var ctx model.SessionContext
BeforeEach(func() {
ctx = model.SessionContext{
Context: context.TODO(),
Name: "test",
Namespace: "test",
Log: logf.Log.WithName("test"),
Client: fake.NewFakeClient(objects...),
}
View test.md

Start up with user having a running Server:

time="2018-09-11T18:26:25+02:00" level=info msg="UserIdler created." component=user-idler id=xxxxxx-a31f-471c-a3e7-9402c086d1be username=xxxxxxx 
time="2018-09-11T18:26:25+02:00" level=info msg="UserIdler started." checkIdle=5m component=user-idler id=xxxxxx-a31f-471c-a3e7-9402c086d1be maxRetriesQuietInterval=5m username=xxxxxxx 
time="2018-09-11T18:26:25+02:00" level=info msg="Will send user xxxxxxx to idler due to done build" 
time="2018-09-11T18:26:25+02:00" level=info msg="Sending user xxxxxxx to idler from a Build event" 
time="2018-09-11T18:26:26+02:00" level=info msg="Will send user xxxxxxx to idler due to a new version of DC or an existing version is coming up" 
time="2018-09-11T18:26:26+02:00" level=info msg="Sending user xxxxxxx to idler from a Deployment Config event" 
time="2018-09-11T18:26:26+02:00" level=info msg="About to idle jenkins, Reason: DoneBuild BuildName:cuckoo-1 Last:2018-07-20 05:05:22 +0000 UTC" attempt="(1/5)" component=user-idler id
@aslakknutsen
aslakknutsen / 1.adoc
Last active Mar 21, 2018
OSiO: Incident Report
View 1.adoc

The incident report is intended as a write up for transparency, cross-team knowledge transfer and to get in the habit of thinking in terms of continues improvement.

An Incident report should be created for each OSiO outage(small or large) in GitHub with label "type/incident": https://github.com/openshiftio/openshift.io/issues

Note: this is a public report so de sensitise data. No tokens, no users, no internal links etc

@aslakknutsen
aslakknutsen / generator_test.go
Last active Jan 24, 2018
WIT API Generator (requires pre setup of iterations, randomly distributes across iterations and states)
View generator_test.go
package wit
import (
"context"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
"testing"
@aslakknutsen
aslakknutsen / cache.go
Created Oct 27, 2017
Multi level locked cache with Promise, single resovler
View cache.go
package middlewares
import (
"sync"
)
type Cache struct {
mux sync.Mutex
m map[string]Promise
}
@aslakknutsen
aslakknutsen / design.go
Last active Sep 28, 2017
JSON API ResourceObject GOA
View design.go
// Definition
/*
func test() {
account := app.AccountSingle{}
account.Data.ID
account.Data.Type
account.Data.Attributes.Name
account.Data.Relationships.OwnedBy
account.Data.Relationships.OwnedBy.Meta
account.Data.Relationships.OwnedBy.Related
View tst.go
db := requires.Resource(t, Database)
space, wis := requires.Objects(t, Space(1), WorkItems(3, ExtraLongTitle()))
func ExtraLongTitle()  {
return func(wi *WorkItem) {
wi.Data.Attributes["system.title"] = ".. long thing.."
}
}
View workitem.create.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>New Work Item Created</title>
</head>
You can’t perform that action at this time.