Skip to content

Commit

Permalink
Feat: Install submariner as fleet plugin (kurator-dev#660)
Browse files Browse the repository at this point in the history
* feat: add submariner plugin config

Signed-off-by: Tom <[email protected]>

* update generated

Signed-off-by: Tom <[email protected]>

* add doc and example

Signed-off-by: Tom <[email protected]>

* fix submariner reconcile logic

Signed-off-by: Tom <[email protected]>

* finish operator

Signed-off-by: Tom <[email protected]>

* fix manifest fields

Signed-off-by: Tom <[email protected]>

* add field for submariner config

Signed-off-by: Tom <[email protected]>

* add clusterCidrs and serviceCidrs

Signed-off-by: Tom <[email protected]>

---------

Signed-off-by: Tom <[email protected]>
  • Loading branch information
Flying-Tom authored Aug 27, 2024
1 parent 1ebcffd commit 130f8b4
Show file tree
Hide file tree
Showing 13 changed files with 874 additions and 19 deletions.
125 changes: 125 additions & 0 deletions docs/content/en/references/fleet_v1alpha1_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ <h3 id="fleet.kurator.dev/v1alpha1.ChartConfig">ChartConfig
<a href="#fleet.kurator.dev/v1alpha1.GrafanaConfig">GrafanaConfig</a>,
<a href="#fleet.kurator.dev/v1alpha1.KyvernoConfig">KyvernoConfig</a>,
<a href="#fleet.kurator.dev/v1alpha1.PrometheusConfig">PrometheusConfig</a>,
<a href="#fleet.kurator.dev/v1alpha1.SubMarinerOperatorConfig">SubMarinerOperatorConfig</a>,
<a href="#fleet.kurator.dev/v1alpha1.ThanosConfig">ThanosConfig</a>)
</p>
<div class="md-typeset__scrollwrap">
Expand Down Expand Up @@ -1433,6 +1434,19 @@ <h3 id="fleet.kurator.dev/v1alpha1.PluginConfig">PluginConfig
<p>Flagger defines the configuration for the kurator rollout engine.</p>
</td>
</tr>
<tr>
<td>
<code>submariner</code><br>
<em>
<a href="#fleet.kurator.dev/v1alpha1.SubMarinerOperatorConfig">
SubMarinerOperatorConfig
</a>
</em>
</td>
<td>
<p>SubMarinerOperator defines the configuration for the kurator network management.</p>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -1755,6 +1769,117 @@ <h3 id="fleet.kurator.dev/v1alpha1.StorageScopeSpec">StorageScopeSpec
</table>
</div>
</div>
<h3 id="fleet.kurator.dev/v1alpha1.SubMarinerOperatorConfig">SubMarinerOperatorConfig
</h3>
<p>
(<em>Appears on:</em>
<a href="#fleet.kurator.dev/v1alpha1.PluginConfig">PluginConfig</a>)
</p>
<div class="md-typeset__scrollwrap">
<div class="md-typeset__table td-content">
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>chart</code><br>
<em>
<a href="#fleet.kurator.dev/v1alpha1.ChartConfig">
ChartConfig
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Chart defines the helm chart configuration of the submariner operator.
The default value is</p>
<pre><code class="language-yaml">chart:
repository: https://submariner-io.github.io/submariner-charts/charts
name: submariner-operator
version: 0.18.0
targetNamespace: submariner-operator
</code></pre>
</td>
</tr>
<tr>
<td>
<code>extraArgs</code><br>
<em>
<a href="https://pkg.go.dev/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1?tab=doc#JSON">
Kubernetes /apiextensions/v1.JSON
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ExtraArgs is the set of extra arguments for submariner, and example will be provided in the future.</p>
<pre><code class="language-yaml">extraArgs:
broker:
globalnet: true
submariner:
serviceDiscovery: true
natEnabled: false
</code></pre>
</td>
</tr>
<tr>
<td>
<code>brokerCluster</code><br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>BrokerCluster is the name of cluster in which the broker will be installed.
If the broker cluster is not specified, the first cluster in the fleet will be used as the broker cluster.</p>
</td>
</tr>
<tr>
<td>
<code>clusterCidrs</code><br>
<em>
map[string]string
</em>
</td>
<td>
<p>ClusterCidrs records the clustercidr of each cluster.</p>
</td>
</tr>
<tr>
<td>
<code>serviceCidrs</code><br>
<em>
map[string]string
</em>
</td>
<td>
<p>ServiceCidrs records the servicecidr of each cluster.</p>
</td>
</tr>
<tr>
<td>
<code>globalcidrs</code><br>
<em>
map[string]string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Globalcidrs records the globalcidr of each cluster in a virtual network Globalnet.
Each cluster must use distinct globalCidr that don’t conflict or overlap with any other cluster
If the globalcidr is not specified, Globalnet will be disabled.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3 id="fleet.kurator.dev/v1alpha1.ThanosConfig">ThanosConfig
</h3>
<p>
Expand Down
46 changes: 46 additions & 0 deletions examples/fleet/network/submariner-plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: cluster.kurator.dev/v1alpha1
kind: AttachedCluster
metadata:
name: kurator-member1
namespace: default
spec:
kubeconfig:
name: kurator-member1
key: kurator-member1.config
---
apiVersion: cluster.kurator.dev/v1alpha1
kind: AttachedCluster
metadata:
name: kurator-member2
namespace: default
spec:
kubeconfig:
name: kurator-member2
key: kurator-member2.config
---
apiVersion: fleet.kurator.dev/v1alpha1
kind: Fleet
metadata:
name: quickstart
namespace: default
spec:
clusters:
- name: kurator-member1
kind: AttachedCluster
- name: kurator-member2
kind: AttachedCluster
plugin:
submariner:
brokerCluster: kurator-member1
clusterCidrs:
kurator-member1: 10.10.0.0/24
kurator-member2: 10.12.0.0/24
serviceCidrs:
kurator-member1: 10.96.0.0/16
kurator-member2: 10.96.0.0/16
globalcidrs:
kurator-member1: 242.1.0.0/16
kurator-member2: 242.2.0.0/16
extraArgs:
ipsec:
psk: $SUBMARINER_PSK
69 changes: 69 additions & 0 deletions manifests/charts/fleet-manager/crds/fleet.kurator.dev_fleets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2782,6 +2782,75 @@ spec:
type: object
type: object
type: object
submariner:
description: SubMarinerOperator defines the configuration for
the kurator network management.
properties:
brokerCluster:
description: |-
BrokerCluster is the name of cluster in which the broker will be installed.
If the broker cluster is not specified, the first cluster in the fleet will be used as the broker cluster.
type: string
chart:
description: |-
Chart defines the helm chart configuration of the submariner operator.
The default value is
```yaml
chart:
repository: https://submariner-io.github.io/submariner-charts/charts
name: submariner-operator
version: 0.18.0
targetNamespace: submariner-operator
```
properties:
name:
description: |-
Name defines the name of the chart.
Default value depends on the kind of the component.
type: string
repository:
description: |-
Repository defines the repository of chart.
Default value depends on the kind of the component.
type: string
version:
description: |-
Version defines the version of the chart.
Default value depends on the kind of the component.
type: string
type: object
clusterCidrs:
additionalProperties:
type: string
description: ClusterCidrs records the clustercidr of each
cluster.
type: object
extraArgs:
description: "ExtraArgs is the set of extra arguments for
submariner, and example will be provided in the future.\n\n\n```yaml\nextraArgs:\n
\ broker:\n \t\tglobalnet: true\n\t submariner:\n \t\tserviceDiscovery:
true\n natEnabled: false\n```"
x-kubernetes-preserve-unknown-fields: true
globalcidrs:
additionalProperties:
type: string
description: |-
Globalcidrs records the globalcidr of each cluster in a virtual network Globalnet.
Each cluster must use distinct globalCidr that don’t conflict or overlap with any other cluster
If the globalcidr is not specified, Globalnet will be disabled.
type: object
serviceCidrs:
additionalProperties:
type: string
description: ServiceCidrs records the servicecidr of each
cluster.
type: object
required:
- clusterCidrs
- serviceCidrs
type: object
type: object
type: object
status:
Expand Down
49 changes: 49 additions & 0 deletions pkg/apis/fleet/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ type PluginConfig struct {
DistributedStorage *DistributedStorageConfig `json:"distributedStorage,omitempty"`
// Flagger defines the configuration for the kurator rollout engine.
Flagger *FlaggerConfig `json:"flagger,omitempty"`
// SubMarinerOperator defines the configuration for the kurator network management.
SubMarinerOperator *SubMarinerOperatorConfig `json:"submariner,omitempty"`
}

type MetricConfig struct {
Expand Down Expand Up @@ -569,6 +571,53 @@ type FlaggerConfig struct {
PublicTestloader bool `json:"publicTestloader,omitempty"`
}

type SubMarinerOperatorConfig struct {
// Chart defines the helm chart configuration of the submariner operator.
// The default value is
//
// ```yaml
// chart:
// repository: https://submariner-io.github.io/submariner-charts/charts
// name: submariner-operator
// version: 0.18.0
// targetNamespace: submariner-operator
// ```
//
// +optional
Chart *ChartConfig `json:"chart,omitempty"`

// ExtraArgs is the set of extra arguments for submariner, and example will be provided in the future.
//
// ```yaml
// extraArgs:
// broker:
// globalnet: true
// submariner:
// serviceDiscovery: true
// natEnabled: false
// ```
//
// +optional
ExtraArgs apiextensionsv1.JSON `json:"extraArgs,omitempty"`

// BrokerCluster is the name of cluster in which the broker will be installed.
// If the broker cluster is not specified, the first cluster in the fleet will be used as the broker cluster.
// +optional
BrokerCluster string `json:"brokerCluster,omitempty"`

// ClusterCidrs records the clustercidr of each cluster.
ClusterCidrs map[string]string `json:"clusterCidrs"`

// ServiceCidrs records the servicecidr of each cluster.
ServiceCidrs map[string]string `json:"serviceCidrs"`

// Globalcidrs records the globalcidr of each cluster in a virtual network Globalnet.
// Each cluster must use distinct globalCidr that don’t conflict or overlap with any other cluster
// If the globalcidr is not specified, Globalnet will be disabled.
// +optional
Globalcidrs map[string]string `json:"globalcidrs,omitempty"`
}

// Provider only can be istio now.
// TODO: add Linkerd, APP Mesh, NGINX, Kuma, Gateway, Gloo
type Provider string
Expand Down
48 changes: 48 additions & 0 deletions pkg/apis/fleet/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 130f8b4

Please sign in to comment.