Skip to content

Commit b8de9da

Browse files
committed
add initial crossplane support
Signed-off-by: Carlos Santana <[email protected]>
1 parent ec3d166 commit b8de9da

File tree

9 files changed

+299
-0
lines changed

9 files changed

+299
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: ApplicationSet
3+
metadata:
4+
name: addons-aws-crossplane-contrib
5+
spec:
6+
syncPolicy:
7+
preserveResourcesOnDeletion: true
8+
generators:
9+
- clusters:
10+
values:
11+
addonChart: crossplane
12+
addonChartNamespace: crossplane-system
13+
selector:
14+
matchExpressions:
15+
- key: akuity.io/argo-cd-cluster-name
16+
operator: NotIn
17+
values:
18+
- in-cluster
19+
- key: aws_enable_crossplane_aws_resources
20+
operator: In
21+
values:
22+
- 'true'
23+
template:
24+
metadata:
25+
name: 'addon-{{name}}-{{values.addonChart}}-aws-resources'
26+
spec:
27+
project: default
28+
source:
29+
repoURL: 'https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template'
30+
targetRevision: HEAD
31+
path: charts/addons/{{values.addonChart}}/aws/resources
32+
helm:
33+
ignoreMissingValueFiles: true
34+
valueFiles:
35+
- ../../../../environments/{{metadata.labels.environment}}/addons/{{values.addonChart}}/aws/resources/values.yaml
36+
- ../../../../clusters/{{name}}/addons/{{values.addonChart}}/aws/resources/values.yaml
37+
- ../../../../charts/addons/{{values.addonChart}}/aws/resources/values.yaml
38+
values: |
39+
controller:
40+
eks.amazonaws.com/role-arn: {{metadata.annotations.metadata_aws_crossplane_iam_role_arn}}
41+
#fileParameters:
42+
# - name:
43+
# path:
44+
#parameters
45+
#values
46+
#valuesObject
47+
destination:
48+
namespace: '{{values.addonChartNamespace}}'
49+
name: '{{name}}'
50+
syncPolicy:
51+
automated: {}
52+
syncOptions:
53+
- CreateNamespace=true
54+
- ServerSideApply=true # Big CRDs.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: ApplicationSet
3+
metadata:
4+
name: addons-crossplane
5+
spec:
6+
syncPolicy:
7+
preserveResourcesOnDeletion: true
8+
generators:
9+
- merge:
10+
mergeKeys:
11+
- server
12+
generators:
13+
- clusters:
14+
values:
15+
addonChart: crossplane
16+
addonChartNamespace: crossplane-system
17+
# anything not staging or prod use this version
18+
addonChartVersion: '1.12.2'
19+
addonChartRepository: https://charts.crossplane.io/stable
20+
selector:
21+
matchExpressions:
22+
- key: akuity.io/argo-cd-cluster-name
23+
operator: NotIn
24+
values:
25+
- in-cluster
26+
- key: enable_crossplane
27+
operator: In
28+
values:
29+
- 'true'
30+
- clusters:
31+
selector:
32+
matchLabels:
33+
environment: staging
34+
values:
35+
addonChartVersion: '1.12.2'
36+
- clusters:
37+
selector:
38+
matchLabels:
39+
environment: prod
40+
values:
41+
addonChartVersion: '1.12.2'
42+
template:
43+
metadata:
44+
name: 'addon-{{name}}-{{values.addonChart}}'
45+
spec:
46+
project: default
47+
sources:
48+
- repoURL: 'https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template'
49+
targetRevision: HEAD
50+
ref: values
51+
- chart: '{{values.addonChart}}'
52+
repoURL: '{{values.addonChartRepository}}'
53+
targetRevision: '{{values.addonChartVersion}}'
54+
helm:
55+
releaseName: '{{values.addonChart}}'
56+
ignoreMissingValueFiles: true
57+
valueFiles:
58+
- $values/environments/{{metadata.labels.environment}}/addons/{{values.addonChart}}/values.yaml
59+
- $values/clusters/{{name}}/addons/{{values.addonChart}}/values.yaml
60+
- $values/charts/addons/{{values.addonChart}}/values.yaml
61+
values: |
62+
controller:
63+
serviceAccount:
64+
annotations:
65+
eks.amazonaws.com/role-arn: "{{metadata.annotations.metadata_aws_argocd_iam_role_arn}}"
66+
#fileParameters:
67+
# - name:
68+
# path:
69+
#parameters
70+
#valuesObject
71+
destination:
72+
namespace: '{{values.addonChartNamespace}}'
73+
name: '{{name}}'
74+
syncPolicy:
75+
automated: {}
76+
syncOptions:
77+
- CreateNamespace=true
78+
- ServerSideApply=true # Big CRDs.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: resources
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 1.0.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.0.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "resources.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "resources.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "resources.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "resources.labels" -}}
37+
helm.sh/chart: {{ include "resources.chart" . }}
38+
{{ include "resources.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "resources.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "resources.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.controller.enabled }}
2+
apiVersion: pkg.crossplane.io/v1alpha1
3+
kind: ControllerConfig
4+
metadata:
5+
name: {{ .Values.controller.metadata.name }}
6+
annotations:
7+
{{- range $key, $value := .Values.controller.metadata.annotations }}
8+
{{ $key }}: {{ $value | quote }}
9+
{{- end }}
10+
spec:
11+
{{- .Values.controller.spec | toYaml | nindent 2 }}
12+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.providerConfig.enabled }}
2+
apiVersion: aws.crossplane.io/v1beta1
3+
kind: ProviderConfig
4+
metadata:
5+
name: {{ .Values.providerConfig.metadata.name }}
6+
annotations:
7+
{{- range $key, $value := .Values.providerConfig.metadata.annotations }}
8+
{{ $key }}: {{ $value | quote }}
9+
{{- end }}
10+
spec:
11+
{{- .Values.providerConfig.spec | toYaml | nindent 2 }}
12+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if .Values.provider.enabled }}
2+
apiVersion: pkg.crossplane.io/v1
3+
kind: Provider
4+
metadata:
5+
name: {{ .Values.provider.metadata.name }}
6+
annotations:
7+
{{- range $key, $value := .Values.provider.metadata.annotations }}
8+
{{ $key }}: {{ $value | quote }}
9+
{{- end }}
10+
spec:
11+
package: {{ .Values.provider.package.registry }}:{{ .Values.provider.package.version }}
12+
controllerConfigRef:
13+
name: {{ .Values.controller.metadata.name }}
14+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
controller:
2+
enabled: true
3+
metadata:
4+
name: "aws-controller-config"
5+
annotations:
6+
eks.amazonaws.com/role-arn: "replace-me"
7+
spec:
8+
podSecurityContext:
9+
fsGroup: 2000
10+
args:
11+
- --debug
12+
13+
providerConfig:
14+
enabled: true
15+
metadata:
16+
name: "aws-provider-config"
17+
annotations: {}
18+
spec:
19+
credentials:
20+
source: InjectedIdentity
21+
22+
provider:
23+
enabled: true
24+
metadata:
25+
name: "aws-provider"
26+
annotations: {}
27+
package:
28+
registry: xpkg.upbound.io/crossplane-contrib/provider-aws
29+
version: "v0.41.1"

0 commit comments

Comments
 (0)