Skip to content

Instantly share code, notes, and snippets.

@stevendborrelli
Last active March 4, 2022 19:50
Show Gist options
  • Save stevendborrelli/d9890a32c95148bad5d46e23a35efe24 to your computer and use it in GitHub Desktop.
Save stevendborrelli/d9890a32c95148bad5d46e23a35efe24 to your computer and use it in GitHub Desktop.

Provider crossplane/provider-azure:v0.18.1

kubectl get secrets -n crossplane-system 
NAME                  TYPE                                  DATA   AGE
default-token-mfplc   kubernetes.io/service-account-token   3      34m
example-psql          connection.crossplane.io/v1alpha1     4      4m10s

Delete database, confirm in Azure console it is still there:

kubectl delete -f database/postgresqlserver.yaml 
postgresqlserver.database.azure.crossplane.io "example-psql" deleted
kubectl get -f database/postgresqlserver.yaml 
Error from server (NotFound): postgresqlservers.database.azure.crossplane.io "example-psql" not found

Import existing database using external-name

kubectl apply -f database/postgresqlserver.yaml 
postgresqlserver.database.azure.crossplane.io/example-psql created
NAME                  TYPE                                  DATA   AGE
default-token-mfplc   kubernetes.io/service-account-token   3      47m
example-psql          connection.crossplane.io/v1alpha1     3      10s
apiVersion: azure.crossplane.io/v1alpha3
kind: ResourceGroup
metadata:
name: borrelli-example-rg
spec:
location: East US
providerConfigRef:
name: default
---
apiVersion: database.azure.crossplane.io/v1beta1
kind: PostgreSQLServer
metadata:
name: example-psql
labels:
example: "true"
# annotations:
# crossplane.io/external-name: example-psql
spec:
deletionPolicy: Orphan
forProvider:
administratorLogin: myadmin
resourceGroupNameRef:
name: borrelli-example-rg
location: East US
minimalTlsVersion: TLS1_2
sslEnforcement: Enabled
version: "11"
sku:
# Note that Basic servers do not support virtual network rules
tier: GeneralPurpose
capacity: 2
family: Gen5
storageProfile:
storageMB: 20480
writeConnectionSecretToRef:
namespace: crossplane-system
name: example-psql
providerConfigRef:
name: default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment