Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
230 changes: 230 additions & 0 deletions config/crd/bases/skupper_multikeylistener_crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
name: multikeylisteners.skupper.io
spec:
group: skupper.io
names:
kind: MultiKeyListener
listKind: MultiKeyListenerList
plural: multikeylisteners
singular: multikeylistener
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The status of the multikeylistener
jsonPath: .status.status
name: Status
type: string
- description: Any human reandable message relevant to the multikeylistener
jsonPath: .status.message
name: Message
type: string
- description: Whether there is at least one connector in the network matched
by the strategy
jsonPath: .status.hasDestination
name: HasDestination
type: boolean
name: v2alpha1
schema:
openAPIV3Schema:
description: |-
MultiKeyListeners bind a local connection endpoint to Connectors across the
Skupper network. A MultiKeyListener has a strategy that matches it to
Connector routing keys.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
properties:
host:
description: |-
host is the hostname or IP address of the local listener. Clients at
this site use the listener host and port to establish connections to the
remote service.
type: string
port:
description: |-
port of the local listener. Clients at this site use the listener host
and port to establish connections to the remote service.
type: integer
requireClientCert:
description: |-
requireClientCert indicates that clients must present valid certificates
to the listener to connect.
type: boolean
settings:
additionalProperties:
type: string
description: |-
settings is a map containing additional settings.

**Note:** In general, we recommend not changing settings from
their default values.
type: object
strategy:
description: |-
strategy for routing traffic from the local listener endpoint to one or
more connector instances by routing key.
properties:
priorityFailover:
description: |-
PriorityFailoverStrategySpec specifies an ordered set of routing keys to
route traffic to.

With this strategy 100% of traffic will be directed to the first routing key
with a reachable connector.
properties:
routingKeys:
description: routingKeys to route traffic to in order of highest
to lowest priority.
items:
type: string
maxItems: 256
minItems: 1
type: array
x-kubernetes-list-type: set
required:
- routingKeys
type: object
type: object
x-kubernetes-validations:
- message: exactly one of the fields in [priorityFailover] must be
set
rule: '[has(self.priorityFailover)].filter(x,x==true).size() ==
1'
tlsCredentials:
description: tlsCredentials for client-to-listener
type: string
required:
- host
- port
- strategy
type: object
status:
properties:
conditions:
description: |-
conditions describing the current state of the multikeylistener

- `Configured`: The multikeylistener configuration has been applied to the router.
- `Operational`: There is at least one connector corresponding to the multikeylistener strategy.
- `Ready`: The multikeylistener is ready to use. All other conditions are true..
items:
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
hasDestination:
description: |-
hasDestination is set true when there is at least one connector in the
network with a routing key matched by the strategy.
type: boolean
message:
description: A human-readable status message. Error messages are reported
here.
type: string
status:
description: |-
The current state of the resource.
- `Pending`: The resource is being processed.
- `Error`: There was an error processing the resource. See `message` for more information.
- `Ready`: The resource is ready to use.
type: string
strategy:
properties:
priorityFailover:
description: priorityFailover status
properties:
routingKeysReachable:
description: |-
routingKeysReachable is a list of routingKeys with at least one
reachable connector given in priority order.
items:
type: string
type: array
required:
- routingKeysReachable
type: object
type: object
x-kubernetes-validations:
- message: exactly one of the fields in [priorityFailover] must be
set
rule: '[has(self.priorityFailover)].filter(x,x==true).size() ==
1'
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
1 change: 1 addition & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ resources:
- bases/skupper_connector_crd.yaml
- bases/skupper_link_crd.yaml
- bases/skupper_listener_crd.yaml
- bases/skupper_multikeylistener_crd.yaml
- bases/skupper_router_access_crd.yaml
- bases/skupper_secured_access_crd.yaml
- bases/skupper_site_crd.yaml
2 changes: 2 additions & 0 deletions config/rbac/cluster/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ rules:
- accessgrants/status
- listeners
- listeners/status
- multikeylisteners
- multikeylisteners/status
- connectors
- connectors/status
- attachedconnectors
Expand Down
2 changes: 2 additions & 0 deletions config/rbac/namespace/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ rules:
- accessgrants/status
- listeners
- listeners/status
- multikeylisteners
- multikeylisteners/status
- connectors
- connectors/status
- attachedconnectors
Expand Down
21 changes: 11 additions & 10 deletions internal/cmd/skupper/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ var (
)

const (
Connectors string = "Connector"
Listeners string = "Listener"
Sites string = "Site"
RouterAccesses string = "RouterAccess"
Links string = "Link"
AccessTokens string = "AccessToken"
Secrets string = "Secret"
ConfigMaps string = "ConfigMap"
Certificates string = "Certificate"
SecuredAccesses string = "SecuredAccess"
Connectors string = "Connector"
Listeners string = "Listener"
Sites string = "Site"
RouterAccesses string = "RouterAccess"
Links string = "Link"
AccessTokens string = "AccessToken"
Secrets string = "Secret"
ConfigMaps string = "ConfigMap"
Certificates string = "Certificate"
SecuredAccesses string = "SecuredAccess"
MultiKeyListeners string = "MultiKeyListener"
)

const (
Expand Down
46 changes: 29 additions & 17 deletions internal/cmd/skupper/system/nonkube/system_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@ import (
)

type CmdSystemApply struct {
Client skupperv2alpha1.SkupperV2alpha1Interface
KubeClient kubernetes.Interface
CobraCmd *cobra.Command
Namespace string
Flags *common.CommandSystemApplyFlags
ParseInput func(namespace string, reader *bufio.Reader, result *fs.InputFileResource) error
siteHandler *fs.SiteHandler
connectorHandler *fs.ConnectorHandler
listenerHandler *fs.ListenerHandler
linkHandler *fs.LinkHandler
routerAccessHandler *fs.RouterAccessHandler
accessTokenHandler *fs.AccessTokenHandler
certificateHandler *fs.CertificateHandler
securedAccessHandler *fs.SecuredAccessHandler
secretHandler *fs.SecretHandler
file string
logger *slog.Logger
Client skupperv2alpha1.SkupperV2alpha1Interface
KubeClient kubernetes.Interface
CobraCmd *cobra.Command
Namespace string
Flags *common.CommandSystemApplyFlags
ParseInput func(namespace string, reader *bufio.Reader, result *fs.InputFileResource) error
siteHandler *fs.SiteHandler
connectorHandler *fs.ConnectorHandler
listenerHandler *fs.ListenerHandler
multiKeyListenerHandler *fs.MultiKeyListenerHandler
linkHandler *fs.LinkHandler
routerAccessHandler *fs.RouterAccessHandler
accessTokenHandler *fs.AccessTokenHandler
certificateHandler *fs.CertificateHandler
securedAccessHandler *fs.SecuredAccessHandler
secretHandler *fs.SecretHandler
file string
logger *slog.Logger
}

func NewCmdSystemApply() *CmdSystemApply {
Expand All @@ -52,6 +53,7 @@ func (cmd *CmdSystemApply) NewClient(cobraCommand *cobra.Command, args []string)

cmd.connectorHandler = fs.NewConnectorHandler(cmd.Namespace)
cmd.listenerHandler = fs.NewListenerHandler(cmd.Namespace)
cmd.multiKeyListenerHandler = fs.NewMultiKeyListenerHandler(cmd.Namespace)
cmd.linkHandler = fs.NewLinkHandler(cmd.Namespace)
cmd.routerAccessHandler = fs.NewRouterAccessHandler(cmd.Namespace)
cmd.accessTokenHandler = fs.NewAccessTokenHandler(cmd.Namespace)
Expand Down Expand Up @@ -163,6 +165,16 @@ func (cmd *CmdSystemApply) Run() error {
}
}

for _, multiKeyListener := range parsedInput.MultiKeyListener {
err := cmd.multiKeyListenerHandler.Add(multiKeyListener)
if err != nil {
cmd.logger.Error("Error while adding multi key listener", slog.String("multikeylistener", multiKeyListener.Name), slog.Any("error", err))
} else {
crApplied = true
fmt.Printf("MultiKeyListener %s added\n", multiKeyListener.Name)
}
}

for _, link := range parsedInput.Link {
err := cmd.linkHandler.Add(link)
if err != nil {
Expand Down
Loading