Skip to content
Minimal Azure Environment for Crossplane
Shell Dockerfile Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.registry
hack
kustomize
.gitignore
Dockerfile
Jenkinsfile.branch
Jenkinsfile.continuous
Jenkinsfile.publish
Jenkinsfile.tag
Makefile
README.md
example.yaml
vnet.yaml

README.md

Azure Sample Stack

You can use this stack to spin up a private network as well as resource classes that will let you provision resources in that network.

Installation

Requirements:

  • Crossplane should be installed.
  • Azure Provider should be installed and its version should be at least 0.7.0

If you have crossplane-cli installed, you can use the following command to install:

# Do not forget to change <version> with the correct version.
kubectl crossplane stack install --cluster -n crossplane-system 'crossplane/stack-azure-sample:<version>' azure-sample

If you don't have crossplane-cli installed, you need to create the following YAML to install:

apiVersion: stacks.crossplane.io/v1alpha1
kind: ClusterStackInstall
metadata:
  name: "azure-sample"
  namespace: crossplane-system
spec:
  package: "crossplane/stack-azure-sample:<version>"

Usage Instructions

You can create the following YAML to trigger creation of:

and the following resource classes with minimal hardware requirements that will let you create instances that are connected to that network.

# you can find this in example.yaml
apiVersion: azure.stacks.crossplane.io/v1alpha1
kind: AzureSample
metadata:
  name: test
spec:
  location: West US
  credentialsSecretRef:
    name: azure-account-creds
    namespace: crossplane-system
    key: credentials

In Crossplane, the resource classes that are annotated with resourceclass.crossplane.io/is-default-class: "true" are used as default if the claim doesn't specify a resource class selector. The resource classes you create via the AzureSample instance above will deploy all of its resource classes as default. If you'd like those defaulting annotations to be removed, you need to add the following to AzureSample instance above:

templatestacks.crossplane.io/remove-defaulting-annotations: true

VNetRule Exception

In Azure, for your cluster to connect to the MySQL Server resource, there needs to be a MySQL Server Virtual Network Rule that is created with the name of the MySQLServer, which is determined only after the MySQL Server resource is created. So, after you create a MySQLServer resource from the SQLServerClass that this stack creates, you need to create the following MySQLServerVirtualNetworkRule resource with correct values:

# you can find this in vnet.yaml
apiVersion: database.azure.crossplane.io/v1alpha3
kind: MySQLServerVirtualNetworkRule
metadata:
  name: test-vnetrule
spec:
  name: test-vnetrule
  serverName: <fill with mysqlserver.azure.crossplane.io instance name>
  resourceGroupNameRef:
    name: test-resourcegroup
  properties:
    virtualNetworkSubnetIdRef:
      name: test-subnet
  reclaimPolicy: Delete
  providerRef:
    name: test-azure-provider

The value of spec.serverName should be populated with the name of the MySQLServer resource you have, for example default-test-mysqlserver-4sds5.

Other thing is that spec.providerRef, spec.properties.virtualNetworkSubnetIdRef and spec.resourceGroupNameRef have test- prefix which is how the resources are named if you deploy the example in this repo. If you choose to create AzureSample instance with a different name, do not forget to use <AzureSample name>- prefix instead of test-

Since this MySQLServerVirtualNetworkRule is created manually, it won't be cleaned up when you delete your AzureSample instance.

Build

Run make

Test Locally

Minikube

Run make and then run the following command to copy the image into your minikube node's image registry:

# Do not forget to specify <version>
docker save "crossplane/stack-azure-sample:<version>" | (eval "$(minikube docker-env --shell bash)" && docker load)

After running this, you can use the installation command and the image loaded into minikube node will be picked up.

You can’t perform that action at this time.