Skip to content

Instantly share code, notes, and snippets.

View isutton's full-sized avatar

Igor Sutton isutton

  • Lemonade
  • Amsterdam
View GitHub Profile
apiVersion: shipper.booking.com/v1alpha1
kind: CapacityTarget
metadata:
creationTimestamp: 2019-02-12T15:43:39Z
generation: 1
labels:
shipper-app: reviews-api
shipper-release: reviews-api-fba08f42-0
shipper-release-hash: fba08f42
@isutton
isutton / example.go
Last active August 29, 2019 13:44
Watch from Mapper example
type CRDToWatchMapper {
c *Controller
}
func (m *CRDToWatchMapper) Map(obj handler.MapObject) []reconcile.Request {
crdGvk := extractGVKFromCRD(obj.Object)
m.c.Watch(
createSourceForGVK(crdGvk),
&handler.EnqueueRequestsFromMapFunc{ToRequests: &SBRRequestMapper{}},
)
package main
import (
"bytes"
"testing"
"text/template"
"github.com/stretchr/testify/require"
)
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
# Update the VARIANT arg in devcontainer.json to pick a Python version: 3, 3.8, 3.7, 3.6
# To fully customize the contents of this image, use the following Dockerfile instead:
# https://github.com/microsoft/vscode-dev-containers/tree/v0.112.0/containers/python-3/.devcontainer/base.Dockerfile
ARG VARIANT="3"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
@isutton
isutton / docker-compose.yaml
Last active May 26, 2020 13:02
nginx docker-compose.yaml example
nginx:
image: nginx
restart: always
ports:
- "80:80"
networks:
- host
@isutton
isutton / annotations.go
Created June 15, 2020 15:35
New annotation handling
package annotations
import (
"fmt"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
)
@isutton
isutton / launch.json
Created July 1, 2020 13:50
Service Binding Operator launch settings for VS Code
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"compounds": [
{
"name": "Operator/E2e",
"configurations": [
"Operator",
diff --git a/test/e2e/servicebindingrequest_test.go b/test/e2e/servicebindingrequest_test.go
index d73cc88b..dc8f345e 100644
--- a/test/e2e/servicebindingrequest_test.go
+++ b/test/e2e/servicebindingrequest_test.go
@@ -257,7 +257,7 @@ func updateSBRSecret(
t *testing.T,
f *framework.Framework,
namespacedName types.NamespacedName,
-) {
+) error {
func loadDescriptor(anns map[string]string, path string, descriptor string, root string) {
if !strings.HasPrefix(descriptor, "binding:") {
return
}
n := annotations.ServiceBindingOperatorAnnotationPrefix + root + "." + path
v := strings.Split(descriptor, ":")
if descriptor == "binding:env:attribute" {
// treat here