Skip to content

Instantly share code, notes, and snippets.

View isutton's full-sized avatar

Igor Sutton isutton

  • Lemonade
  • Amsterdam
View GitHub Profile

Acceptance Tests Locally on Fedora 34

The following procedure has been identified to consistently work.

Installing minikube

The first piece of the puzzle is minikube, which the latest version can be installed using the following commands:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
@isutton
isutton / configMapScopedAnnotations.feature
Last active September 23, 2020 13:40
Binding annotations feature
Feature: ConfigMap Scoped Annotations
Scenario: Copy a single key from a ConfigMap related to the Service resource to the binding secret
Given CRD "databases.postgresql.baiju.dev" contains the annotation "service.binding/certificate: path={.status.data.dbConfiguration},objectType=ConfigMap,sourceKey=certificate"
And Resource "cmsa-1-configmap" is created
"""
apiVersion: v1
kind: ConfigMap
metadata:
name: cmsa-1-configmap
data:
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
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 {
@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",
@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 / 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
#-------------------------------------------------------------------------------------------------------------
# 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}
package main
import (
"bytes"
"testing"
"text/template"
"github.com/stretchr/testify/require"
)