Skip to content

Commit

Permalink
feat(gitops): add argocd (#5)
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Haar <[email protected]>
  • Loading branch information
haarchri authored Mar 25, 2024
1 parent 011c3ca commit 034fde9
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 4 deletions.
62 changes: 60 additions & 2 deletions apis/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,17 @@ spec:
fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.providerConfigName
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators
toFieldPath: spec.parameters.operators
fromFieldPath: spec.parameters.operators.certmanager
toFieldPath: spec.parameters.operators.certmanager
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.ingressnginx
toFieldPath: spec.parameters.operators.ingressnginx
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.externaldns
toFieldPath: spec.parameters.operators.externaldns
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.crossplane
toFieldPath: spec.parameters.operators.crossplane

- name: spaces-core
base:
Expand Down Expand Up @@ -106,6 +115,49 @@ spec:
readinessChecks:
- type: None

- name: argocd
condition: |
"argocd" in observed.composite.resource.spec.parameters.operators &&
observed.composite.resource.spec.parameters.operators.argocd.enabled == true
base:
apiVersion: gitops.platform.upbound.io/v1alpha1
kind: XArgo
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.providerConfigName
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.argocd.ingressUrl
toFieldPath: spec.parameters.ingressUrl
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.argocd.git
toFieldPath: spec.parameters.source.git
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.argocd.resourceExclusions
toFieldPath: spec.parameters.resourceExclusions
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.argocd.resourceInclusions
toFieldPath: spec.parameters.resourceInclusions

- name: usageXClusterByXArgo
condition: |
"argocd" in observed.composite.resource.spec.parameters.operators &&
observed.composite.resource.spec.parameters.operators.argocd.enabled == true
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
by:
apiVersion: gitops.platform.upbound.io/v1alpha1
kind: XArgo
resourceSelector:
matchControllerRef: true
of:
apiVersion: spaces.platformref.upbound.io/v1alpha1
kind: XCluster
resourceSelector:
matchControllerRef: true

- step: ordered-creation
functionRef:
name: crossplane-contrib-function-sequencer
Expand All @@ -119,3 +171,9 @@ spec:
- sequence:
- spaces-init
- spaces-core
- sequence:
- spaces-core
- argocd
- sequence:
- spaces-core
- usageXClusterByXArgo
44 changes: 42 additions & 2 deletions apis/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,46 @@ spec:
version: "v1.14.6-up.1"
providers: []
properties:
argocd:
type: object
properties:
enabled:
type: boolean
description: "Indicates if argocd is enabled."
default: false
version:
type: string
description: "Specifies the version of argocd helm-chart to use."
default: "5.51.1"
ingressUrl:
type: string
description: set ingressUrl for argocd server
resourceExclusions:
type: string
description: configure the list of exclude resources
resourceInclusions:
type: string
description: configure the list of included resources
git:
type: object
properties:
url:
description: URL specifies the Git repository URL, it can be an HTTP/S address.
pattern: ^(http|https)://.*\.git$
type: string
path:
type: string
ref:
description: Reference specifies the Git reference to resolve and
monitor for changes.
type: object
properties:
name:
description: "Name of the reference to check out"
type: string
required:
- url
- ref
certmanager:
type: object
default:
Expand Down Expand Up @@ -205,7 +245,7 @@ spec:
type: object
description: "Defines the configuration for spaces."
default:
version: "1.2.1"
version: "1.2.3"
account: ""
clusterType: ""
dns:
Expand All @@ -217,7 +257,7 @@ spec:
version:
type: string
description: "The version of the space configuration."
default: "1.2.1"
default: "1.2.3"
dns:
type: object
properties:
Expand Down
4 changes: 4 additions & 0 deletions apis/space-core/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ spec:
value: "true"
- name: "features.alpha.eso.namespace"
value: "external-secrets"
- name: "features.alpha.argocdPlugin.enabled"
value: "true"
- name: "features.alpha.argocdPlugin.target.secretNamespace"
value: "argocd"
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.providerConfigName
Expand Down
3 changes: 3 additions & 0 deletions crossplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ spec:
- configuration: xpkg.upbound.io/upbound/configuration-gcp-gke
# renovate: datasource=github-releases depName=upbound/configuration-gcp-gke
version: "v0.3.0"
- configuration: xpkg.upbound.io/upbound/configuration-gitops-argocd
# renovate: datasource=github-releases depName=upbound/configuration-gitops-argocd
version: "v0.6.0"
- function: xpkg.upbound.io/upboundcare/function-conditional-patch-and-transform
version: "v0.4.0"
- function: xpkg.upbound.io/crossplane-contrib/function-patch-and-transform
Expand Down
31 changes: 31 additions & 0 deletions examples/aws-host-space.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,37 @@ spec:
- name: provider-kubernetes
package: xpkg.upbound.io/crossplane-contrib/provider-kubernetes:v0.12.1
localRbac: true
argocd:
enabled: true
ingressUrl: argocd-platform-ref-upbound-spaces.${data.route53ZoneName}
git:
url: https://github.com/upbound/platform-ref-upbound-spaces.git
path: gitops
ref:
name: HEAD
resourceExclusions: |
- kinds:
- ProviderConfigUsage
apiGroups:
- "*"
- kinds:
- "Nodes"
apiGroups:
- "*"
clusters:
- "*/controlplane-*"
resourceInclusions: |
- apiGroups:
- "*"
kinds:
- Provider
- Function
- Configuration
- CompositeResourceDefinition
- Composition
- Application
clusters:
- "*/controlplane-*"
spaces:
dns:
spacesRouterDomain: platform-ref-upbound-spaces.${data.route53ZoneName}
Expand Down
31 changes: 31 additions & 0 deletions examples/azure-host-space.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,37 @@ spec:
- name: provider-kubernetes
package: xpkg.upbound.io/crossplane-contrib/provider-kubernetes:v0.12.1
localRbac: true
argocd:
enabled: true
ingressUrl: argocd-platform-ref-upbound-spaces.${data.route53ZoneName}
git:
url: https://github.com/upbound/platform-ref-upbound-spaces.git
path: gitops
ref:
name: HEAD
resourceExclusions: |
- kinds:
- ProviderConfigUsage
apiGroups:
- "*"
- kinds:
- "Nodes"
apiGroups:
- "*"
clusters:
- "*/controlplane-*"
resourceInclusions: |
- apiGroups:
- "*"
kinds:
- Provider
- Function
- Configuration
- CompositeResourceDefinition
- Composition
- Application
clusters:
- "*/controlplane-*"
spaces:
dns:
spacesRouterDomain: platform-ref-upbound-spaces-aks.${data.route53ZoneName}
Expand Down
31 changes: 31 additions & 0 deletions examples/gcp-host-space.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,37 @@ spec:
- name: provider-kubernetes
package: xpkg.upbound.io/crossplane-contrib/provider-kubernetes:v0.12.1
localRbac: true
argocd:
enabled: true
ingressUrl: argocd-platform-ref-upbound-spaces.${data.route53ZoneName}
git:
url: https://github.com/upbound/platform-ref-upbound-spaces.git
path: gitops
ref:
name: HEAD
resourceExclusions: |
- kinds:
- ProviderConfigUsage
apiGroups:
- "*"
- kinds:
- "Nodes"
apiGroups:
- "*"
clusters:
- "*/controlplane-*"
resourceInclusions: |
- apiGroups:
- "*"
kinds:
- Provider
- Function
- Configuration
- CompositeResourceDefinition
- Composition
- Application
clusters:
- "*/controlplane-*"
spaces:
dns:
spacesRouterDomain: platform-ref-upbound-spaces-gke.${data.route53ZoneName}
Expand Down
9 changes: 9 additions & 0 deletions gitops/infrastructure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
key:
components:
- name: spaces-reference-architecture
namespace: upbound-system
server: https://kubernetes.default.svc
project: default
repoUrl: https://github.com/upbound/spaces-reference-architecture.git
version: HEAD
folder: "bootstrap/"

0 comments on commit 034fde9

Please sign in to comment.