Urgent.News

What's breaking now, across thousands of outlets.

Tech

Making My Platform API Reconcile Application Updates

In the previous post, I built the first real behavior for Platform Lab. A developer could create: apiVersion : platform.shubforge.dev/v1alpha1 kind : Application metadata : name : greeting-service spec : image : greeting-service:1.0.0 replicas : 1 port : containerPort : 8080 and the Platform Operator would create: Application | v Platform Operator | +------ Deployment | +------ Service That was…

In the previous post, the author built a basic behavior for the Platform Lab. They created an API specification for an Application called "greeting-service", which included details such as image, replicas, and port configurations. This resulted in the creation of Kubernetes resources like a Deployment and a Service. However, the author raised an important question: what happens when the Application changes?

The author explored how to reconcile application updates, ensuring that the platform updates existing resources instead of deleting and recreating them. They used the kubectl patch command to modify the Application's specifications, such as image version, replicas, and port configurations. After updating the Application, the author observed that Kubernetes incremented the metadata.generation field, indicating that the desired Application specification had changed.

The author then examined the controller logic, which relied on the Application's spec to build the desired state of dependent resources like Deployments and Services. When the Application changed, the controller recalculated the desired state of these resources and reconciled them with the actual resources. This approach simplified the controller's implementation, as creation and updates used the same model.

After updating the Application, the author verified the changes in the Deployment and Service resources using kubectl commands. They confirmed that the Deployment had the correct number of replicas, the updated container image, and the specified port configurations. They also verified that the Service used the updated port and targetPort values.

To ensure that the operator was updating existing resources instead of deleting and recreating them, the author captured the Deployment's UID before the update. After applying the changes, the UID remained the same, indicating that the existing resources were updated rather than recreated.

In summary, the author demonstrated that the Platform API could effectively reconcile application updates by updating existing Kubernetes resources instead of recreating them. This approach simplified the controller's implementation and ensured that the platform handled higher-level changes, such as updating the port configuration, with minimal resource modifications.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

GoodFirst : I built my friend a way into open source.

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend What I Built My friend Shivin wanted to get into open source this October. He could code.

  • Shivin created GoodFirst to help friends enter open source.
  • GoodFirst identifies beginner issues and provides CI help.
  • Tool runs on laptop with minimal requirements, no costs.

52 commands, 3 doors: the app, REST and MCP share one write path

My ticket tracker has three ways in: the web app, a REST API and an MCP server. Every write from all three goes through the same 52 commands, and the Firestore rules deny everything else.

  • Three interaction paths (app, REST, MCP) share 52 commands
  • Direct client writes take 50ms, other paths take 150-400ms
  • Shared write path reduces rule duplication and improves efficiency

More from Saturday 3 October →