-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 97: Update operator SDK dependency to 0.2.0 (full refactor) (#98)
* Updates the operator SDK dependency from 0.0.5 to 0.2.0. Applied the official migration guide step by step to migrate the existing operator project to be compliant with the latest SDK. * Sets up the operator testing framework as explained in the official documentation. There's no test case implementation yet, but the framework is ready to accept test cases. * Creates new test-e2e make command that runs the end-to-end tests * Updates Travis configuration to set up and deploy MiniKube as the testing Kubernetes backend. Signed-off-by: Adrian Moreno <[email protected]>
- Loading branch information
Showing
42 changed files
with
1,011 additions
and
709 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
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 @@ | ||
# | ||
# Copyright (c) 2017 Dell Inc., or its subsidiaries. All Rights Reserved. | ||
# | ||
# 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 | ||
# | ||
FROM alpine:3.6 | ||
|
||
USER nobody | ||
|
||
ADD build/_output/bin/pravega-operator /usr/local/bin/pravega-operator |
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,90 @@ | ||
/** | ||
* Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. | ||
* | ||
* 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 | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"os" | ||
"runtime" | ||
|
||
"github.com/pravega/pravega-operator/pkg/apis" | ||
"github.com/pravega/pravega-operator/pkg/controller" | ||
"github.com/pravega/pravega-operator/pkg/version" | ||
|
||
"github.com/operator-framework/operator-sdk/pkg/k8sutil" | ||
sdkVersion "github.com/operator-framework/operator-sdk/version" | ||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp" | ||
"sigs.k8s.io/controller-runtime/pkg/client/config" | ||
"sigs.k8s.io/controller-runtime/pkg/manager" | ||
"sigs.k8s.io/controller-runtime/pkg/runtime/signals" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
var ( | ||
versionFlag bool | ||
) | ||
|
||
func init() { | ||
flag.BoolVar(&versionFlag, "version", false, "Show version and quit") | ||
flag.Parse() | ||
} | ||
|
||
func printVersion() { | ||
log.Printf("pravega-operator Version: %v", version.Version) | ||
log.Printf("Git SHA: %s", version.GitSHA) | ||
log.Printf("Go Version: %s", runtime.Version()) | ||
log.Printf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH) | ||
log.Printf("operator-sdk Version: %v", sdkVersion.Version) | ||
} | ||
|
||
func main() { | ||
printVersion() | ||
flag.Parse() | ||
|
||
if versionFlag { | ||
os.Exit(0) | ||
} | ||
|
||
namespace, err := k8sutil.GetWatchNamespace() | ||
if err != nil { | ||
log.Fatalf("failed to get watch namespace: %v", err) | ||
} | ||
|
||
// Get a config to talk to the apiserver | ||
cfg, err := config.GetConfig() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Create a new Cmd to provide shared dependencies and start components | ||
mgr, err := manager.New(cfg, manager.Options{Namespace: namespace}) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
log.Print("Registering Components") | ||
|
||
// Setup Scheme for all resources | ||
if err := apis.AddToScheme(mgr.GetScheme()); err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Setup all Controllers | ||
if err := controller.AddToManager(mgr); err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
log.Print("Starting the Cmd") | ||
|
||
// Start the Cmd | ||
log.Fatal(mgr.Start(signals.SetupSignalHandler())) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -10,4 +10,4 @@ spec: | |
plural: pravegaclusters | ||
singular: pravegacluster | ||
scope: Namespaced | ||
version: v1alpha1 | ||
version: v1alpha1 |
Oops, something went wrong.