Component C96, C100 – CodeSource

By Raj Marni. March 26, 2025. Revised. Version: 0.0.01

1. Overview

CodeSource serves as the central hub for managing source code (GitLab) and Docker images (DockerHub), providing an integrated solution for automated builds, CI/CD pipelines, and Kubernetes deployment synchronization. It ensures version consistency, streamlines deployment workflows, and helps maintain security and compliance across multiple environments. By consolidating these two essential components, CodeSource reduces complexity, increases automation, and improves the reliability and scalability of application delivery within the k8or Orbit ecosystem.

Orbit Component C96 C100 Diagram

2. Internal Architecture

2.1 Core Modules

  1. Docker Image Management (C96 – DockerHub)

    • Function: Manages the lifecycle of container images stored in DockerHub (C96).

    • Process:

      • Image Storage: Pushes and pulls Docker images from DockerHub.

      • Versioning & Tagging: Ensures proper version control by tagging images and maintaining versions for rollbacks.

      • Image Updates: Monitors for changes to the Docker image definitions in GitLab (C100) and triggers image updates accordingly.

    • Communication:

      • DockerHub API interacts with GitLab to pull code updates that trigger image builds.

  2. Git Repository Management (C100 – GitLab App Repo)

    • Function: Manages the source code repositories and configuration files stored in GitLab (C100).

    • Process:

      • Source Code Management: Stores the application source code, manifests, Helm charts, and Kubernetes configurations in GitLab.

      • CI/CD Integration: Works with CI/CD pipelines to trigger automatic builds and deployments based on code changes.

      • Version Control: Maintains versioning and updates of source code, ensuring consistency across environments.

    • Communication:

      • GitLab API communicates with DockerHub (C96) to trigger Docker image builds and ensure the synchronization between code changes and image updates.

  3. CI/CD Pipeline Trigger & Orchestrator

    • Function: Orchestrates the CI/CD process for both Docker images and GitLab repositories.

    • Process:

      • The pipeline is automatically triggered when there are code changes or updates in GitLab (C100), which in turn triggers Docker image builds in DockerHub (C96).

      • The process includes build, test, and deploy stages, ensuring that both application code and container images are automatically deployed to the appropriate Kubernetes clusters.

    • Communication:

      • Interacts with CI/CD tools like Jenkins, GitLab CI, or ArgoCD to manage and automate the full lifecycle of builds and deployments.

  4. Artifact Versioning & Metadata Manager

    • Function: Ensures proper versioning and synchronization of Docker images and source code across environments.

    • Process:

      • Ensures that each Docker image and Git repository has a unique identifier and is properly tagged.

      • Synchronizes version metadata between C96 (DockerHub) and C100 (GitLab) to ensure consistency during the build and deployment process.

    • Communication:

      • Metadata Sync: Tracks version numbers, tags, and commit hashes between the Docker images and source code repositories to guarantee that the correct versions are deployed.

  5. Security & Policy Enforcement

    • Function: Enforces security rules and access controls across C96 and C100 components.

    • Process:

      • Ensures that only authorized users or CI/CD processes have access to push/pull Docker images and code.

      • Uses RBAC (Role-Based Access Control) to ensure that deployment pipelines are secure and that only authorized code changes are deployed.

    • Communication:

      • Integrates with external identity providers for secure access control, such as OAuth, GitLab Access Tokens, or DockerHub API keys.


3. Data Flows and Communication Patterns

3.1 Source Code Change Triggers Docker Image Build

  1. Source Code Update in GitLab

    • When a change is made to the GitLab repository (C100), a commit triggers a pipeline in the C108 CI/CD system (ArgoCD).

    • The pipeline component C108 detects the update and triggers the Docker image build process.

  2. Docker Image Build Process

    • The CI/CD pipeline initiates a build for the Docker image stored in DockerHub (C96) using the updated code from GitLab (C100).

    • The Docker image is tagged with the appropriate version number or commit hash and pushed to DockerHub for use in the deployment process.

  3. Versioning & Tagging

    • As part of the build process, both the GitLab code and the Docker image are versioned and tagged consistently to track their deployment states.

    • This ensures that the correct version of the Docker image is deployed, corresponding to the specific version of the source code.

  4. Deployment Trigger

    • Once the Docker image is built and stored in DockerHub, the CI/CD pipeline (ArgoCD) triggers a deployment to the appropriate Kubernetes cluster using the Helm charts or Kubernetes manifests stored in GitLab (C100).


3.2 Synchronization Between CodeSource Components

  1. Metadata Synchronization

    • CodeSource ensures synchronization between the metadata of DockerHub (C96) and GitLab (C100). This metadata includes version information, tags, and commit hashes, which are crucial for ensuring that the Docker image is correctly built and deployed based on the most recent code changes.

  2. CI/CD Feedback Loop

    • The CI/CD system keeps track of changes and provides feedback to the developers. It notifies them when the Docker image is successfully built, when the GitLab repository is updated, or when there are errors in the build or deployment process.

  3. Cluster Deployment

    • Once the images and manifests are synchronized, CodeSource works with ArgoCD (C108) or Kustomize (C28) to deploy the latest version of the Docker image and source code to the Kubernetes clusters. This process ensures that the most recent version of the application is always in sync with the infrastructure configuration.


4. Technology & Protocols

  • GitOps (GitLab):

    • GitLab repositories are used to store and manage source code, configuration files, and Kubernetes manifests. Code changes in GitLab automatically trigger the CI/CD pipeline.

  • Docker Registry (DockerHub):

    • Docker images are stored in DockerHub (C96), which acts as the container registry for CodeSource. Docker images are versioned and tagged for deployment.

  • CI/CD Pipelines:

    • Integration with ArgoCD automates the build, testing, and deployment processes for both Docker images and code repositories.

  • Helm & Kustomize:

    • Helm charts and Kustomize overlays are used to manage Kubernetes deployments, ensuring that configurations are easily configurable for different environments (dev, test, prod).

  • RBAC & IAM:

    • Access control is managed using RBAC policies, ensuring that only authorized users or service accounts can modify code, push images, or deploy applications.


5. Benefits & Impact

  1. Automated & Streamlined CI/CD

    • The integration of DockerHub (C96) and GitLab (C100) streamlines the CI/CD pipeline, allowing for automated image builds, code synchronization, and deployments without manual intervention.

  2. Consistency Across Environments

    • By ensuring that the source code in GitLab and the Docker images in DockerHub are synchronized, CodeSource ensures consistency across different environments (dev, test, prod).

  3. Version Control & Rollback

    • With versioned Docker images and source code commits, teams can easily roll back to previous versions of their application, ensuring quick recovery in case of errors.

  4. Improved Security & Compliance

    • By using RBAC and IAM for access control and tracking all changes, CodeSource ensures that deployment processes are secure and compliant with organizational policies.

Last updated