From f43f1e77b3d3deafaf46a5bc77039724eefc04ef Mon Sep 17 00:00:00 2001 From: Divyam Date: Wed, 18 Sep 2024 18:20:44 +0530 Subject: [PATCH] bootstrap crossplane add readme --- .../crossplane-provider/Chart.yaml | 14 ++++++ .../crossplane-provider/Readme.md | 43 +++++++++++++++++++ .../crossplane-provider/charts/aws/Chart.yaml | 3 ++ .../charts/aws/templates/provider.yaml | 9 ++++ .../charts/azure/Chart.yaml | 3 ++ .../charts/azure/templates/provider.yaml | 17 ++++++++ .../charts/azure/templates/resourcegroup.yaml | 12 ++++++ .../azure/templates/virtualnetwork.yaml | 15 +++++++ .../charts/azure/values.yaml | 14 ++++++ .../templates/providerconfig-azure.yaml | 13 ++++++ .../crossplane-provider/values.yaml | 10 +++++ 11 files changed, 153 insertions(+) create mode 100644 argocd-helm-charts/crossplane-provider/Chart.yaml create mode 100644 argocd-helm-charts/crossplane-provider/Readme.md create mode 100644 argocd-helm-charts/crossplane-provider/charts/aws/Chart.yaml create mode 100644 argocd-helm-charts/crossplane-provider/charts/aws/templates/provider.yaml create mode 100644 argocd-helm-charts/crossplane-provider/charts/azure/Chart.yaml create mode 100644 argocd-helm-charts/crossplane-provider/charts/azure/templates/provider.yaml create mode 100644 argocd-helm-charts/crossplane-provider/charts/azure/templates/resourcegroup.yaml create mode 100644 argocd-helm-charts/crossplane-provider/charts/azure/templates/virtualnetwork.yaml create mode 100644 argocd-helm-charts/crossplane-provider/charts/azure/values.yaml create mode 100644 argocd-helm-charts/crossplane-provider/templates/providerconfig-azure.yaml create mode 100644 argocd-helm-charts/crossplane-provider/values.yaml diff --git a/argocd-helm-charts/crossplane-provider/Chart.yaml b/argocd-helm-charts/crossplane-provider/Chart.yaml new file mode 100644 index 000000000..c8149fd8a --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/Chart.yaml @@ -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 diff --git a/argocd-helm-charts/crossplane-provider/Readme.md b/argocd-helm-charts/crossplane-provider/Readme.md new file mode 100644 index 000000000..4b4f87719 --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/Readme.md @@ -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 +``` diff --git a/argocd-helm-charts/crossplane-provider/charts/aws/Chart.yaml b/argocd-helm-charts/crossplane-provider/charts/aws/Chart.yaml new file mode 100644 index 000000000..c92695b90 --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/charts/aws/Chart.yaml @@ -0,0 +1,3 @@ +apiVersion: v2 +name: aws +version: 1.0.0 diff --git a/argocd-helm-charts/crossplane-provider/charts/aws/templates/provider.yaml b/argocd-helm-charts/crossplane-provider/charts/aws/templates/provider.yaml new file mode 100644 index 000000000..d600b33a1 --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/charts/aws/templates/provider.yaml @@ -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 \ No newline at end of file diff --git a/argocd-helm-charts/crossplane-provider/charts/azure/Chart.yaml b/argocd-helm-charts/crossplane-provider/charts/azure/Chart.yaml new file mode 100644 index 000000000..49cf8715c --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/charts/azure/Chart.yaml @@ -0,0 +1,3 @@ +apiVersion: v2 +name: azure +version: 1.0.0 diff --git a/argocd-helm-charts/crossplane-provider/charts/azure/templates/provider.yaml b/argocd-helm-charts/crossplane-provider/charts/azure/templates/provider.yaml new file mode 100644 index 000000000..57fb7fcf1 --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/charts/azure/templates/provider.yaml @@ -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 \ No newline at end of file diff --git a/argocd-helm-charts/crossplane-provider/charts/azure/templates/resourcegroup.yaml b/argocd-helm-charts/crossplane-provider/charts/azure/templates/resourcegroup.yaml new file mode 100644 index 000000000..18011d4ed --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/charts/azure/templates/resourcegroup.yaml @@ -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 }} \ No newline at end of file diff --git a/argocd-helm-charts/crossplane-provider/charts/azure/templates/virtualnetwork.yaml b/argocd-helm-charts/crossplane-provider/charts/azure/templates/virtualnetwork.yaml new file mode 100644 index 000000000..f1f270eff --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/charts/azure/templates/virtualnetwork.yaml @@ -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 }} \ No newline at end of file diff --git a/argocd-helm-charts/crossplane-provider/charts/azure/values.yaml b/argocd-helm-charts/crossplane-provider/charts/azure/values.yaml new file mode 100644 index 000000000..caac07d9c --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/charts/azure/values.yaml @@ -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 \ No newline at end of file diff --git a/argocd-helm-charts/crossplane-provider/templates/providerconfig-azure.yaml b/argocd-helm-charts/crossplane-provider/templates/providerconfig-azure.yaml new file mode 100644 index 000000000..6d712a675 --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/templates/providerconfig-azure.yaml @@ -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 }} diff --git a/argocd-helm-charts/crossplane-provider/values.yaml b/argocd-helm-charts/crossplane-provider/values.yaml new file mode 100644 index 000000000..25a5077b6 --- /dev/null +++ b/argocd-helm-charts/crossplane-provider/values.yaml @@ -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