Skip to content

Commit

Permalink
bootstrap crossplane
Browse files Browse the repository at this point in the history
add readme
  • Loading branch information
nihaldivyam committed Oct 1, 2024
1 parent d2fa606 commit f43f1e7
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 0 deletions.
14 changes: 14 additions & 0 deletions argocd-helm-charts/crossplane-provider/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v2
name: crossplane-provider
version: 1.0.0
description: |
A crossplane provider can be generated by using helm chart for multiple providers. Maintained by Obmondo
dependencies:
- name: aws
version: 1.0.0
repository: 'file://charts/aws'
condition: provider.aws
- name: azure
version: 1.0.0
repository: 'file://charts/azure'
condition: provider.azure
43 changes: 43 additions & 0 deletions argocd-helm-charts/crossplane-provider/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Crossplane Azure Integration

## Overview

This project provides a set of Helm templates for managing Azure and AWS resources using
Crossplane. It enables the creation and management of Azure Virtual Networks (VNet) and
associated resource groups through declarative configuration.

## Prerequisites

- **Crossplane**: You must have [Crossplane](https://crossplane.io/docs/) installed in your Kubernetes cluster.

## Configuration

### Values File

Edit the `values.yaml` file to specify your Azure resources:

- **location**: The Azure region where the resources will be created.
- **defaultSubscription**: The default Azure subscription to use if no specific providerConfigRef is provided.
- **defaultRgName**: The default resource group name.
- **vnet**: Define your Virtual Networks here resource group associations.

**Example `values.yaml`:**

```yaml
location: North Europe
subscription: default
defaultRgName: rgcrossplane
resourceGroup:
rgcrossplane:
location: North Europe
rgcrossplane1:
location: North Europe
vnet:
vnet-crossplane1:
cidrBlock: 10.0.0.0/16
rgName: rgcrossplane1
providerConfigRef:
name: default
vnet-crossplane2:
cidrBlock: 10.0.0.0/16
```
3 changes: 3 additions & 0 deletions argocd-helm-charts/crossplane-provider/charts/aws/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: aws
version: 1.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: upbound-provider-aws
spec:
package: xxpkg.upbound.io/crossplane-contrib/provider-aws:v0.48.1
packagePullPolicy: IfNotPresent
revisionActivationPolicy: Automatic
revisionHistoryLimit: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: azure
version: 1.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-azure
spec:
package: xpkg.upbound.io/upbound/provider-family-azure:v1.5.0
packagePullPolicy: IfNotPresent
revisionActivationPolicy: Automatic
revisionHistoryLimit: 1
---
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-azure-network
spec:
package: xpkg.upbound.io/upbound/provider-azure-network:v1.6.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- range $rgname, $resourceGroup := .Values.resourceGroup }}
---
apiVersion: azure.upbound.io/v1beta1
kind: ResourceGroup
metadata:
name: {{ $rgname }}
spec:
forProvider:
location: {{ $resourceGroup.location | default $.Values.location }}
providerConfigRef:
name: {{ ($resourceGroup.providerConfigRef).name | default $.Values.subscription }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- range $vnetName, $vnet := .Values.vnet }}
---
apiVersion: network.azure.upbound.io/v1beta1
kind: VirtualNetwork
metadata:
name: {{ $vnetName }}
spec:
forProvider:
addressSpace:
- {{ $vnet.cidrBlock }}
location: {{ $vnet.location | default $.Values.location }}
resourceGroupName: {{ $vnet.rgName | default $.Values.defaultRgName }}
providerConfigRef:
name: {{ ($vnet.providerConfigRef).name | default $.Values.subscription }}
{{- end }}
14 changes: 14 additions & 0 deletions argocd-helm-charts/crossplane-provider/charts/azure/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# location: North Europe
# defaultSubscription: default
# defaultRgName: rgcrossplane1
# resourceGroup:
# rgcrossplane1:
# location: Central India
# vnet:
# vnet-crossplane1:
# cidrBlock: 10.0.0.0/16
# rgName: rgcrossplane1
# providerConfigRef:
# name: default
# vnet-crossplane2:
# cidrBlock: 10.0.2.1/16
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.provider.azure }}
apiVersion: azure.upbound.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
credentials:
source: Secret
secretRef:
namespace: {{ .Values.azure.default_subscription.namespace }}
name: {{ .Values.azure.default_subscription.secretName }}
key: {{ .Values.azure.default_subscription.secretkey }}
{{- end }}
10 changes: 10 additions & 0 deletions argocd-helm-charts/crossplane-provider/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
provider:
aws: false
azure: false

# Example of Azure provider configuration
# azure:
# default_subscription:
# secretName: azure-secret
# secretkey: creds
# namespace: crossplane-system

0 comments on commit f43f1e7

Please sign in to comment.