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

AMI — Amazon Machine Image

How to Develop a Plugin for ARK Desktop Wallet

Google Log(glog) Output Format

Case Study: Capital One on AWS

Learn To Program During Covid-19

Why do release notes matter?

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

Streamlining your Kubernetes adoption with Helmfile / ArgoCD and GitOps

Photo of a playground

Demystifying GitOps - Intro

New sync and diff strategies in ArgoCD

Using GitOps, Multiple Argo Instances, and Environments with Argo CD at Scale