-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create await-node-ready binary and add to gateway and route-agent images
Related to submariner-io/submariner-operator#3274 Signed-off-by: Tom Pantelis <[email protected]>
- Loading branch information
Showing
5 changed files
with
93 additions
and
6 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
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,14 @@ | ||
#!/bin/bash | ||
set -e -x | ||
|
||
trap "exit 1" SIGTERM SIGINT | ||
|
||
SUBMARINER_VERBOSITY=${SUBMARINER_VERBOSITY:-2} | ||
|
||
if [ "${SUBMARINER_DEBUG}" == "true" ]; then | ||
DEBUG="-v=3" | ||
else | ||
DEBUG="-v=${SUBMARINER_VERBOSITY}" | ||
fi | ||
|
||
exec await-node-ready ${DEBUG} -alsologtostderr |
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,69 @@ | ||
/* | ||
SPDX-License-Identifier: Apache-2.0 | ||
Copyright Contributors to the Submariner project. | ||
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 | ||
|
||
import ( | ||
"flag" | ||
|
||
"github.com/submariner-io/admiral/pkg/log" | ||
"github.com/submariner-io/admiral/pkg/log/kzerolog" | ||
admversion "github.com/submariner-io/admiral/pkg/version" | ||
"github.com/submariner-io/submariner/pkg/node" | ||
"github.com/submariner-io/submariner/pkg/versions" | ||
"k8s.io/client-go/kubernetes" | ||
"k8s.io/client-go/tools/clientcmd" | ||
logf "sigs.k8s.io/controller-runtime/pkg/log" | ||
"sigs.k8s.io/controller-runtime/pkg/manager/signals" | ||
) | ||
|
||
var ( | ||
masterURL string | ||
kubeconfig string | ||
logger = log.Logger{Logger: logf.Log.WithName("main")} | ||
showVersion = false | ||
) | ||
|
||
func main() { | ||
kzerolog.AddFlags(nil) | ||
flag.Parse() | ||
|
||
admversion.Print("await-node-ready", versions.Submariner()) | ||
|
||
if showVersion { | ||
return | ||
} | ||
|
||
kzerolog.InitK8sLogging() | ||
|
||
versions.Log(&logger) | ||
|
||
logger.Info("Initializing K8s client...") | ||
|
||
ctx := signals.SetupSignalHandler() | ||
|
||
cfg, err := clientcmd.BuildConfigFromFlags(masterURL, kubeconfig) | ||
logger.FatalOnError(err, "Error building kubeconfig") | ||
|
||
k8sClientSet, err := kubernetes.NewForConfig(cfg) | ||
logger.FatalOnError(err, "Error building clientset") | ||
|
||
logger.Info("Awaiting local node ready...") | ||
|
||
node.WaitForLocalNodeReady(ctx, k8sClientSet) | ||
} |