πŸ”§ DevOps

Internal Developer Platform

IDP, Internal Developer Platform

An internal platform that lets developers set up environments, deploy, and monitor in a self-service way without infrastructure complexity, and a core deliverable of Platform Engineering.

πŸ“– Detailed Explanation

An Internal Developer Platform (IDP) is an internal platform that provides self-service capabilities so that developers in an organization can build, deploy, and operate applications without infrastructure expertise. Gartner forecasts that 80% of software engineering organizations will have established platform teams by 2026, and the IDP is the core deliverable of this Platform Engineering.

The core value of an IDP is improving Developer Experience (DX). Developers do not need to understand infrastructure details such as Kubernetes, Terraform, and networking; through an abstracted interface they perform tasks like "create a Python service," "provision a database," and "deploy to the staging environment." This reduces cognitive load and lets developers focus on business logic.

The main components of an IDP include a service catalog (a list of all services, APIs, and infrastructure resources in the organization), a self-service portal (automated workflows for creating environments, deploying, rolling back, etc.), golden paths (proven tech stacks and templates), and observability integration (dashboards for logging, metrics, and tracing). Spotify's Backstage is a representative open-source IDP framework.

A common mistake when building an IDP is trying to create a perfect platform from the start. A successful IDP starts as an MVP and expands gradually based on developer feedback. Close collaboration between the platform team and development teams is also essential, and a Product Thinking approach that manages "the platform as a product" is important.

πŸ’» Code Example

Backstage service template example (YAML)

# Backstage Software Template - μƒˆ λ§ˆμ΄ν¬λ‘œμ„œλΉ„μŠ€ 생성
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: python-fastapi-service
  title: Python FastAPI λ§ˆμ΄ν¬λ‘œμ„œλΉ„μŠ€
  description: FastAPI 기반 λ§ˆμ΄ν¬λ‘œμ„œλΉ„μŠ€λ₯Ό μƒμ„±ν•˜κ³  Kubernetes에 λ°°ν¬ν•©λ‹ˆλ‹€
  tags:
    - python
    - fastapi
    - kubernetes
spec:
  owner: platform-team
  type: service

  # 개발자 μž…λ ₯ νŒŒλΌλ―Έν„°
  parameters:
    - title: μ„œλΉ„μŠ€ 정보
      required:
        - serviceName
        - team
      properties:
        serviceName:
          title: μ„œλΉ„μŠ€ 이름
          type: string
          description: 영문 μ†Œλ¬Έμž, ν•˜μ΄ν”ˆλ§Œ μ‚¬μš©
          pattern: '^[a-z][a-z0-9-]*$'
        team:
          title: λ‹΄λ‹Ή νŒ€
          type: string
          ui:field: OwnerPicker
          ui:options:
            allowedKinds:
              - Group
        description:
          title: μ„œλΉ„μŠ€ μ„€λͺ…
          type: string

    - title: 인프라 μ˜΅μ…˜
      properties:
        database:
          title: λ°μ΄ν„°λ² μ΄μŠ€
          type: string
          enum:
            - none
            - postgresql
            - mongodb
          default: none
        cache:
          title: μΊμ‹œ
          type: string
          enum:
            - none
            - redis
          default: none
        environment:
          title: 초기 ν™˜κ²½
          type: array
          items:
            type: string
            enum:
              - development
              - staging
              - production
          default:
            - development

  # μžλ™ν™” 단계
  steps:
    # 1. ν…œν”Œλ¦Ώμ—μ„œ μ½”λ“œ 생성
    - id: fetch-template
      name: ν”„λ‘œμ νŠΈ ν…œν”Œλ¦Ώ κ°€μ Έμ˜€κΈ°
      action: fetch:template
      input:
        url: ./skeleton
        values:
          serviceName: ${{ parameters.serviceName }}
          team: ${{ parameters.team }}
          description: ${{ parameters.description }}
          database: ${{ parameters.database }}

    # 2. GitHub μ €μž₯μ†Œ 생성
    - id: create-repo
      name: GitHub μ €μž₯μ†Œ 생성
      action: publish:github
      input:
        repoUrl: github.com?owner=my-org&repo=${{ parameters.serviceName }}
        description: ${{ parameters.description }}
        defaultBranch: main
        protectDefaultBranch: true

    # 3. Kubernetes λ¦¬μ†ŒμŠ€ 생성
    - id: create-k8s-resources
      name: Kubernetes λ„€μž„μŠ€νŽ˜μ΄μŠ€ 및 λ¦¬μ†ŒμŠ€ 생성
      action: kubernetes:apply
      input:
        manifest:
          apiVersion: v1
          kind: Namespace
          metadata:
            name: ${{ parameters.serviceName }}
            labels:
              team: ${{ parameters.team }}

    # 4. ArgoCD μ• ν”Œλ¦¬μΌ€μ΄μ…˜ 등둝
    - id: register-argocd
      name: ArgoCD μ•± 등둝
      action: argocd:create-app
      input:
        appName: ${{ parameters.serviceName }}
        repoUrl: ${{ steps['create-repo'].output.remoteUrl }}
        path: k8s/
        targetNamespace: ${{ parameters.serviceName }}

    # 5. λ°μ΄ν„°λ² μ΄μŠ€ ν”„λ‘œλΉ„μ €λ‹ (μ„ νƒν•œ 경우)
    - id: provision-database
      name: λ°μ΄ν„°λ² μ΄μŠ€ ν”„λ‘œλΉ„μ €λ‹
      if: ${{ parameters.database != 'none' }}
      action: crossplane:create
      input:
        apiVersion: database.example.com/v1alpha1
        kind: ${{ parameters.database == 'postgresql' && 'PostgreSQLInstance' || 'MongoDBInstance' }}
        metadata:
          name: ${{ parameters.serviceName }}-db
        spec:
          size: small
          version: latest

    # 6. Backstage μΉ΄νƒˆλ‘œκ·Έμ— 등둝
    - id: register-catalog
      name: μ„œλΉ„μŠ€ μΉ΄νƒˆλ‘œκ·Έ 등둝
      action: catalog:register
      input:
        repoContentsUrl: ${{ steps['create-repo'].output.repoContentsUrl }}
        catalogInfoPath: /catalog-info.yaml

  # μ™„λ£Œ ν›„ 좜λ ₯
  output:
    links:
      - title: GitHub μ €μž₯μ†Œ
        url: ${{ steps['create-repo'].output.remoteUrl }}
      - title: ArgoCD λŒ€μ‹œλ³΄λ“œ
        url: https://argocd.example.com/applications/${{ parameters.serviceName }}
      - title: μ„œλΉ„μŠ€ μΉ΄νƒˆλ‘œκ·Έ
        url: ${{ steps['register-catalog'].output.entityRef }}

Implementing an IDP API client in Python

"""
IDP(Internal Developer Platform) μ…€ν”„μ„œλΉ„μŠ€ API ν΄λΌμ΄μ–ΈνŠΈ
κ°œλ°œμžκ°€ ν”„λ‘œκ·Έλž˜λ§€ν‹±ν•˜κ²Œ λ¦¬μ†ŒμŠ€λ₯Ό 생성/관리할 수 μžˆλŠ” μΈν„°νŽ˜μ΄μŠ€
"""
import httpx
from dataclasses import dataclass
from typing import Optional, List
from enum import Enum

class DatabaseType(Enum):
    POSTGRESQL = "postgresql"
    MONGODB = "mongodb"
    REDIS = "redis"

class EnvironmentType(Enum):
    DEVELOPMENT = "development"
    STAGING = "staging"
    PRODUCTION = "production"

@dataclass
class ServiceConfig:
    name: str
    team: str
    description: str
    language: str = "python"
    database: Optional[DatabaseType] = None
    cache: bool = False
    environments: List[EnvironmentType] = None

    def __post_init__(self):
        if self.environments is None:
            self.environments = [EnvironmentType.DEVELOPMENT]

class IDPClient:
    """IDP μ…€ν”„μ„œλΉ„μŠ€ API ν΄λΌμ΄μ–ΈνŠΈ"""

    def __init__(self, base_url: str, api_token: str):
        self.base_url = base_url
        self.client = httpx.Client(
            base_url=base_url,
            headers={"Authorization": f"Bearer {api_token}"},
            timeout=30.0
        )

    def create_service(self, config: ServiceConfig) -> dict:
        """μƒˆ λ§ˆμ΄ν¬λ‘œμ„œλΉ„μŠ€ 생성 (μ €μž₯μ†Œ, K8s λ¦¬μ†ŒμŠ€, CI/CD 포함)"""
        payload = {
            "templateName": f"{config.language}-service-template",
            "parameters": {
                "serviceName": config.name,
                "team": config.team,
                "description": config.description,
                "database": config.database.value if config.database else "none",
                "cache": "redis" if config.cache else "none",
                "environments": [env.value for env in config.environments]
            }
        }

        response = self.client.post("/api/scaffolder/v1/tasks", json=payload)
        response.raise_for_status()

        task = response.json()
        print(f"μ„œλΉ„μŠ€ 생성 μž‘μ—… μ‹œμž‘: {task['id']}")
        return task

    def get_task_status(self, task_id: str) -> dict:
        """μ„œλΉ„μŠ€ 생성 μž‘μ—… μƒνƒœ 쑰회"""
        response = self.client.get(f"/api/scaffolder/v1/tasks/{task_id}")
        response.raise_for_status()
        return response.json()

    def list_services(self, team: Optional[str] = None) -> List[dict]:
        """μ„œλΉ„μŠ€ μΉ΄νƒˆλ‘œκ·Έ 쑰회"""
        params = {"filter": "kind=Component"}
        if team:
            params["filter"] += f",metadata.annotations.team={team}"

        response = self.client.get("/api/catalog/entities", params=params)
        response.raise_for_status()
        return response.json()

    def deploy_service(
        self,
        service_name: str,
        environment: EnvironmentType,
        version: str
    ) -> dict:
        """μ„œλΉ„μŠ€λ₯Ό νŠΉμ • ν™˜κ²½μ— 배포"""
        payload = {
            "serviceName": service_name,
            "environment": environment.value,
            "version": version,
            "strategy": "rolling"  # or "blue-green", "canary"
        }

        response = self.client.post("/api/deployments", json=payload)
        response.raise_for_status()
        return response.json()

    def get_service_metrics(self, service_name: str) -> dict:
        """μ„œλΉ„μŠ€ λ©”νŠΈλ¦­ 쑰회 (κ΄€μ°°μ„± 톡합)"""
        response = self.client.get(
            f"/api/observability/services/{service_name}/metrics"
        )
        response.raise_for_status()
        return response.json()

    def provision_database(
        self,
        service_name: str,
        db_type: DatabaseType,
        size: str = "small"
    ) -> dict:
        """λ°μ΄ν„°λ² μ΄μŠ€ μ…€ν”„μ„œλΉ„μŠ€ ν”„λ‘œλΉ„μ €λ‹"""
        payload = {
            "serviceName": service_name,
            "databaseType": db_type.value,
            "size": size,  # small, medium, large
            "backup": True,
            "encryption": True
        }

        response = self.client.post("/api/databases", json=payload)
        response.raise_for_status()
        return response.json()


# μ‚¬μš© μ˜ˆμ‹œ
if __name__ == "__main__":
    # IDP ν΄λΌμ΄μ–ΈνŠΈ μ΄ˆκΈ°ν™”
    idp = IDPClient(
        base_url="https://developer-portal.example.com",
        api_token="your-api-token"
    )

    # μƒˆ μ„œλΉ„μŠ€ 생성
    config = ServiceConfig(
        name="order-service",
        team="commerce-team",
        description="μ£Όλ¬Έ 처리 λ§ˆμ΄ν¬λ‘œμ„œλΉ„μŠ€",
        language="python",
        database=DatabaseType.POSTGRESQL,
        cache=True,
        environments=[
            EnvironmentType.DEVELOPMENT,
            EnvironmentType.STAGING
        ]
    )

    task = idp.create_service(config)
    print(f"μ„œλΉ„μŠ€ 생성 쀑... Task ID: {task['id']}")

    # μž‘μ—… μƒνƒœ 확인
    status = idp.get_task_status(task["id"])
    print(f"μƒνƒœ: {status['status']}")

    # νŒ€μ˜ λͺ¨λ“  μ„œλΉ„μŠ€ 쑰회
    services = idp.list_services(team="commerce-team")
    for svc in services:
        print(f"- {svc['metadata']['name']}: {svc['spec']['lifecycle']}")

πŸ—£οΈ How It's Said in Practice

Platform engineer "Every time a dev team creates a new service, opening a DevOps ticket and waiting is a bottleneck. What if we adopt an IDP and switch to self-service?"
CTO "Do you mean something like Backstage? Would it pay off at our scale?"
Platform engineer "We can start small. First build a service catalog and basic templates, then expand gradually while collecting developer feedback. Even just cutting onboarding time in half is worthwhile."
Interviewer "What do you think is the difference between Platform Engineering and DevOps?"
Candidate "DevOps is a culture of collaboration between development and operations, while Platform Engineering builds the internal platform (IDP) that enables that collaboration, like a product. It treats developers as internal customers and provides self-service interfaces that reduce their cognitive load. Ultimately the goal is the same, but I see Platform Engineering as a more systematic approach."

Take a mock interview on this topic β†’ WIA SOOM AI Interview Β· Start for free

Reviewer "In this Backstage template, database provisioning is synchronous. Wouldn't it time out if it takes a long time?"
Author "Good point. I'll change it to only create the Crossplane Claim and handle the actual Ready-state check asynchronously. For the developer, we'll show a 'provisioning' status and send a Slack notification on completion."

⚠️ Cautions

  • Avoid over-abstraction: If an IDP hides everything, developers lose the ability to solve problems. Provide an "escape hatch" that allows access to lower layers when needed.
  • Collect developer feedback: Manage the IDP like a product. Reflect real needs through regular user interviews, satisfaction surveys, and usage metrics analysis.
  • Build incrementally: Don't try to build a perfect platform from the start. Begin with an MVP that solves the biggest bottleneck and evolve it through fast feedback loops.

πŸ“š Learn More