Skip to main content

Infralib Requirements for Platform APIs

Platform APIs such as PostgreSQLInstance, ValkeyInstance or Zone only work when your Infralib configuration has three things in place. Check them in this order.

1. Include the base modules​

Every platform API needs these modules in your Infralib agent config:

Step typeModule (source)Required nameWhy
terraformaws/vpcanySubnets for databases, caches and node pools.
terraformaws/eksanyThe Kubernetes cluster.
terraformaws/crossplaneanyIAM role that Crossplane uses to manage AWS resources.
argocd-appsargocdanyInstalls the other modules; Zones create ArgoCD projects in it.
argocd-appscrossplane-corecrossplane-systemCrossplane itself. The IAM role trusts this namespace.
argocd-appscrossplane-awscrossplane-awsAWS providers. Every API refers to the provider config by this name.
argocd-appskyvernoanyPolicies that enforce Zone isolation.
argocd-appsexternal-secretsanyDelivers credentials to Kubernetes Secrets.
argocd-appsplatform-apisanyThe platform APIs themselves.

aws/kms is optional. With it, resources are encrypted with your own KMS keys; without it, AWS-managed keys are used.

2. Turn on two crossplane-aws settings​

Both are off by default, and without them no platform API can create anything:

- name: crossplane-aws
source: crossplane-aws
inputs:
global:
createObservers: true
createNamespacedObservers: true
What do these settings do?

They connect the platform APIs to the infrastructure Infralib has already built:

  • They install the AWS providers the APIs use, such as RDS, ElastiCache, EC2, EKS, ECR and Secrets Manager. Without them, only IAM, S3 and SQS are installed.
  • They make your existing VPC, subnets and EKS cluster visible in Kubernetes. Crossplane creates a read-only copy, an "observer", of each one under a fixed name such as vpc, eks or database. When you create a database, the platform looks up database to know which subnets to put it in.

3. Enable the APIs you need​

Most APIs are on by default. Some need an extra flag or module:

APIEnable flagDefaultAlso needs
Zoneplatform-apis.zone.installtrue—
PostgreSQLplatform-apis.postgresql.installtruecrossplane-sql module.
MariaDBplatform-apis.mariadb.installfalsecrossplane-sql module, postgresql.install: true.
Valkeyplatform-apis.valkey.installtruepostgresql.install: true.
S3 bucketplatform-apis.s3bucket.installtrue—
Repositoryplatform-apis.repository.installtrue—
RabbitMQplatform-apis.rabbitmq.installfalsemq in crossplane-aws global.extraProviders.
Kafkaplatform-apis.kafka.installfalsekafka in crossplane-aws global.extraProviders, crossplane-kafka module, an existing MSK cluster.
Secret——external-secrets with global.createClusterSecretStore: true. Not a platform API.

MariaDB and Valkey reuse the database settings that are installed with PostgreSQL, so postgresql.install must stay true even if you do not create PostgreSQL instances.

When you set extraProviders, list every extra provider you need in one place. Helm replaces lists instead of merging them.

Full configuration example​

A configuration with every API in this table enabled. Remove what you do not need.

steps:
- name: net
type: terraform
modules:
- name: main
source: aws/vpc
- name: kms
source: aws/kms # optional
- name: infra
type: terraform
vpc:
attach: true
modules:
- name: eks
source: aws/eks
- name: crossplane
source: aws/crossplane
- name: apps
type: argocd-apps
modules:
- name: argocd
source: argocd
- name: crossplane-system # name must be crossplane-system
source: crossplane-core
- name: crossplane-aws # name must be crossplane-aws
source: crossplane-aws
inputs:
global:
createObservers: true
createNamespacedObservers: true
extraProviders: [mq, kafka] # RabbitMQ and Kafka only
- name: kyverno
source: kyverno
- name: external-secrets
source: external-secrets
inputs:
global:
createClusterSecretStore: true
- name: crossplane-sql # PostgreSQL and MariaDB users and databases
source: crossplane-sql
- name: crossplane-kafka # Kafka only
source: crossplane-kafka
- name: platform-apis
source: platform-apis
inputs:
platform-apis:
mariadb:
install: true
rabbitmq:
install: true
kafka:
install: true
environmentConfig:
kafkaNamespace: crossplane-kafka # = the crossplane-kafka module name

Module names matter​

In an argocd-apps step, the module name becomes the ArgoCD Application, the Helm release and the namespace. A few names are referred to by other modules:

  • crossplane-core must be named crossplane-system and crossplane-aws must be named crossplane-aws.
  • The external-secrets module name is also the name of its ClusterSecretStore. If you name the module external-secrets-dev, use external-secrets-dev in secretStoreRef.name.
  • kafkaNamespace must match the crossplane-kafka module name.