-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mantle/ore: gcp: add image family support, add deprecate image functionality #1319
Merged
openshift-merge-robot
merged 7 commits into
coreos:master
from
dustymabe:dusty-gcp-ore-work
Apr 7, 2020
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9a323e5
cosalib/gcp: add ability to pass through --fcos arg to ore
dustymabe 53b7650
mantle: Add ability to specify Image Family for GCP uploads
dustymabe 0c1f910
mantle/api: gcloud: don't mutate Image arg if not provided
dustymabe 25e7f8c
mantle/ore: add ore gcloud deprecate-image
dustymabe 1a3f913
mantle/ore: glcoud: gofmt -w mantle/cmd/ore/gcloud/upload.go
dustymabe 0f7ada4
cosalib/gcp: make call to ore pass through provided bucket argument
dustymabe 389213a
cosalib/gcp: add compat code for callers providing --bucket gs://*
dustymabe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,74 @@ | ||
// Copyright 2020 Red Hat | ||
// | ||
// 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 gcloud | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/coreos/mantle/platform/api/gcloud" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
cmdDeprecateImage = &cobra.Command{ | ||
Use: "deprecate-image --image=ImageName [--state=DeprecationState] [--replacement=Replacement]", | ||
Short: "Deprecate GCP image", | ||
Long: "Change deprecation status of existing GCP image", | ||
Run: runDeprecateImage, | ||
} | ||
|
||
deprecateImageState string | ||
deprecateImageReplacement string | ||
) | ||
|
||
func init() { | ||
// note that --image comes from the toplevel options in gcloud.go | ||
cmdDeprecateImage.Flags().StringVar(&deprecateImageState, "state", | ||
string(gcloud.DeprecationStateDeprecated), | ||
fmt.Sprintf("Deprecation state must be one of: %s,%s,%s,%s", | ||
gcloud.DeprecationStateActive, | ||
gcloud.DeprecationStateDeprecated, | ||
gcloud.DeprecationStateObsolete, | ||
gcloud.DeprecationStateDeleted)) | ||
cmdDeprecateImage.Flags().StringVar(&deprecateImageReplacement, | ||
"replacement", "", "optional: link to replacement for the deprecated image") | ||
GCloud.AddCommand(cmdDeprecateImage) | ||
} | ||
|
||
func runDeprecateImage(cmd *cobra.Command, args []string) { | ||
// Check that the user provided an image | ||
if opts.Image == "" { | ||
plog.Fatal("Must provide an image name via --image") | ||
} | ||
|
||
// Check that the deprecation state is a valid one | ||
switch gcloud.DeprecationState(deprecateImageState) { | ||
case gcloud.DeprecationStateActive, | ||
gcloud.DeprecationStateDeprecated, | ||
gcloud.DeprecationStateObsolete, | ||
gcloud.DeprecationStateDeleted: | ||
// Do nothing, state is valid | ||
default: | ||
plog.Fatalf("Specified deprecation state is invalid: %s\n", deprecateImageState) | ||
} | ||
|
||
plog.Debugf("Attempting to change GCP image deprecation state of %s to %s\n", | ||
opts.Image, deprecateImageState) | ||
_, err := api.DeprecateImage(opts.Image, | ||
gcloud.DeprecationState(deprecateImageState), deprecateImageReplacement) | ||
if err != nil { | ||
plog.Fatalf("Changing deprecation state of image failed: %v\n", err) | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have this be off by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also openshift/installer#2921 which merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming we want to have SECURE_BOOT and UEFI_COMPATIBLE everywhere we could just get rid of the flag altogether and bake it in at a lower level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though I'd prefer to do this in a follow up if you don't mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's exactly the status quo today, it's baked into
ore
by default but you went out of the way to explicitly disable it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind it's off by default, I was wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow-up to make
SECURE_BOOT
andUEFI_COMPATIBLE
standard and remove the--fcos
option: #1333