Skip to content

About

Reusable CI/CD workflows, infrastructure definitions, and policy-as-code for internal developer platforms.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

platform-core

Shared delivery, governance, GitOps, and infrastructure contracts for Nexus IDP and the application repositories it generates.

Validate PR Kubernetes Crossplane Argo CD Kyverno Open Policy Agent Cosign

Architecture · Workflow contracts · Capabilities · Getting started · Validation · Evidence · Documentation

platform-core is the shared platform contract repository for the Nexus Internal Developer Platform. It centralizes reusable GitHub Actions workflows, Kubernetes and supply-chain policy, Crossplane APIs and AWS compositions, Argo CD desired state, progressive-delivery checks, observability defaults, security templates, FinOps controls, and operating guidance.

Nexus uses these contracts to create and register service repositories, connect them to the delivery path, and express infrastructure requests through GitOps. Generated repositories retain their application code and service-specific deployment intent while calling the shared CI workflows, contributing overlays to the fleet registry, and passing manifests through common policy controls. Together, Nexus, generated repositories, and platform-core form the paved road from service creation through governed application and infrastructure delivery.

Architecture

flowchart LR
  Developer[Developer] --> Nexus[Nexus IDP<br/>outside this repository]
  Nexus -->|generates code and GitOps intent| Service[Generated service repository<br/>application + Kubernetes overlays]
  Nexus -->|registers service intent| Registry[Fleet registry<br/>gitops/fleet/services]

  subgraph Core[platform-core: reusable definitions and desired state]
    Workflows[Reusable GitHub Actions<br/>build · scan · sign · policy · release]
    OPA[OPA / Conftest<br/>pre-merge policy]
    GitOps[Argo CD root + app-of-apps<br/>projects · controllers · fleet]
    Crossplane[Crossplane XRDs +<br/>AWS compositions]
    Kyverno[Kyverno ClusterPolicies<br/>admission + reporting]
  end

  Service -->|workflow_call| Workflows
  Workflows --> OPA
  Workflows -->|pushes and signs image| RegistryImage[(Container registry)]
  Service -->|GitOps overlay / claim| GitOps
  Registry --> GitOps

  subgraph Runtime[Target Kubernetes cluster, only after bootstrap and sync]
    Argo[Argo CD]
    Workload[Service workload]
    CP[Crossplane controllers]
    Policy[Kyverno admission]
  end

  GitOps -. desired state .-> Argo
  Argo -->|reconciles overlay| Policy
  Policy -->|admits compliant resources| Workload
  Argo -->|reconciles claims and definitions| CP
  Crossplane -. definitions .-> CP
  Kyverno -. policies .-> Policy
  CP -->|requires configured IRSA| AWS[(AWS managed resources)]
  RegistryImage --> Workload
Loading

Responsibility boundaries

Component Responsibility Operational handoff
Nexus IDP Generates service repositories and writes service registration and infrastructure claim intent. Its implementation lives elsewhere. Hands Git-backed intent to generated repositories and the fleet registry for review and reconciliation.
Generated repositories Own application code, Dockerfiles, service manifests, environment overlays, and calls to the reusable workflows. Registered examples include claims-api, audit-api, jest-api, score-api, and system-api. Publish artifacts and environment-specific desired state through the platform contracts.
platform-core Owns reusable CI contracts, policy bundles, cluster bootstrap desired state, infrastructure APIs, templates, and validation scripts. Supplies shared contracts while service repositories retain business logic and service configuration.
Argo CD Reconciles the root application, platform controllers, policies, and registered service overlays after bootstrap. Reports sync and health from the target cluster.
Crossplane and Kyverno Crossplane turns claims into managed AWS resources; Kyverno evaluates admission and produces policy reports. Report provider readiness, resource conditions, admission decisions, and policy results from the target environment.

The repository's deployable path begins at gitops/argocd/bootstrap/root-app.yaml, which follows main and loads the app-of-apps. The app-of-apps discovers platform controller applications and the three environment-specific ApplicationSets. Crossplane example claims under crossplane/examples are deliberately outside this path and remain inactive until copied into a GitOps-synced service overlay.

Reusable workflow contracts

All four reusable workflows use on.workflow_call. A called workflow checks out the caller's repository unless a step explicitly selects another repository. None of the workflows currently declares an output, so callers must construct image references or release metadata from the same inputs they supplied.

Workflow Inputs Secrets Declared permissions Contract and assumptions
reusable-build-sign.yaml Required: service_name, dockerhub_namespace, image_tag. Optional: dockerfile_path (Dockerfile), context_path (.). Required: DOCKERHUB_USERNAME, DOCKERHUB_TOKEN. Optional pair: COSIGN_PRIVATE_KEY, COSIGN_PASSWORD. contents: read, id-token: write, packages: write Builds and pushes docker.io/<namespace>/<service>:<tag> with Buildx, provenance, and SBOM enabled; then signs it. With no private key it uses GitHub OIDC keyless signing. The caller must make Docker Hub credentials available and grant OIDC permission.
reusable-scan.yaml Required: image_ref. Optional: scan_path (.). None declared. contents: read, security-events: write Runs Trivy filesystem and image scans, uploads SARIF, and fails on critical, fixed image vulnerabilities. The image must be readable without a login; high-severity findings and the first SARIF-producing scans do not fail the job. GitHub code scanning must accept SARIF for uploads to succeed.
reusable-policy-check.yaml Optional: manifest_path (.). None declared. contents: read Installs kubeconform 0.6.7 and conftest 0.56.0; renders a directory containing kustomization.yaml, otherwise scans the path directly. It checks schemas and the OPA bundle. Missing CRD schemas are ignored. Its second checkout selects platform-core without a ref, so policy content follows this repository's default branch even if the caller pins the workflow file.
reusable-release.yaml Required: artifact_name, version. None declared; uses the caller's GITHUB_TOKEN. contents: write Archives the caller checkout as <artifact_name>-<version>.tar.gz and publishes it to the GitHub release/tag named by version. The caller must permit write access to repository contents.

Permissions can only be maintained or reduced across a reusable-workflow call. A caller therefore needs to grant the permissions required by the called job; organization and repository policy may reduce them further.

Generated-service integration example

This example maps secrets explicitly and reconstructs the image reference because the build workflow has no declared output. Put it in a generated service repository, for example .github/workflows/platform-ci.yaml:

name: Platform CI

on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read
  id-token: write
  packages: write
  security-events: write

jobs:
  policy:
    uses: ohanyere/platform-core/.github/workflows/reusable-policy-check.yaml@main
    with:
      manifest_path: k8s

  build:
    if: github.event_name == 'push'
    uses: ohanyere/platform-core/.github/workflows/reusable-build-sign.yaml@main
    with:
      service_name: claims-api
      dockerhub_namespace: ohanyere
      image_tag: ${{ github.sha }}
      dockerfile_path: Dockerfile
      context_path: .
    secrets:
      DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
      DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

  scan:
    if: github.event_name == 'push'
    needs: build
    uses: ohanyere/platform-core/.github/workflows/reusable-scan.yaml@main
    with:
      image_ref: docker.io/ohanyere/claims-api:${{ github.sha }}
      scan_path: .

The caller does not pass the optional Cosign key secrets, so this example takes the keyless OIDC path. If the image is private, the scan workflow as written has no registry-login step and needs a separate access strategy before it can scan that image.

About @main

The repository's existing examples and GitOps sources use @main or targetRevision: main. This is convenient for receiving platform changes immediately, but it is a moving reference: the same caller commit can execute different workflow or policy content over time. It also increases the blast radius of an incompatible platform change.

Without changing the current references, consumers can choose one of these versioning policies:

  • Pin a full commit SHA for immutable execution, for example @a85f3fc7da30fbeb96aeb140a178adef3c6c63f7; update it through reviewed dependency PRs.
  • Pin a release tag after this repository starts publishing reviewed tags. Tags are readable, but branch protection does not make a tag immutable; protect the release process accordingly.
  • Maintain a reviewed major-version tag such as @v1 for controlled compatibility, accepting that the tag itself moves.

Even a workflow SHA does not fully pin reusable-policy-check.yaml today because that workflow separately checks out ohanyere/platform-core at its default branch. Nexus pinning enforcement is not present in this repository and is not assumed here.

Platform capabilities

Infrastructure APIs with Crossplane

crossplane/xrd defines five platform-facing claim types, with AWS implementations under crossplane/compositions:

Claim API AWS resources in the composition
PostgreSQLInstance RDS Instance
ObjectBucket S3 Bucket and BucketVersioning
MessageQueue SQS Queue
RedisInstance ElastiCache Cluster
DynamoDBTable DynamoDB Table

The GitOps bootstrap installs Crossplane, six Upbound AWS provider packages, the XRDs, compositions, and the shared ProviderConfig. The provider uses IRSA. A target EKS cluster still needs a real OIDC trust relationship and IAM role; the checked-in runtime configuration contains a placeholder account ID. terraform/crossplane-aws-irsa defines that external IAM prerequisite, but running it is an environment operation, not part of local validation.

Claims under crossplane/examples are examples only. The readiness SQS claim has deletionPolicy: Delete and must not be applied until provider health, credentials, region, ownership, and cleanup have been reviewed.

Policy and supply-chain controls

  • policies/opa contains Rego checks and unit tests for required labels, immutable image tags, and privileged containers. The reusable policy workflow executes these checks before deployment.
  • policies/kyverno contains ten ClusterPolicy manifests for FinOps labels, explicit non-latest tags, resource requests and limits, non-root and read-only containers, privileged mode, probes, NetworkPolicy posture, Crossplane claim metadata, and image signatures. Nine are Enforce; the namespace NetworkPolicy rule is Audit.
  • reusable-build-sign.yaml signs pushed images with Cosign. verify-signed-images.yaml verifies keyless GitHub Actions identities for platform-owned Docker Hub images. The optional private-key signing fallback is not covered by a corresponding public-key admission rule.
  • reusable-scan.yaml provides Trivy filesystem/image scanning and SARIF upload. Its final gate is limited to fixed critical image findings.

OPA is a CI policy engine here; Kyverno is the intended in-cluster admission and reporting engine. Neither bundle is evidence of enforcement until its workflow runs or its controller has reconciled the policies in a target cluster.

GitOps and application delivery

  • root-app.yaml and app-of-apps.yaml define automated prune/self-heal reconciliation from main.
  • gitops/bootstrap/platform declares Argo Rollouts, Istio base/control plane, Crossplane plus providers/definitions, and Kyverno plus policies. Helm chart version ranges are broad rather than locked to exact releases.
  • idp-managed-services.yaml generates dev, stage, and prod Applications from the Git-file registry. The checked-in registry currently names five services across all three environments.
  • gitops/argocd/appprojects limits source repositories and destinations for platform, IDP-managed, and team projects.
  • progressive-delivery/analysis-templates supplies Prometheus-backed Argo Rollouts checks for error rate, HTTP 5xx rate, P95 latency, and success rate. Queries may need adaptation to the target telemetry schema.
  • gitops/istio supplies strict mTLS, gateway, routing, and destination-rule defaults. The platform bootstrap installs Istio base and istiod, but not an ingress gateway workload.

Argo CD itself must already exist before the root application is applied. scripts/install-argocd.sh only checks prerequisites and prints example commands; it does not mutate a cluster.

Observability, security, and FinOps defaults

Area Included definitions Operational boundary
Observability Prometheus platform rules and service templates, a /metrics ServiceMonitor template, Loki/Promtail values, and four starter Grafana dashboards. These directories are not referenced by the current Argo CD bootstrap. Required CRDs/controllers, explicit installation, and environment-specific data sources remain external. Dashboards are intentionally starter definitions.
FinOps Required cost labels, namespace-to-team/cost-center mapping, budget templates and thresholds, Kubecost values/alerts, and an advisory rightsizing template. The Kyverno label policy is wired separately; budget, Kubecost, mapping, and rightsizing files are not installed by the current bootstrap and require external controllers, data, and review.
Secrets Vault configuration/policies plus External Secrets ClusterSecretStore and service template. Vault and External Secrets Operator installation, endpoints, tokens, and production hardening are external. The Kubernetes auth Job is explicitly an example.
Networking and certificates Istio routing/security manifests and a Let's Encrypt ClusterIssuer. DNS, ingress, cert-manager installation, issuer email, and environment approval remain external.
Packaging A minimal charts/platform-core Helm chart scaffold. It does not replace the Argo CD bootstrap path or prove a packaged release exists.

Getting started

Prerequisites

Local static validation does not require a cloud account or Kubernetes connection.

  • Required: GNU Make and Bash.
  • Required for dashboard JSON validation: Python 3 or jq (Python is preferred by the script when both exist).
  • Optional deeper checks: yamllint, conftest, and kubeconform. Missing optional tools are reported and skipped.
  • Required only for reviewed cluster/bootstrap work: kubectl and Helm. Terraform is required only for provisioning the AWS IRSA role. Those operations are intentionally outside the local workflow below.
git clone https://github.com/ohanyere/platform-core.git
cd platform-core

# Entire offline validation suite
make validate

No local command above contacts AWS or a Kubernetes API. Before any real bootstrap, review GitOps, Crossplane, the current kubectl context, repository URLs, placeholder values, and cloud identity.

Validation

The Make targets are composable and safe to run without a live cluster:

# OPA tests when conftest exists; Kyverno YAML lint when yamllint exists
make validate-policies

# Crossplane manifest schemas when kubeconform exists
make validate-crossplane

# GitOps/Kubernetes schemas when kubeconform exists, plus dashboard JSON
make validate-gitops

# All targets above, documentation presence, and shell syntax
make validate

kubeconform is invoked with -ignore-missing-schemas, so a successful run does not fully validate custom-resource schemas. The repository workflow validate-pr.yaml installs shellcheck and jq, then runs make validate; it does not install the three optional deep-validation tools. shellcheck is currently installed by CI but is not invoked by the Makefile.

For environment-specific, read-only verification commands after an authorized deployment, see Crossplane provider readiness and Kyverno PolicyReports. They are not part of offline validation.

Engineering evidence and validation

Documented historical runtime tests

platform-core has been exercised as part of an AWS-backed Nexus IDP workflow spanning generated repositories, reusable CI, GitOps promotion, and infrastructure requests. Public artifacts from that testing include:

These records document prior integrated use of the delivery path. They are historical evidence, not a statement that the same cluster, AWS resources, credentials, or controllers remain active today.

Current verification status

This README revision verified repository content and the linked public GitHub history. It did not query an AWS account, Kubernetes API, Argo CD instance, Crossplane provider, or container registry, so no current infrastructure-running claim is made.

Capability Current repository contract Current verification path
Repository CI Five workflow files under .github/workflows Run make validate; use the header badge and public workflow history for the current hosted result. Historical passing runs remain available, including run 28385590592.
Generated-service CI Reusable build/sign, Trivy scan, OPA policy, and release workflows Inspect the caller's run for image publication, signature, scan, SARIF, and policy results. The linked historical runs above show this integration operating; a new caller run is required for current verification.
Argo CD and fleet delivery Root/app-of-apps, projects, platform Applications, three ApplicationSets, and environment registries Check current Application sync/health, revision, Rollout state, and workload health in the authorized target environment.
Crossplane on AWS Five XRDs and AWS compositions, provider packages, IRSA runtime config, Terraform IAM module, and claim examples Check provider health and identity, claim/composite/managed-resource conditions, and the corresponding AWS resource. The linked historical infrastructure workflow records do not substitute for a current provider or AWS query.
Kyverno and OPA Ten Kyverno policies plus three OPA modules with unit tests and reusable-workflow integration Run conftest verify policies/opa; inspect current ClusterPolicy, PolicyReport, and ClusterPolicyReport resources for cluster enforcement.
Observability / FinOps / secrets Templates and defaults described above Validate dashboard JSON and manifests locally, then inspect the relevant controllers, data sources, reports, and secret integrations in the target environment.

Known limitations

  • Hosted workflow status can change independently of this document; use the badge and linked run history for the current result.
  • Local scripts return success when optional validators are absent, while clearly printing skipped stages. A zero exit code is therefore not equivalent to complete policy/schema coverage.
  • main is a moving reference in reusable-workflow examples and Argo CD sources. Several Helm sources use version ranges rather than exact versions.
  • The Crossplane runtime configuration contains a placeholder AWS account ID. No AWS account or EKS cluster was accessed for this documentation update, and no current live-resource claim is made.
  • Crossplane examples are inactive. Nexus automation that writes claims into service repositories is outside this repository.
  • Key-backed Cosign signing is supported by CI, but the checked-in Kyverno rule verifies the keyless GitHub Actions identity path only.
  • The policy-check workflow ignores missing CRD schemas and follows default-branch policy content independently of the caller's workflow reference.
  • Definitions for monitoring, cost management, Vault, External Secrets, cert-manager, and ingress depend on controllers and environment configuration not fully bootstrapped here.
  • The root Application selects the platform AppProject, while that AppProject is itself below the child app-of-apps path. A fresh Argo CD installation must ensure the project exists before the root can reconcile; the repository does not automate that bootstrap dependency.

Repository layout

.github/workflows/       Reusable CI contracts and repository validation
crossplane/              XRDs, AWS compositions/providers, and inactive claims
gitops/                  Argo CD bootstrap, platform controllers, fleet registry
policies/                Kyverno admission and OPA/Conftest policy
progressive-delivery/    Argo Rollouts AnalysisTemplates
observability/           Prometheus, Loki, Promtail, and Grafana defaults
finops/                  Labels, mappings, budgets, Kubecost, rightsizing
security/                Vault and External Secrets templates
terraform/               AWS IRSA prerequisite for Crossplane providers
charts/                  Minimal platform-core Helm scaffold
scripts/                 Offline validation and non-mutating bootstrap helpers
docs/                    Architecture and operating guides

Documentation map

Contributing changes

Keep shared controls generic and keep service-specific configuration in the generated service repository. For changes to workflows, policies, or infrastructure APIs:

  1. Document the caller or platform contract and compatibility impact.
  2. Add or update the smallest relevant offline test or example.
  3. Run make validate with the optional validators available when possible.
  4. Open a pull request and review generated-service and target-environment implications before merging.

Do not commit credentials, live account identifiers, generated secrets, or evidence that contains sensitive runtime data.

About

Reusable CI/CD workflows, infrastructure definitions, and policy-as-code for internal developer platforms.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages