Skip to content

Commit

Permalink
update plugin manifests and config
Browse files Browse the repository at this point in the history
Signed-off-by: Tom <[email protected]>
  • Loading branch information
Flying-Tom committed Aug 4, 2024
1 parent d9a08ff commit 15a499c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/fleet/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ type SubMarinerConfig struct {
// chart:
// repository: https://submariner-io.github.io/submariner-charts/charts
// name: submariner
// version: 0.14.9
// version: 0.18.0
// targetNamespace: submariner
// ```
//
Expand Down
24 changes: 22 additions & 2 deletions pkg/fleet-manager/fleet_plugin_submariner.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,38 @@ func (f *FleetManager) reconcileSubmarinerPlugin(ctx context.Context, fleet *fle

fleetOwnerRef := ownerReference(fleet)
var resources kube.ResourceList
var b []byte
var err error

exist_broker := false
for key, cluster := range fleetClusters {
b, err := plugin.RenderSubmarinerOperator(f.Manifests, fleetNN, fleetOwnerRef, plugin.KubeConfigSecretRef{
if !exist_broker {
b, err = plugin.RenderSubmarinerBroker(f.Manifests, fleetNN, fleetOwnerRef, plugin.KubeConfigSecretRef{
Name: key.Name,
SecretName: cluster.Secret,
SecretKey: cluster.SecretKey,
}, submarinerCfg)
exist_broker = true
if err != nil {
return nil, ctrl.Result{}, err
}

submarinerResources, err := util.PatchResources(b)
if err != nil {
return nil, ctrl.Result{}, err
}
resources = append(resources, submarinerResources...)
}
b, err = plugin.RenderSubmarinerOperator(f.Manifests, fleetNN, fleetOwnerRef, plugin.KubeConfigSecretRef{
Name: key.Name,
SecretName: cluster.Secret,
SecretKey: cluster.SecretKey,
}, submarinerCfg)

if err != nil {
return nil, ctrl.Result{}, err
}

// apply submariner helm resources
submarinerResources, err := util.PatchResources(b)
if err != nil {
return nil, ctrl.Result{}, err
Expand Down
10 changes: 9 additions & 1 deletion pkg/fleet-manager/manifests/plugins/submariner-k8s-broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ type: default
repo: https://submariner-io.github.io/submariner-charts/charts
name: submariner-k8s-broker
version: 0.18.0
targetNamespace: submariner
targetNamespace: submariner
values:
crd:
create: true
rbac:
create: true
serviceAccounts:
client:
create: true
10 changes: 9 additions & 1 deletion pkg/fleet-manager/manifests/plugins/submariner-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ type: default
repo: https://submariner-io.github.io/submariner-charts/charts
name: submariner-operator
version: 0.18.0
targetNamespace: submariner
targetNamespace: submariner
values:
rbac:
create: true
submariner:
natEnabled: false
operator:
image:
tag: "0.14.0"
17 changes: 8 additions & 9 deletions pkg/fleet-manager/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,15 @@ func RenderRolloutTestloader(
})
}

func RenderSubmarinerOperator(
func RenderSubmarinerBroker(
fsys fs.FS,
fleetNN types.NamespacedName,
fleetRef *metav1.OwnerReference,
cluster KubeConfigSecretRef,
subMarinerConfig *fleetv1a1.SubMarinerConfig,
) ([]byte, error) {
// get and merge the chart config
c, err := getFleetPluginChart(fsys, SubMarinerOperatorComponentName)
c, err := getFleetPluginChart(fsys, SubMarinerBrokerComponentName)
if err != nil {
return nil, err
}
Expand All @@ -469,8 +469,8 @@ func RenderSubmarinerOperator(
}

return renderFleetPlugin(fsys, FleetPluginConfig{
Name: SubMarinerOperatorPluginName,
Component: SubMarinerOperatorComponentName,
Name: SubMarinerBrokerPluginName,
Component: SubMarinerBrokerComponentName,
Fleet: fleetNN,
Cluster: &cluster,
OwnerReference: fleetRef,
Expand All @@ -479,16 +479,15 @@ func RenderSubmarinerOperator(
})
}


func RenderSubmarinerBroker(
func RenderSubmarinerOperator(
fsys fs.FS,
fleetNN types.NamespacedName,
fleetRef *metav1.OwnerReference,
cluster KubeConfigSecretRef,
subMarinerConfig *fleetv1a1.SubMarinerConfig,
) ([]byte, error) {
// get and merge the chart config
c, err := getFleetPluginChart(fsys, SubMarinerBrokerComponentName)
c, err := getFleetPluginChart(fsys, SubMarinerOperatorComponentName)
if err != nil {
return nil, err
}
Expand All @@ -501,8 +500,8 @@ func RenderSubmarinerBroker(
}

return renderFleetPlugin(fsys, FleetPluginConfig{
Name: SubMarinerBrokerPluginName,
Component: SubMarinerBrokerComponentName,
Name: SubMarinerOperatorPluginName,
Component: SubMarinerOperatorComponentName,
Fleet: fleetNN,
Cluster: &cluster,
OwnerReference: fleetRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ spec:
sourceRef:
kind: HelmRepository
name: "submariner-k8s-broker-cluster1"
values:
crd:
create: true
rbac:
create: true
serviceAccounts:
client:
create: true
interval: 1m0s
install:
createNamespace: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ spec:
sourceRef:
kind: HelmRepository
name: "submariner-operator-cluster1"
values:
operator:
image:
tag: 0.14.0
rbac:
create: true
submariner:
natEnabled: false
interval: 1m0s
install:
createNamespace: true
Expand Down

0 comments on commit 15a499c

Please sign in to comment.