Skip to content

Commit

Permalink
Adds conformance tests for the Equinix Metal Provider
Browse files Browse the repository at this point in the history
Signed-off-by: Marques Johansson <[email protected]>
  • Loading branch information
displague committed Jun 14, 2021
1 parent 26a07be commit da8087c
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 0 deletions.
8 changes: 8 additions & 0 deletions v1.2/provider/provider-equinix-metal/PRODUCT.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
vendor: Equinix
name: Crossplane Provider Equinix Metal
version: v0.0.9
website_url: https://github.com/crossplane-contrib/provider-equinix-metal
repo_url: https://github.com/crossplane-contrib/provider-equinix-metal
documentation_url: https://github.com/crossplane-contrib/provider-equinix-metal#crossplane-provider-equinix-metal
type: provider
description: "A Crossplane provider that enables deployment and management of infrastructure resources on Equinix Metal"
86 changes: 86 additions & 0 deletions v1.2/provider/provider-equinix-metal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Crossplane Provider Equinix Metal v0.0.9 Conformance Results

The following steps can be undertaken to obtain the provided conformance results:

1. Create Kubernetes Cluster

```
kind create cluster --name crossplane-conformance --image kindest/node:v1.19.11
```

2. Install Crossplane version 1.2.2

```
kubectl create namespace crossplane-system
helm repo add crossplane-stable https://charts.crossplane.io/stable
helm repo update
helm install crossplane --namespace crossplane-system crossplane-stable/crossplane --version 1.2.2
```

3. Deploy provider-equinix-metal version v0.0.9

```
kubectl crossplane install provider registry.upbound.io/equinix/provider-equinix-metal:v0.0.9
```


4. Create Equinix Metal ProviderConfig resource

```
cat > /tmp/providerconfig.yaml <<EOF
---
apiVersion: v1
kind: Secret
metadata:
name: example-provider-equinix-metal
namespace: crossplane-system
type: Opaque
data:
credentials: ${BASE64ENCODED_METAL_PROVIDER_CREDS}
---
apiVersion: metal.equinix.com/v1beta1
kind: ProviderConfig
metadata:
name: equinix-metal-provider
spec:
credentials:
source: Secret
secretRef:
name: example-provider-equinix-metal
namespace: crossplane-system
key: credentials
EOF
kubectl apply -f "/tmp/providerconfig.yaml"
```

5. Create composition definitions

```
kubectl apply -f composition
```

5. Create composite resource

```
kubectl apply -f resources/conformancetest.yaml
```

6. Run Crossplane Conformance Suite

```
xp_version=1.2
sonobuoy run --plugin "https://raw.githubusercontent.com/crossplane/conformance/release-${xp_version}/plugin-provider.yaml"
```

8. Check status/logs

```
sonobuoy status
sonobuoy logs
```

7. Cleanup

```
kubectl delete -f resources
```
55 changes: 55 additions & 0 deletions v1.2/provider/provider-equinix-metal/composition/composition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: conformancetest.metal.equinix.com
spec:
writeConnectionSecretsToNamespace: crossplane-system
compositeTypeRef:
apiVersion: metal.equinix.com/v1alpha1
kind: Conformancetest
resources:
- base:
apiVersion: server.metal.equinix.com/v1alpha2
kind: Device
spec:
forProvider:
hostname: crossplane-conformance
plan: c3.small.x86
operatingSystem: ubuntu_20_04
billingCycle: hourly
locked: false
networkType: hybrid
tags:
- crossplane
providerConfigRef:
name: equinix-metal-provider
writeConnectionSecretToRef:
name: crossplane-conformance
namespace: crossplane-system
reclaimPolicy: Delete
patches:
- fromFieldPath: spec.metro
toFieldPath: spec.forProvider.metro
- base:
apiVersion: vlan.metal.equinix.com/v1alpha1
kind: VirtualNetwork
spec:
forProvider:
description: conformance provisioned VLAN
providerConfigRef:
name: equinix-metal-provider
patches:
- fromFieldPath: spec.metro
toFieldPath: spec.forProvider.metro
- base:
apiVersion: ports.metal.equinix.com/v1alpha1
kind: Assignment
spec:
forProvider:
deviceIdSelector:
matchControllerRef: true
virtualNetworkIdSelector:
matchControllerRef: true
name: eth1
providerConfigRef:
name: equinix-metal-provider
28 changes: 28 additions & 0 deletions v1.2/provider/provider-equinix-metal/composition/definition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: conformancetests.metal.equinix.com
spec:
group: metal.equinix.com
names:
kind: Conformancetest
listKind: ConformancetestList
plural: conformancetests
singular: conformancetest
versions:
- name: v1alpha1
served: true
referenceable: true
schema:
openAPIV3Schema:
description: Managed resources for provider-equinix-metal crossplane conformance
type: object
properties:
spec:
type: object
properties:
metro:
type: string
description: metro
required:
- metro
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: metal.equinix.com/v1alpha1
kind: Conformancetest
metadata:
name: conformancetest1
spec:
metro: sv

0 comments on commit da8087c

Please sign in to comment.