Using Crossplane in GitOps: What to Check in Git

Store Manifests in Git Repository

Managed Resources

---
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
metadata:
name: elasticsearch-my-logging-stack
spec:
references:
- fromObject:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
name: csv-my-logging-stack
fieldPath: status.atProvider.manifest.status.phase
forProvider:
manifest:
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: my-logging-stack
namespace: default
spec:
version: 7.13.3
nodeSets:
- name: default
count: 1
config:
node.store.allow_mmap: false
providerConfigRef:
name: provider-config-dev

Using Kustomize

Managed Resources As Template

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: capabilities-logging-app
namespace: argocd
spec:
destination:
namespace: dev
server: 'https://kubernetes.default.svc'
source:
path: config/capabilities/crossplane-helm/logging
repoURL: 'https://github.com/morningspace/capabilities-shim-gitops'
targetRevision: HEAD
helm:
parameters:
- name: metadata.name
value: dev-env-logging-stack
project: default

Composition and CompositeResourceDefinition

apiVersion: capabilities.morningspace.io/v1alpha1
kind: LoggingClaim
metadata:
name: my-logging-stack
spec:
parameters:
esVersion: 7.13.3
kibanaVersion: 7.13.3
compositionSelector:
matchLabels:
capability: logging
provider: olm

When to Check Composition, CompositeResourceDefinition in Git

Using Kustomize

└── environments
├── base
│ ├── logging-claim.yaml
│ └── kustomization.yaml
└── overlays
└── dev
├── logging-claim.yaml
└── kustomization.yaml
apiVersion: capabilities.morningspace.io/v1alpha1
kind: LoggingClaim
metadata:
annotations:
capabilities.morningspace.io/provider-config: provider-config-dev
name: my-logging-stack
spec:
parameters:
esVersion: 7.15.0
kibanaVersion: 7.15.0

Crossplane vs. Helm

Crossplane Composition vs. Helm Templates

  • Instead of templating, Crossplane renders Composition resource by extracting values from CompositeResource (XR) or CompositeResourceClaim (XRC) resource and patching them to specific fields on managed resources. This is very similar to Kustomize.
  • At a much higher level, we usually see Crossplane Composition is used to composing modules from infrastructure, service, to application in more coarse grained way. On the other hand, Helm usually focuses on “composing” modules at application level in more fine grained way. But this does not mean you cannot compose infrastructure using Helm. For example, with the combined use of Crossplane Provider and Helm, you can compose infrastructure, service, and application too.

XR, XRC, XRD vs. values.yaml

metadata:
name: my-logging-stack
namespace: default
spec:
parameters:
esVersion: 7.13.3
kibanaVersion: 7.13.3

--

--

--

Life is coding and writing! I am a software engineer who have been in IT field for 10+ years. I would love to write beautiful code and story for people.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How Blackburn Labs runs a successful Software Development Company

Custom Kafka SinkConnector for ElasticSearch

Footgun Prevention with AWS VPC Subnetting and Addressing

Multiprocessing in Python

Website Testing Vendors

AWS S3 is an object-based serverless storage service by Amazon web services which is much faster…

5 Cool Commands, You Wish You Knew Earlier!

8 Work Lessons: 1 Year as a Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
MorningSpace

MorningSpace

Life is coding and writing! I am a software engineer who have been in IT field for 10+ years. I would love to write beautiful code and story for people.

More from Medium

ApplicationSet Controller v0.3.0 for Argo CD now available

Safely handle secrets on your GitOps flow using ArgoCD and Helm

Why is the Prometheus Agent Mode So Great?

Unveil the Secret Ingredients of Continuous Delivery at Enterprise Scale with Argo CD