This repository has been archived by the owner on Sep 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1856 from jorge07/0.12.x-flartcar
[v0.12.x] Flatcar
- Loading branch information
Showing
21 changed files
with
171 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/kubernetes-incubator/kube-aws/core/root" | ||
"github.com/kubernetes-incubator/kube-aws/flatcar/amiregistry" | ||
"github.com/kubernetes-incubator/kube-aws/logger" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
cmdAmi = &cobra.Command{ | ||
Use: "ami", | ||
Short: "Compare AMIID of cluster.yaml VS the last release", | ||
Long: ``, | ||
RunE: runCmdAmi, | ||
SilenceUsage: true, | ||
} | ||
) | ||
|
||
func init() { | ||
RootCmd.AddCommand(cmdAmi) | ||
|
||
} | ||
|
||
func runCmdAmi(_ *cobra.Command, _ []string) error { | ||
opts := root.NewOptions(true, true) | ||
cluster, err := root.ClusterFromFile(configPath, opts, false) | ||
if err != nil { | ||
return fmt.Errorf("failed to read cluster config: %v", err) | ||
} | ||
|
||
region := cluster.ControlPlane().Region.Name | ||
channel := string(cluster.ControlPlane().ReleaseChannel) | ||
|
||
amiID, err := amiregistry.GetAMI(region, cluster.ControlPlane().ReleaseChannel) | ||
if err != nil { | ||
return fmt.Errorf("Impossible to retrieve FlatCar AMI for region %s, channel %s", region, channel) | ||
} | ||
|
||
if cluster.ControlPlane().AmiId == amiID { | ||
logger.Infof("AmiID up to date") | ||
return nil | ||
} | ||
|
||
successMsg := ` | ||
The Flatcar AmiId for region %s and release channel %s is different than the one in cluster definition. | ||
Cluster.yaml: | ||
- amiId: %s | ||
+ amiId: %s | ||
` | ||
logger.Infof(successMsg, region, channel, cluster.ControlPlane().AmiId, amiID) | ||
return nil | ||
} |
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
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 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
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
Oops, something went wrong.