Skip to content

Commit

Permalink
Add NetworkAttachments
Browse files Browse the repository at this point in the history
From other similar patches: For network isolation outgoing
traffic, service pods need to be attached additional networks.
To achive this, the the `k8s.v1.cni.cncf.io/networks`
annotation needs to be set on the pods. This adds a
networkAttachments parameter to the CRD where it can be
specified to which additional networks the service pods should
be attached to.
  • Loading branch information
cschwede committed Jan 29, 2024
1 parent 77a04df commit 82333df
Show file tree
Hide file tree
Showing 14 changed files with 261 additions and 1 deletion.
17 changes: 17 additions & 0 deletions api/bases/swift.openstack.org_swiftproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: NetworkAttachments
jsonPath: .status.networkAttachments
name: NetworkAttachments
type: string
- description: Status
jsonPath: .status.conditions[0].status
name: Status
Expand Down Expand Up @@ -50,6 +54,12 @@ spec:
containerImageProxy:
description: Swift Proxy Container Image URL
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
items:
type: string
type: array
override:
description: Override, provides the ability to override the generated
manifest of several child resources.
Expand Down Expand Up @@ -310,6 +320,13 @@ spec:
- type
type: object
type: array
networkAttachments:
additionalProperties:
items:
type: string
type: array
description: NetworkAttachments status of the deployment pods
type: object
readyCount:
description: ReadyCount of SwiftProxy instances
format: int32
Expand Down
22 changes: 22 additions & 0 deletions api/bases/swift.openstack.org_swifts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: NetworkAttachments
jsonPath: .status.networkAttachments
name: NetworkAttachments
type: string
- description: Status
jsonPath: .status.conditions[0].status
name: Status
Expand Down Expand Up @@ -44,6 +48,12 @@ spec:
spec:
description: SwiftSpec defines the desired state of Swift
properties:
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
items:
type: string
type: array
storageClass:
default: ""
description: Storage class. This is passed to SwiftStorage unless
Expand All @@ -63,6 +73,12 @@ spec:
containerImageProxy:
description: Swift Proxy Container Image URL
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment
resource names to expose the services to the given network
items:
type: string
type: array
override:
description: Override, provides the ability to override the generated
manifest of several child resources.
Expand Down Expand Up @@ -326,6 +342,12 @@ spec:
containerImageProxy:
description: Image URL for Swift proxy service
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment
resource names to expose the services to the given network
items:
type: string
type: array
replicas:
default: 1
format: int32
Expand Down
17 changes: 17 additions & 0 deletions api/bases/swift.openstack.org_swiftstorages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: NetworkAttachments
jsonPath: .status.networkAttachments
name: NetworkAttachments
type: string
- description: Status
jsonPath: .status.conditions[0].status
name: Status
Expand Down Expand Up @@ -59,6 +63,12 @@ spec:
containerImageProxy:
description: Image URL for Swift proxy service
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
items:
type: string
type: array
replicas:
default: 1
format: int32
Expand Down Expand Up @@ -133,6 +143,13 @@ spec:
- type
type: object
type: array
networkAttachments:
additionalProperties:
items:
type: string
type: array
description: NetworkAttachments status of the deployment pods
type: object
readyCount:
description: ReadyCount of SwiftStorage instances
format: int32
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/swift_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ type SwiftSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:default=""
StorageClass string `json:"storageClass"`

// +kubebuilder:validation:Optional
// NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network
NetworkAttachments []string `json:"networkAttachments,omitempty"`
}

// SwiftStatus defines the observed state of Swift
Expand All @@ -65,6 +69,7 @@ type SwiftStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".status.networkAttachments",description="NetworkAttachments"
//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status"
//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message"

Expand Down
8 changes: 8 additions & 0 deletions api/v1beta1/swiftproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ type SwiftProxySpec struct {
// +kubebuilder:validation:Optional
// Override, provides the ability to override the generated manifest of several child resources.
Override ProxyOverrideSpec `json:"override,omitempty"`

// +kubebuilder:validation:Optional
// NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network
NetworkAttachments []string `json:"networkAttachments,omitempty"`
}

// ProxyOverrideSpec to override the generated manifest of several child resources.
Expand All @@ -88,10 +92,14 @@ type SwiftProxyStatus struct {

// Conditions
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// NetworkAttachments status of the deployment pods
NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".status.networkAttachments",description="NetworkAttachments"
//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status"
//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message"

Expand Down
10 changes: 9 additions & 1 deletion api/v1beta1/swiftstorage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,27 @@ type SwiftStorageSpec struct {
// +kubebuilder:default=swift-conf
// Name of Secret containing swift.conf
SwiftConfSecret string `json:"swiftConfSecret"`

// +kubebuilder:validation:Optional
// NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network
NetworkAttachments []string `json:"networkAttachments,omitempty"`
}

// SwiftStorageStatus defines the observed state of SwiftStorage
type SwiftStorageStatus struct {
// ReadyCount of SwiftStorage instances
ReadyCount int32 `json:"readyCount,omitempty"`

// Conditions
// Conditions
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// NetworkAttachments status of the deployment pods
NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".status.networkAttachments",description="NetworkAttachments"
//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status"
//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message"

Expand Down
45 changes: 45 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions config/crd/bases/swift.openstack.org_swiftproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: NetworkAttachments
jsonPath: .status.networkAttachments
name: NetworkAttachments
type: string
- description: Status
jsonPath: .status.conditions[0].status
name: Status
Expand Down Expand Up @@ -50,6 +54,12 @@ spec:
containerImageProxy:
description: Swift Proxy Container Image URL
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
items:
type: string
type: array
override:
description: Override, provides the ability to override the generated
manifest of several child resources.
Expand Down Expand Up @@ -310,6 +320,13 @@ spec:
- type
type: object
type: array
networkAttachments:
additionalProperties:
items:
type: string
type: array
description: NetworkAttachments status of the deployment pods
type: object
readyCount:
description: ReadyCount of SwiftProxy instances
format: int32
Expand Down
22 changes: 22 additions & 0 deletions config/crd/bases/swift.openstack.org_swifts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: NetworkAttachments
jsonPath: .status.networkAttachments
name: NetworkAttachments
type: string
- description: Status
jsonPath: .status.conditions[0].status
name: Status
Expand Down Expand Up @@ -44,6 +48,12 @@ spec:
spec:
description: SwiftSpec defines the desired state of Swift
properties:
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
items:
type: string
type: array
storageClass:
default: ""
description: Storage class. This is passed to SwiftStorage unless
Expand All @@ -63,6 +73,12 @@ spec:
containerImageProxy:
description: Swift Proxy Container Image URL
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment
resource names to expose the services to the given network
items:
type: string
type: array
override:
description: Override, provides the ability to override the generated
manifest of several child resources.
Expand Down Expand Up @@ -326,6 +342,12 @@ spec:
containerImageProxy:
description: Image URL for Swift proxy service
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment
resource names to expose the services to the given network
items:
type: string
type: array
replicas:
default: 1
format: int32
Expand Down
Loading

0 comments on commit 82333df

Please sign in to comment.