-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
908 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2019 The Operator-SDK 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 alpha | ||
|
||
import ( | ||
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/alpha/olm" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "alpha", | ||
Short: "Run an alpha subcommand", | ||
} | ||
|
||
cmd.AddCommand(olm.NewCmd()) | ||
return cmd | ||
} |
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,32 @@ | ||
// Copyright 2019 The Operator-SDK 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 olm | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "olm", | ||
Short: "Manage the Operator Lifecycle Manager installation in your cluster", | ||
} | ||
cmd.AddCommand( | ||
NewInstallCmd(), | ||
NewUninstallCmd(), | ||
NewStatusCmd(), | ||
) | ||
return cmd | ||
} |
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,39 @@ | ||
// Copyright 2019 The Operator-SDK 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 olm | ||
|
||
import ( | ||
"github.com/operator-framework/operator-sdk/internal/olm" | ||
|
||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewInstallCmd() *cobra.Command { | ||
mgr := &olm.Manager{} | ||
cmd := &cobra.Command{ | ||
Use: "install", | ||
Short: "Install Operator Lifecycle Manager in your cluster", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
if err := mgr.Install(); err != nil { | ||
log.Fatalf("Failed to install OLM version %q: %s", mgr.Version, err) | ||
} | ||
return nil | ||
}, | ||
} | ||
|
||
mgr.AddToFlagSet(cmd.Flags()) | ||
return cmd | ||
} |
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,39 @@ | ||
// Copyright 2019 The Operator-SDK 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 olm | ||
|
||
import ( | ||
"github.com/operator-framework/operator-sdk/internal/olm" | ||
|
||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewStatusCmd() *cobra.Command { | ||
mgr := olm.Manager{} | ||
cmd := &cobra.Command{ | ||
Use: "status", | ||
Short: "Get the status of the Operator Lifecycle Manager installation in your cluster", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
if err := mgr.Status(); err != nil { | ||
log.Fatalf("Failed to get OLM status for version %q: %s", mgr.Version, err) | ||
} | ||
return nil | ||
}, | ||
} | ||
|
||
mgr.AddToFlagSet(cmd.Flags()) | ||
return cmd | ||
} |
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,39 @@ | ||
// Copyright 2019 The Operator-SDK 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 olm | ||
|
||
import ( | ||
"github.com/operator-framework/operator-sdk/internal/olm" | ||
|
||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewUninstallCmd() *cobra.Command { | ||
mgr := olm.Manager{} | ||
cmd := &cobra.Command{ | ||
Use: "uninstall", | ||
Short: "Uninstall Operator Lifecycle Manager from your cluster", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
if err := mgr.Uninstall(); err != nil { | ||
log.Fatalf("Failed to uninstall OLM version %q: %s", mgr.Version, err) | ||
} | ||
return nil | ||
}, | ||
} | ||
|
||
mgr.AddToFlagSet(cmd.Flags()) | ||
return cmd | ||
} |
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,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
|
||
test_version() { | ||
local version="$1" | ||
|
||
# Status should fail with OLM not installed | ||
commandoutput=$(operator-sdk alpha olm status --version=${version} 2>&1 || true) | ||
echo $commandoutput | grep -F "Failed to get OLM status for version \\\"${version}\\\": no existing installation found" | ||
|
||
# Uninstall should fail with OLM not installed | ||
commandoutput=$(operator-sdk alpha olm uninstall --version=${version} 2>&1 || true) | ||
echo $commandoutput | grep -F "Failed to uninstall OLM version \\\"${version}\\\": no existing installation found" | ||
|
||
# Install should succeed with nothing installed | ||
commandoutput=$(operator-sdk alpha olm install --version=${version} 2>&1) | ||
echo $commandoutput | grep -F "Successfully installed OLM version \\\"${version}\\\"" | ||
|
||
# Install should fail with OLM Installed | ||
commandoutput=$(operator-sdk alpha olm install --version=${version} 2>&1 || true) | ||
echo $commandoutput | grep -F "Failed to install OLM version \\\"${version}\\\": detected existing OLM resources: OLM must be completely uninstalled before installation" | ||
|
||
# Status should succeed with OLM installed | ||
# If version is "latest", also run without --version flag | ||
if [[ "$version" == "latest" ]]; then | ||
commandoutput=$(operator-sdk alpha olm status 2>&1) | ||
echo $commandoutput | grep -F "Successfully got OLM status for version \\\"${version}\\\"" | ||
fi | ||
|
||
commandoutput=$(operator-sdk alpha olm status --version=${version} 2>&1) | ||
echo $commandoutput | grep -F "Successfully got OLM status for version \\\"${version}\\\"" | ||
|
||
# Uninstall should succeed with OLM installed | ||
commandoutput=$(operator-sdk alpha olm uninstall --version=${version} 2>&1) | ||
echo $commandoutput | grep -F "Successfully uninstalled OLM version \\\"${version}\\\"" | ||
} | ||
|
||
test_version "latest" | ||
test_version "0.10.1" |
Oops, something went wrong.