This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a first implementation of a per-node resources plugin which tries…
… to reproduce the liqo's behavoir to calculate the available/used resources
- Loading branch information
Showing
8 changed files
with
644 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2019-2022 The Liqo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package main bootstraps the main plugin | ||
package main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"os" | ||
"time" | ||
|
||
"github.com/spf13/cobra" | ||
"k8s.io/client-go/kubernetes" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
|
||
grpcserver "github.com/liqotech/liqo-resource-plugins/pkg/per-node-resources" | ||
"github.com/liqotech/liqo/pkg/utils/restcfg" | ||
) | ||
|
||
func main() { | ||
var port int | ||
var nodesToIgnore []string | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: os.Args[0], | ||
Short: "Liqo plugin which provides fixed resources to each remote cluster", | ||
SilenceUsage: true, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
resyncPeriod := flag.Duration("resync-period", 10*time.Hour, "The resync period for the informers") | ||
config := restcfg.SetRateLimiter(ctrl.GetConfigOrDie()) | ||
clientset := kubernetes.NewForConfigOrDie(config) | ||
|
||
return grpcserver.ListenAndServeGRPCServer(port, clientset, *resyncPeriod, nodesToIgnore) | ||
}, | ||
} | ||
|
||
rootCmd.PersistentFlags().IntVar(&port, "port", 6001, "set port where the server will listen on.") | ||
rootCmd.PersistentFlags().StringSliceVar(&nodesToIgnore, "ignore-node", | ||
make([]string, 0), "node's name to ignore. You can use this flag multiple times.") | ||
|
||
err := rootCmd.Execute() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2019-2022 The Liqo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package pernoderesources is the standard implementation to handle resources in liqo | ||
package pernoderesources |
Oops, something went wrong.