Skip to content

Instantly share code, notes, and snippets.

import regex
oxr = option("params").oxr
_ocds = option("params").ocds
_dxr = option("params").dxr
dcds = option("params").dcds
_metadata = lambda name: str -> any {
{ annotations = { "krm.kcl.dev/composition-resource-name" = name }}
}
"""
This file was generated by the KCL auto-gen tool. DO NOT EDIT.
Editing this file might prove futile when you re-run the KCL auto-gen generate command.
"""
import k8s.apimachinery.pkg.apis.meta.v1
schema Cluster:
r"""
Cluster is the Schema for the Clusters API. Manages an EKS Cluster
@haarchri
haarchri / overview.md
Created September 11, 2024 17:30
this shows kcl, go-template and p&t

function-kcl

inline

  pipeline:
  - functionRef:
      name: crossplane-contrib-function-kcl
    input:
      apiVersion: template.fn.crossplane.io/v1beta1
      kind: KCLInput
#!/bin/bash
set -e
if [ ! -z "$DEBUG" ] ; then
set -x
fi
REGIONS="us-east-2
us-east-1
@haarchri
haarchri / certs.sh
Last active April 28, 2024 08:46
crossplane-debug-vscode
#!/bin/bash
NAMESPACE=crossplane-system
# Define secret names
@haarchri
haarchri / gist:e845a2213618f12e663915da53110839
Last active December 5, 2023 22:00
go-function-conditional-keys
- step: addon-keyvault-secrets-provider
functionRef:
name: crossplane-contrib-function-go-templating
input:
apiVersion: gotemplating.fn.crossplane.io/v1beta1
kind: GoTemplate
source: Inline
inline:
template: |
{{ if and (ne $.observed.resources nil) }}
apiVersion: v1
items:
- apiVersion: ec2.aws.upbound.io/v1beta1
kind: SecurityGroup
metadata:
name: my-db-b9t8p-scfnc
spec:
forProvider:
description: Allow access to PostgreSQL
name: uxp-getting-started
## get all managed resources
kubectl get managed -l crossplane.io/claim-name=test123 -o yaml >> export.yaml
## use only .items[]
cat export.yaml | yq e -P '.items' >> temp.yaml
## create individual files
yq '.[]' temp.yaml -s '"backup_" + .kind +"_"+ .metadata.name'
## add paused annotation
for file in backup* ; do yq eval '.metadata.annotations += {"crossplane.io/paused": "true"}' -i "$file"; done
## apply all files
kubectl apply --dry-run=client $(ls backup*.yml | awk ' { print " -f " $1 } ')
apiVersion: escalation.pagerduty.crossplane.io/v1alpha1
kind: Policy
metadata:
annotations:
meta.upbound.io/example-id: escalation/v1alpha1/policy
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
@haarchri
haarchri / gist:1e490a715f4aa1e91cf1cc88539ff426
Created August 1, 2023 17:36
debug config for upjet doc generation
{
// 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",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",