Skip to content

Instantly share code, notes, and snippets.

@negz
negz / refactor.go
Created August 25, 2023 22:27
Inline Crossplane error constants
package main
import (
"bytes"
"flag"
"fmt"
"io/fs"
"log"
"os"
"path/filepath"
@negz
negz / fnio.yaml
Created October 5, 2022 03:56
Crossplane Composition Functions IO
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: FunctionIO
# Optional arbitrary KRM-like resource. Each function in a pipeline will be
# called with its own function config (i.e. config is not pipelined).
config:
apiVersion: database.example.org/v1alpha1
kind: Config
metadata:
name: cloudsql
spec:
@negz
negz / composition.yaml
Created August 12, 2021 05:32
Hunting for RouteTable leaks
---
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: leaktest
spec:
writeConnectionSecretsToNamespace: crossplane-system
compositeTypeRef:
apiVersion: crossplane.io/v1alpha1
kind: LeakTest
@negz
negz / conformance.log
Created May 5, 2021 00:27
Crossplane v1.2.1 conformance
00:11:48 [ .. ] verify dependencies have expected content
all modules verified
00:11:50 [ OK ] go modules dependencies verified
00:11:50 [ .. ] go test unit-tests
? github.com/crossplane/conformance/internal [no test files]
=== RUN TestCompositeResourceDefinition
apiextensions_test.go:62: Created XRD "clusterconformances.test.crossplane.io"
=== RUN TestCompositeResourceDefinition/BecomesEstablishedAndOffered
=== PAUSE TestCompositeResourceDefinition/BecomesEstablishedAndOffered
=== RUN TestCompositeResourceDefinition/CRDIsCreatedForXR
@negz
negz / transform.yaml
Last active January 23, 2021 01:35
String transform
- base:
apiVersion: identity.aws.crossplane.io/v1alpha1
kind: IAMPolicy
spec:
forProvider:
description: "policy to access dynamodb table."
patches:
- type: PatchSet
patchSetName: Metadata
- fromFieldPath: "metadata.name"
@negz
negz / defcomp.yaml
Last active June 26, 2020 09:16
A hypothetical Helm release managed resource
---
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: InfrastructureDefinition
metadata:
name: wordpressinstances.apps.example.org
spec:
crdSpecTemplate:
group: apps.example.org
version: v1alpha1
names:
@negz
negz / tfschema.json
Created June 9, 2020 23:23
Terraform AWS Schema
This file has been truncated, but you can view the full file.
{
"format_version": "0.1",
"provider_schemas": {
"aws": {
"provider": {
"version": 0,
"block": {
"attributes": {
"access_key": {
"type": "string",
@negz
negz / testwithsetupandteardown.go
Last active April 27, 2020 22:06
Common setup code in Go tests
func TestDoTheThing(t *testing.T) {
cases := map[string]struct{
thingArg string
want bool
}{
// Add test cases here.
}
SetupTheThing()
@negz
negz / rg.yaml
Created April 22, 2020 22:53
An example ReplicationGroup
---
apiVersion: cache.aws.crossplane.io/v1beta1
kind: ReplicationGroup
metadata:
name: aws-redis
labels:
example: "true"
spec:
writeConnectionSecretToRef:
namespace: crossplane-system
@negz
negz / one-to-many.yaml
Last active March 21, 2021 17:06
Modelling a simple Wordpress application
# In this YAML an ApplicationDefinition defines the schema of a
# Wordpress, while a Composition specifies what resources the
# Wordpress will be composed of, and how they'll be created.
---
apiVersion: crossplane.io/v1alpha1
kind: ApplicationDefinition
metadata:
name: wordpresses.apps.example.org
spec:
crdSpecTemplate: