Post by Project Sveltos

818 followers

Static ClusterProfiles handle the steady-state well: deploy these add-ons to these clusters. But some deployment needs are dynamic, they depend on what's ๐˜ฉ๐˜ข๐˜ฑ๐˜ฑ๐˜ฆ๐˜ฏ๐˜ช๐˜ฏ๐˜จ inside the cluster at runtime. Sveltos Event Framework handles this with two resources: ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜๐—ฆ๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ (what to watch) and ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜๐—ง๐—ฟ๐—ถ๐—ด๐—ด๐—ฒ๐—ฟ (what to do). ๐—ฆ๐—ฐ๐—ฒ๐—ป๐—ฎ๐—ฟ๐—ถ๐—ผ: every time a new namespace is created with label ๐˜ต๐˜ฆ๐˜ข๐˜ฎ: ๐˜ฃ๐˜ข๐˜ค๐˜ฌ๐˜ฆ๐˜ฏ๐˜ฅ, automatically deploy a NetworkPolicy isolating that namespace. ๐—ฆ๐˜๐—ฒ๐—ฝ ๐Ÿญ โ€” ๐—ฑ๐—ฒ๐—ณ๐—ถ๐—ป๐—ฒ ๐˜๐—ต๐—ฒ ๐—ฒ๐˜ƒ๐—ฒ๐—ป๐˜: ```yaml apiVersion: https://lnkd.in/dA3iUwVH kind: EventSource metadata: ย name: new-backend-namespace spec: ย collectResources: true ย resourceSelectors: ย - group: "" ย ย  version: v1 ย ย  kind: Namespace ย ย  labelFilters: ย ย  - key: team ย ย ย  operation: Equal ย ย ย  value: backend ``` ๐—ฆ๐˜๐—ฒ๐—ฝ ๐Ÿฎ โ€” ๐—ฑ๐—ฒ๐—ณ๐—ถ๐—ป๐—ฒ ๐˜๐—ต๐—ฒ ๐—ฟ๐—ฒ๐˜€๐—ฝ๐—ผ๐—ป๐˜€๐—ฒ: ```yaml apiVersion: https://lnkd.in/dA3iUwVH kind: EventTrigger metadata: ย name: isolate-backend-namespace spec: ย eventSourceName: new-backend-namespace ย sourceClusterSelector: ย ย  matchLabels: ย ย ย  env: production ย policyRefs: ย - kind: ConfigMap ย ย  name: backend-network-policy ย  ย namespace: projectsveltos ย oneForEvent: false ``` The ConfigMap ๐˜ฃ๐˜ข๐˜ค๐˜ฌ๐˜ฆ๐˜ฏ๐˜ฅ-๐˜ฏ๐˜ฆ๐˜ต๐˜ธ๐˜ฐ๐˜ณ๐˜ฌ-๐˜ฑ๐˜ฐ๐˜ญ๐˜ช๐˜ค๐˜บ holds the NetworkPolicy manifest, which can itself use templates referencing the triggering namespace: {{ .๐˜™๐˜ฆ๐˜ด๐˜ฐ๐˜ถ๐˜ณ๐˜ค๐˜ฆ.๐˜ฎ๐˜ฆ๐˜ต๐˜ข๐˜ฅ๐˜ข๐˜ต๐˜ข.๐˜ฏ๐˜ข๐˜ฎ๐˜ฆ }}. When the EventSource fires, Sveltos automatically generates a ClusterProfile scoped to that specific event. No manual reconciliation loop, no custom controller, no Operator SDK. For more complex matching logic, the EventSource evaluation block accepts ๐—Ÿ๐˜‚๐—ฎ ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฝ๐˜๐˜€ or ๐—–๐—˜๐—Ÿ ๐—ฒ๐˜…๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€๐—ถ๐—ผ๐—ป๐˜€โ€” enabling conditions on arbitrary resource fields, cross-field comparisons, or stateful evaluation across multiple resources. The event framework turns cluster state into a trigger. The ClusterProfile machinery handles the rest. https://lnkd.in/dT7cW4jq #Kubernetes #MultiCluster #EventDriven #PlatformEngineering #CloudNative #OpenSource

Post content