Skip to content

Instantly share code, notes, and snippets.

@aojea
Last active January 22, 2024 07:42
Show Gist options
  • Save aojea/11067c3993c8f42c9359035e68a81a71 to your computer and use it in GitHub Desktop.
Save aojea/11067c3993c8f42c9359035e68a81a71 to your computer and use it in GitHub Desktop.
Diagrams for KEP-1880: Services IP Ranges
classDiagram
class Service{
ClusterIP string
ClusterIPs []string
IPFamilies []IPFamily
IPFamilyPolicy *IPFamilyPolicyType
}
class ServiceCIDR{
Name string
CIDR string
}
class IPAddress{
Name string
Ref objRef
}
Service "1" <|--|> "1" IPAddress: "allocates"
ServiceCIDR "1" <|--|> "N" IPAddress: "generates"
graph TD
A[Boot] --> J(read service-cidr flags) --> M{valid flags?}
M -- no -------> Z[Fatal]
M -- yes --> B(Get ServiceCIDRs)
B -- wait.Until --> B
B -- yes --> C{default exist?}
B -- error --> Z
C -- yes --> D{match flags?}
D -- yes --> G[Run]
D -- no --> E{overlaps?}
E -- yes --> G[Run]
E -- no --> H
C -- no --> H
B -- no --> H
H[Create ServiceCIDR] --> G[Run]
sequenceDiagram
actor B as Delete ServiceCIDR
participant C as apiserver A
participant D as apiserver B
actor A as Create Service
B ->>+C: Delete ServiceCIDR 192.168.0.0/24
A ->> D: Create Service
note over D: allocate 192.168.0.12
D ->> A: Service Created
C ->>-B: ServiceCIDR deleted
C -->> D: 192.168.0.0/24 deleted
note over A: Service IP without ServiceCIDR
sequenceDiagram
actor A as Create Service
participant BeginCreate
participant BeforeCreate
participant APIValidation
participant StorageCreation
participant FinishCreate
participant Decorator
A ->> BeginCreate: Create Service
note over BeginCreate: Initialize IP Family fields
note over BeginCreate: Allocate ClusterIPs
BeginCreate -->> BeforeCreate: strategy
note over BeforeCreate: PrepareForCreate
note over BeforeCreate: Drop disabled fields
BeforeCreate -->> APIValidation: validation
APIValidation -->> StorageCreation: etcd
alt success
StorageCreation -->> Decorator: finish
Decorator ->> A:
else fail
StorageCreation -->> FinishCreate: revert
note over FinishCreate: release ClusterIPs if error
FinishCreate ->> A:
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment