-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[olm] Store previous versions of olm manifests (#3906)
* [olm] Store previous versions of olm manifests This PR introduces an internal optimization of not going to github and downloading the olm manifests when 'operator-sdk olm install' command is used. Previous version of olm manifest is stored as bindata and packaged along with sdk binary. When user specifies any of this version, the manifests are fetched locally and applied to the cluster. * [olm] Include script to generate olm bindata
- Loading branch information
1 parent
cfb7ee8
commit bfc6bfa
Showing
12 changed files
with
423 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
entries: | ||
- description: > | ||
Added feature to the command `operator-sdk olm install` that allows installing OLM version 0.15.1 without | ||
fetching the manifest from Github. | ||
kind: "addition" | ||
breaking: false |
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,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
function get_olm_manifests() { | ||
mkdir olm-manifests | ||
echo "downloading olm manifests for version ${1}" | ||
wget -O olm-manifests/olm.yaml "https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${1}/olm.yaml" | ||
wget -O olm-manifests/crds.yaml "https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${1}/crds.yaml" | ||
} | ||
|
||
function remove_olm_manifests { | ||
rm -rf olm-manifests | ||
} | ||
|
||
# check for files starting with the name "olm-bindata" inside internal/olm folder | ||
function delete_old_olmbindata { | ||
echo "Deleting previous versions of olm-bindata files if they exist" | ||
find internal/bindata/olm -maxdepth 1 -type f -name manifests-* -exec rm {} \; | ||
} | ||
|
||
# TODO: | ||
# 1. Modify this to accept multiple versions and download bindata. | ||
# 2. Discuss on the number of olm versions of will be supported. | ||
FILE=internal/bindata/olm/"manifests-"$1.go | ||
if [ -f "$FILE" ]; then | ||
delete_old_olmbindata | ||
get_olm_manifests $1 | ||
|
||
go get -u github.com/go-bindata/go-bindata/... | ||
$(go env GOPATH)/bin/go-bindata -o manifests-$1.go -pkg olm olm-manifests/ | ||
mv manifests-$1.go internal/bindata/olm | ||
|
||
remove_olm_manifests | ||
fi | ||
|
||
go mod tidy |
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
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2020 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 | ||
|
||
var availableVersions = map[string]struct{}{ | ||
"0.15.1": struct{}{}, | ||
} | ||
|
||
// HasVersion returns whether version maps to released OLM manifests as bindata. | ||
func HasVersion(version string) bool { | ||
_, ok := availableVersions[version] | ||
return ok | ||
} |
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