-
Notifications
You must be signed in to change notification settings - Fork 413
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
Support installing extensions shipped by RHCOS #1850
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
796e323
extensions: support installing exetnsions shipped by RHCOS
sinnykumari c8c6590
controller: check extensions specified in MachineConfigs are valid
sinnykumari 08576d5
daemon: Perform kernelType processing to pivot
sinnykumari f133530
daemon: Update unit test
sinnykumari 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,71 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
daemon "github.com/openshift/machine-config-operator/pkg/daemon" | ||
"github.com/openshift/machine-config-operator/pkg/daemon/constants" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
var mountContainer = &cobra.Command{ | ||
Use: "mount-container", | ||
DisableFlagsInUseLine: true, | ||
Short: "Pull and mount container", | ||
Args: cobra.ExactArgs(1), | ||
Run: executeMountContainer, | ||
} | ||
|
||
// init executes upon import | ||
func init() { | ||
rootCmd.AddCommand(mountContainer) | ||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine) | ||
} | ||
|
||
func saveToFile(content, path string) error { | ||
file, err := os.Create(path) | ||
if err != nil { | ||
file.Close() | ||
return fmt.Errorf("Error creating file %s: %v", path, err) | ||
} | ||
defer file.Close() | ||
if _, err := file.WriteString(content); err != nil { | ||
return err | ||
} | ||
return nil | ||
|
||
} | ||
|
||
func runMountContainer(_ *cobra.Command, args []string) error { | ||
flag.Set("logtostderr", "true") | ||
flag.Parse() | ||
var containerMntLoc, containerImage, containerName string | ||
containerImage = args[0] | ||
|
||
var err error | ||
if containerMntLoc, containerName, err = daemon.MountOSContainer(containerImage); err != nil { | ||
return err | ||
} | ||
// Save mounted container name and location into file for later to be used | ||
// for OS rebase and applying extensions | ||
if err := saveToFile(containerName, constants.MountedOSContainerName); err != nil { | ||
return fmt.Errorf("Failed saving container name: %v", err) | ||
} | ||
if err := saveToFile(containerMntLoc, constants.MountedOSContainerLocation); err != nil { | ||
return fmt.Errorf("Failed saving mounted container location: %v", err) | ||
} | ||
|
||
return nil | ||
|
||
} | ||
|
||
func executeMountContainer(cmd *cobra.Command, args []string) { | ||
err := runMountContainer(cmd, args) | ||
if err != nil { | ||
fmt.Printf("error: %v\n", err) | ||
os.Exit(1) | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
pkg/apis/machineconfiguration.openshift.io/v1/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
Oops, something went wrong.
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.
I may be missing the point of this re-declaration of
containerName
.Don't we want it to be available below, outside of the condition?
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.
meh.. I just realized there's a new PR 😄
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.
will close this once we merge the other one.