Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate platform reference to Upbound official providers #10

Merged
merged 6 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
This repository contains a reference Azure Platform
[Configuration](https://crossplane.io/docs/v1.6/getting-started/create-configuration.html)
for use as a starting point in [Upbound Cloud](https://upbound.io) or
[Upbound Universal Crossplane (UXP)](https://www.upbound.io/uxp/) to build,
[Upbound Universal Crossplane (UXP)](https://www.upbound.io/products/universal-crossplane) to build,
run and operate your own internal cloud platform and offer a self-service
console and API to your internal teams. It provides platform APIs to provision
fully configured Azure AKS clusters, with secure networking, and stateful cloud
services (Azure Database for PostgreSQL) designed to securely connect to the nodes in each AKS cluster --
all composed using cloud service primitives from the [Crossplane Azure
Provider](https://doc.crds.dev/github.com/crossplane/provider-azure). App
Provider](https://marketplace.upbound.io/providers/upbound/provider-azure). App
deployments can securely connect to the infrastructure they need using secrets
distributed directly to the app namespace.

Expand All @@ -35,7 +35,7 @@ provision the infrastructure they need using a custom cloud console, `kubectl`,
or deployment pipelines and GitOps workflows -- all without writing code?

[Upbound Cloud](https://upbound.io) enables you to do just that, powered by the
open source [Upbound Universal Crossplane](https://www.upbound.io/uxp/) project.
open source [Upbound Universal Crossplane](https://www.upbound.io/products/universal-crossplane) project.

Consistent self-service APIs can be provided across dev, staging, and
production environments, making it easy for app teams to get the infrastructure
Expand Down Expand Up @@ -63,7 +63,7 @@ Crossplane `Providers` include the cloud service primitives (AWS, Azure, GCP,
Alibaba) used in a `Composition`.

Learn more about `Composition` in the [Crossplane
Docs](https://crossplane.io/docs/v1.6/concepts/composition.html).
Docs](https://crossplane.io/docs/v1.9/concepts/composition.html).

## Quick Start

Expand Down Expand Up @@ -234,7 +234,7 @@ Crossplane resources use the ProviderConfig named ```default``` if no specific P
The example cluster compposition creates an AKS cluster and includes a nested composite resource for the network, which creates a Resource Group, Virtual Network, and Subnet:

```console
kubectl apply -f examples/cluster.yaml
kubectl apply -f examples/cluster-claim.yaml
```

verify status:
Expand Down Expand Up @@ -270,7 +270,7 @@ Delete resources created through the `Control Plane` Configurations menu:

```console
kubectl delete -f examples/postgres-claim.yaml
kubectl delete -f examples/cluster.yaml
kubectl delete -f examples/cluster-claim.yaml
```

Verify all underlying resources have been cleanly deleted:
Expand Down Expand Up @@ -319,7 +319,7 @@ az ad sp delete --id $AZ_APP_ID
* [definition.yaml](cluster/services/definition.yaml)
* [composition.yaml](cluster/services/composition.yaml) includes:
* `Release` Install Prometheus with the Helm provider Release API
* `PostgreSQLInstance` - provision an Azure Database for PostgreSQL instance that securely connects to a
* `PostgreSQLInstance` - provision an Azure Database for PostgreSQL instance that securely connects to a
* [definition.yaml](database/postgres/definition.yaml)
* [composition.yaml](database/postgres/composition.yaml) includes:
* `PostgreSQLServer`
Expand Down
37 changes: 19 additions & 18 deletions cluster/aks/composition.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: xaks.azure.platformref.crossplane.io
name: xaks.azure.platformref.upbound.io
labels:
provider: azure
spec:
compositeTypeRef:
apiVersion: azure.platformref.crossplane.io/v1alpha1
apiVersion: azure.platformref.upbound.io/v1alpha1
kind: XAKS
resources:
- base:
apiVersion: compute.azure.crossplane.io/v1alpha3
kind: AKSCluster
apiVersion: containerservice.azure.upbound.io/v1beta1
kind: KubernetesCluster
spec:
location: West US 2
version: "1.21.7"
forProvider:
location: West US 2
kubernetesVersion: "1.24.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a version that has all the server side CRD perf fixes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question, from what I can tell yes, https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.24.md#changelog-since-v1243
The changelog contains kubernetes/kubernetes#111648
Also, it is the highest available AKS version at the moment

az aks get-versions --location westus2 --output table
KubernetesVersion    Upgrades
-------------------  -----------------------
1.24.3               None available
1.24.0               1.24.3
1.23.8               1.24.0, 1.24.3
1.23.5               1.23.8, 1.24.0, 1.24.3
1.22.11              1.23.5, 1.23.8
1.22.6               1.22.11, 1.23.5, 1.23.8

defaultNodePool:
- name: default
nodeCount: 1 #patched
vmSize: Standard_B2s #patched
identity:
- type: "SystemAssigned"
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
Expand All @@ -23,27 +30,21 @@ spec:
string:
fmt: "%s-aks"
- fromFieldPath: spec.id
toFieldPath: metadata.annotations[crossplane.io/external-name]
transforms:
- type: string
string:
fmt: "%s-aks"
- fromFieldPath: spec.id
toFieldPath: spec.resourceGroupNameSelector.matchLabels[azure.platformref.crossplane.io/app]
toFieldPath: spec.forProvider.resourceGroupNameSelector.matchLabels[azure.platformref.upbound.io/app]
- fromFieldPath: spec.id
toFieldPath: spec.vnetSubnetIDSelector.matchLabels[azure.platformref.crossplane.io/app]
toFieldPath: spec.forProvider.vnetSubnetIdSelector.matchLabels[azure.platformref.upbound.io/app]
- fromFieldPath: spec.id
toFieldPath: spec.dnsNamePrefix
toFieldPath: spec.forProvider.dnsPrefix
- fromFieldPath: spec.parameters.nodes.size
toFieldPath: spec.nodeVMSize
toFieldPath: spec.forProvider.defaultNodePool[0].vmSize
transforms:
- type: map
map:
small: Standard_B2s
medium: Standard_B4ms
large: Standard_B8ms
- fromFieldPath: "spec.parameters.nodes.count"
toFieldPath: "spec.nodeCount"
- fromFieldPath: spec.parameters.nodes.count
toFieldPath: spec.forProvider.defaultNodePool[0].nodeCount
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- fromFieldPath: spec.writeConnectionSecretToRef.name
Expand Down
4 changes: 2 additions & 2 deletions cluster/aks/definition.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: xaks.azure.platformref.crossplane.io
name: xaks.azure.platformref.upbound.io
spec:
group: azure.platformref.crossplane.io
group: azure.platformref.upbound.io
names:
kind: XAKS
plural: xaks
Expand Down
10 changes: 5 additions & 5 deletions cluster/composition.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: xclusters.azure.platformref.crossplane.io
name: xclusters.azure.platformref.upbound.io
spec:
compositeTypeRef:
apiVersion: azure.platformref.crossplane.io/v1alpha1
apiVersion: azure.platformref.upbound.io/v1alpha1
kind: XCluster
resources:
- base:
apiVersion: azure.platformref.crossplane.io/v1alpha1
apiVersion: azure.platformref.upbound.io/v1alpha1
kind: XNetwork
patches:
- fromFieldPath: spec.id
toFieldPath: spec.id
- base:
apiVersion: azure.platformref.crossplane.io/v1alpha1
apiVersion: azure.platformref.upbound.io/v1alpha1
kind: XAKS
connectionDetails:
- fromConnectionSecretKey: kubeconfig
Expand All @@ -30,7 +30,7 @@ spec:
- fromFieldPath: spec.parameters.nodes.size
toFieldPath: spec.parameters.nodes.size
- base:
apiVersion: azure.platformref.crossplane.io/v1alpha1
apiVersion: azure.platformref.upbound.io/v1alpha1
kind: XServices
patches:
- fromFieldPath: spec.id
Expand Down
70 changes: 2 additions & 68 deletions cluster/definition.yaml
Original file line number Diff line number Diff line change
@@ -1,75 +1,9 @@
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: xclusters.azure.platformref.crossplane.io
annotations:
upbound.io/ui-schema: |-
---
configSections:
- title: Cluster Info
description: Information about this cluster
items:
- name: id
controlType: singleInput
type: string
path: ".spec.id"
title: Cluster Ref Name
description: Cluster ID that other objects will use to refer to this cluster
default: platform-ref-azure
validation:
- required: true
customError: Cluster ID is required.
- name: writeSecretRef
controlType: singleInput
type: string
path: ".spec.writeConnectionSecretToRef.name"
title: Connection Secret Ref
description: name of the secret to write to this namespace
default: cluster-conn
validation:
- required: true
- title: Cluster Nodes
description: Enter information to size your cluster
items:
- name: clusterNodeCount
controlType: singleInput
type: integer
path: ".spec.parameters.nodes.count"
title: Node Count
description: Number of nodes in the cluster
default: 1
validation:
- minimum: 1
- maximum: 100
- required: true
customError: Node count is required.
- name: clusterNodeSize
controlType: singleSelect
path: ".spec.parameters.nodes.size"
title: Node Size
description: Desired node size (small, medium, or large).
default: small
enum:
- small
- medium
- large
validation:
- required: true
customError: Node size is required.
- title: Cluster Services
description: Configure cluster services and operators
items:
- name: promVersion
controlType: singleInput
type: string
path: ".spec.parameters.services.operators.prometheus.version"
title: Prometheus Chart Version
description: The version of kube-prometheus-stack chart to install
default: 15.0.1
validation:
- required: false
name: xclusters.azure.platformref.upbound.io
spec:
group: azure.platformref.crossplane.io
group: azure.platformref.upbound.io
names:
kind: XCluster
plural: xclusters
Expand Down
56 changes: 23 additions & 33 deletions cluster/network/composition.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: xnetworks.azure.platformref.crossplane.io
name: xnetworks.azure.platformref.upbound.io
labels:
provider: azure
spec:
compositeTypeRef:
apiVersion: azure.platformref.crossplane.io/v1alpha1
apiVersion: azure.platformref.upbound.io/v1alpha1
kind: XNetwork
resources:
- base:
apiVersion: azure.crossplane.io/v1alpha3
apiVersion: azure.upbound.io/v1beta1
kind: ResourceGroup
spec:
location: West US 2
forProvider:
location: West US 2
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
Expand All @@ -22,23 +23,23 @@ spec:
string:
fmt: "%s-rg"
- fromFieldPath: spec.id
toFieldPath: metadata.annotations[crossplane.io/external-name]
toFieldPath: metadata.annotations[upbound.io/external-name]
transforms:
- type: string
string:
fmt: "%s-rg"
- fromFieldPath: spec.id
toFieldPath: metadata.labels[azure.platformref.crossplane.io/app]
toFieldPath: metadata.labels[azure.platformref.upbound.io/app]
- base:
apiVersion: network.azure.crossplane.io/v1alpha3
apiVersion: network.azure.upbound.io/v1beta1
kind: VirtualNetwork
spec:
resourceGroupNameSelector:
matchControllerRef: true
location: West US 2
properties:
forProvider:
resourceGroupNameSelector:
matchControllerRef: true
location: West US 2
addressSpace:
addressPrefixes: ['192.168.0.0/16']
- 192.168.0.0/16
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.labels[app]
Expand All @@ -48,36 +49,25 @@ spec:
- type: string
string:
fmt: "%s-vnet"
- fromFieldPath: spec.id
toFieldPath: metadata.annotations[crossplane.io/external-name]
transforms:
- type: string
string:
fmt: "%s-vnet"
- base:
apiVersion: network.azure.crossplane.io/v1alpha3
apiVersion: network.azure.upbound.io/v1beta1
kind: Subnet
spec:
resourceGroupNameSelector:
matchControllerRef: true
virtualNetworkNameSelector:
matchControllerRef: true
properties:
addressPrefix: '192.168.1.0/24'
forProvider:
resourceGroupNameSelector:
matchControllerRef: true
virtualNetworkNameSelector:
matchControllerRef: true
addressPrefixes:
- 192.168.1.0/24
serviceEndpoints:
- service: Microsoft.Sql
- Microsoft.Sql
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.labels[azure.platformref.crossplane.io/app]
toFieldPath: metadata.labels[azure.platformref.upbound.io/app]
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-sn"
- fromFieldPath: spec.id
toFieldPath: metadata.annotations[crossplane.io/external-name]
transforms:
- type: string
string:
fmt: "%s-sn"