Skip to content

Commit 25ff397

Browse files
HuijingHeicgwalters
authored andcommitted
Change gce to gcp (cosmetic only)
This change might not break pipelines and auto tests.
1 parent 7a1f61e commit 25ff397

20 files changed

+79
-79
lines changed

docs/building-fcos.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ There are various public cloud options that provide either bare metal or nested
3737
virt, such as:
3838

3939
- [Packet](https://www.packet.com/)
40-
- [GCE nested virt](https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances)
40+
- [GCP nested virt](https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances)
4141
- EC2 `i3.metal` instances
4242
- [IBM Bare Metal](https://www.ibm.com/cloud/bare-metal-servers)
4343
- etc.

docs/kola.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Kola is a framework for testing software integration in CoreOS systems
1010
across multiple platforms. It is primarily designed to operate within
1111
the CoreOS Assembler for testing software that has landed in the OS image.
1212

13-
Kola supports running tests on multiple platforms, currently QEMU, GCE,
13+
Kola supports running tests on multiple platforms, currently QEMU, GCP,
1414
AWS, VMware VSphere, Packet, and OpenStack. In the future systemd-nspawn and
1515
other platforms may be added.
1616
Local platforms do not rely on access to the Internet as a design
@@ -241,5 +241,5 @@ In order to see the logs for these tests you must enter the `tmp/kola/name_of_th
241241

242242
`kola run -p=gce --gce-image=projects/fedora-coreos-cloud/global/images/fedora-coreos-37-20230227-20-2-gcp-x86-64 --gce-json-key=/data/gce.json --gce-project=fedora-coreos-testing basic` This will run the basic tests on GCP using default machine type `n1-standard-1`.
243243
- `gce-image` is in the format of `projects/<GCP Image Project>/global/images/<GCP Image Name>`, to find related info refer to https://builds.coreos.fedoraproject.org/browser?stream=testing-devel&arch=x86_64.
244-
- `gce-json-key` is using a service account's JSON key for authentication, how to create service account keys refer to https://github.com/coreos/coreos-assembler/blob/main/docs/mantle/credentials.md#gce.
244+
- `gce-json-key` is using a service account's JSON key for authentication, how to create service account keys refer to https://github.com/coreos/coreos-assembler/blob/main/docs/mantle/credentials.md#gcp.
245245
- `gce-project` is meant for testing in the specified project, or it will use the same as `<GCP Image Project>`.

docs/mantle/credentials.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ via the `--azure-credentials` option on the command line.
153153
}
154154
```
155155

156-
## gce
156+
## gcp
157157

158158
If you want to create a service account's JSON key for authentication, refer to [create service account keys](https://cloud.google.com/iam/docs/).
159159

mantle/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ the Container Linux SDK for testing software that has landed in the OS image.
2323
Ideally, all software needed for a test should be included by building
2424
it into the image from the SDK.
2525

26-
Kola supports running tests on multiple platforms, currently QEMU, GCE,
26+
Kola supports running tests on multiple platforms, currently QEMU, GCP,
2727
AWS, VMware VSphere, Packet, and OpenStack. In the future systemd-nspawn and other
2828
platforms may be added.
2929
Local platforms do not rely on access to the Internet as a design
@@ -167,7 +167,7 @@ each with their own command: pre-release and release. Both of these commands are
167167

168168
#### plume pre-release
169169
The pre-release command does as much of the release process as possible without making anything public.
170-
This includes uploading images to cloud providers (except those like gce which don't allow us to upload
170+
This includes uploading images to cloud providers (except those like gcp which don't allow us to upload
171171
images without making them public).
172172

173173
### plume release
@@ -312,8 +312,8 @@ The JSON file exported to the variable `AZURE_AUTH_LOCATION` should be generated
312312
}
313313
```
314314

315-
### gce
316-
`gce` uses `~/.config/gce.json`, which contains a JSON-formatted service
315+
### gcp
316+
`gcp` uses `~/.config/gce.json`, which contains a JSON-formatted service
317317
account key. This can be downloaded from the Google Cloud console under
318318
IAM > Service Accounts > [account] > Keys.
319319

mantle/auth/google.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ import (
2626
"golang.org/x/oauth2/google"
2727
)
2828

29-
const GCEConfigPath = ".config/gce.json"
29+
const GCPConfigPath = ".config/gce.json"
3030

3131
var scopes = []string{
3232
"https://www.googleapis.com/auth/devstorage.full_control",
3333
"https://www.googleapis.com/auth/compute",
3434
}
3535

3636
// GoogleServiceClient fetchs a token from Google Compute Engine's
37-
// metadata service. This should be used on GCE vms. The Default account
37+
// metadata service. This should be used on GCP vms. The Default account
3838
// is used.
3939
func GoogleServiceClient() *http.Client {
4040
return &http.Client{
@@ -56,7 +56,7 @@ func GoogleClientFromKeyFile(path string, scope ...string) (*http.Client, error)
5656
if err != nil {
5757
return nil, err
5858
}
59-
path = filepath.Join(user.HomeDir, GCEConfigPath)
59+
path = filepath.Join(user.HomeDir, GCPConfigPath)
6060
}
6161
b, err := os.ReadFile(path)
6262
if err != nil {

mantle/cmd/kola/kola.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func writeProps() error {
291291
Server string `json:"server"`
292292
BaseVMName string `json:"base_vm_name"`
293293
}
294-
type GCE struct {
294+
type GCP struct {
295295
Image string `json:"image"`
296296
MachineType string `json:"type"`
297297
}
@@ -323,7 +323,7 @@ func writeProps() error {
323323
Azure Azure `json:"azure"`
324324
DO DO `json:"do"`
325325
ESX ESX `json:"esx"`
326-
GCE GCE `json:"gce"`
326+
GCP GCP `json:"gcp"`
327327
OpenStack OpenStack `json:"openstack"`
328328
Packet Packet `json:"packet"`
329329
QEMU QEMU `json:"qemu"`
@@ -355,9 +355,9 @@ func writeProps() error {
355355
Server: kola.ESXOptions.Server,
356356
BaseVMName: kola.ESXOptions.BaseVMName,
357357
},
358-
GCE: GCE{
359-
Image: kola.GCEOptions.Image,
360-
MachineType: kola.GCEOptions.MachineType,
358+
GCP: GCP{
359+
Image: kola.GCPOptions.Image,
360+
MachineType: kola.GCPOptions.MachineType,
361361
},
362362
OpenStack: OpenStack{
363363
Region: kola.OpenStackOptions.Region,
@@ -605,7 +605,7 @@ func syncFindParentImageOptions() error {
605605
return err
606606
}
607607
case "gce":
608-
kola.GCEOptions.Image, err = parentCosaBuild.FindGCPImage()
608+
kola.GCPOptions.Image, err = parentCosaBuild.FindGCPImage()
609609
if err != nil {
610610
return err
611611
}

mantle/cmd/kola/options.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ func init() {
113113
sv(&kola.ESXOptions.Profile, "esx-profile", "", "ESX profile (default \"default\")")
114114
sv(&kola.ESXOptions.BaseVMName, "esx-base-vm", "", "ESX base VM name")
115115

116-
// gce-specific options
117-
sv(&kola.GCEOptions.Image, "gce-image", "", "GCE image, full api endpoints names are accepted if resource is in a different project")
118-
sv(&kola.GCEOptions.Project, "gce-project", "fedora-coreos-devel", "GCE project name")
119-
sv(&kola.GCEOptions.Zone, "gce-zone", "us-central1-a", "GCE zone name")
120-
sv(&kola.GCEOptions.MachineType, "gce-machinetype", "n1-standard-1", "GCE machine type")
121-
sv(&kola.GCEOptions.DiskType, "gce-disktype", "pd-ssd", "GCE disk type")
122-
sv(&kola.GCEOptions.Network, "gce-network", "default", "GCE network")
123-
sv(&kola.GCEOptions.ServiceAcct, "gce-service-account", "", "GCE service account to attach to instance (default project default)")
124-
bv(&kola.GCEOptions.ServiceAuth, "gce-service-auth", false, "for non-interactive auth when running within GCE")
125-
sv(&kola.GCEOptions.JSONKeyFile, "gce-json-key", "", "use a service account's JSON key for authentication (default \"~/"+auth.GCEConfigPath+"\")")
116+
// gcp-specific options
117+
sv(&kola.GCPOptions.Image, "gce-image", "", "GCP image, full api endpoints names are accepted if resource is in a different project")
118+
sv(&kola.GCPOptions.Project, "gce-project", "fedora-coreos-devel", "GCP project name")
119+
sv(&kola.GCPOptions.Zone, "gce-zone", "us-central1-a", "GCP zone name")
120+
sv(&kola.GCPOptions.MachineType, "gce-machinetype", "n1-standard-1", "GCP machine type")
121+
sv(&kola.GCPOptions.DiskType, "gce-disktype", "pd-ssd", "GCP disk type")
122+
sv(&kola.GCPOptions.Network, "gce-network", "default", "GCP network")
123+
sv(&kola.GCPOptions.ServiceAcct, "gce-service-account", "", "GCP service account to attach to instance (default project default)")
124+
bv(&kola.GCPOptions.ServiceAuth, "gce-service-auth", false, "for non-interactive auth when running within GCP")
125+
sv(&kola.GCPOptions.JSONKeyFile, "gce-json-key", "", "use a service account's JSON key for authentication (default \"~/"+auth.GCPConfigPath+"\")")
126126

127127
// openstack-specific options
128128
sv(&kola.OpenStackOptions.ConfigPath, "openstack-config-file", "", "Path to a clouds.yaml formatted OpenStack config file. The underlying library defaults to ./clouds.yaml")
@@ -364,13 +364,13 @@ func syncCosaOptions() error {
364364
}
365365
case "gce":
366366
// Pick up the GCP image from the build metadata
367-
if kola.GCEOptions.Image == "" && kola.CosaBuild.Meta.Gcp != nil {
368-
kola.GCEOptions.Image =
367+
if kola.GCPOptions.Image == "" && kola.CosaBuild.Meta.Gcp != nil {
368+
kola.GCPOptions.Image =
369369
fmt.Sprintf("projects/%s/global/images/%s",
370370
kola.CosaBuild.Meta.Gcp.ImageProject,
371371
kola.CosaBuild.Meta.Gcp.ImageName)
372372

373-
fmt.Printf("Using GCP image %s\n", kola.GCEOptions.Image)
373+
fmt.Printf("Using GCP image %s\n", kola.GCPOptions.Image)
374374
}
375375
}
376376

mantle/cmd/ore/gcloud/create-image.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import (
3131
var (
3232
cmdCreateImage = &cobra.Command{
3333
Use: "create-image",
34-
Short: "Create GCE image",
35-
Long: "Create GCE image from an existing file in Google Storage",
34+
Short: "Create GCP image",
35+
Long: "Create GCP image from an existing file in Google Storage",
3636
Run: runCreateImage,
3737
}
3838

@@ -47,7 +47,7 @@ var (
4747
func init() {
4848
user := os.Getenv("USER")
4949
cmdCreateImage.Flags().StringVar(&createImageFamily, "family",
50-
user, "GCE image group and name prefix")
50+
user, "GCP image group and name prefix")
5151
cmdCreateImage.Flags().StringVar(&createImageBoard, "board",
5252
"amd64-usr", "OS board name")
5353
cmdCreateImage.Flags().StringVar(&createImageVersion, "version",
@@ -56,10 +56,10 @@ func init() {
5656
"gs://users.developer.core-os.net/"+user+"/boards",
5757
"Storage URL prefix")
5858
cmdCreateImage.Flags().StringVar(&createImageName, "source-name",
59-
"coreos_production_gce.tar.gz",
59+
"coreos_production_gcp.tar.gz",
6060
"Storage image name")
6161
cmdCreateImage.Flags().BoolVar(&createImageForce, "force",
62-
false, "overwrite existing GCE images without prompt")
62+
false, "overwrite existing GCP images without prompt")
6363
GCloud.AddCommand(cmdCreateImage)
6464
}
6565

@@ -91,7 +91,7 @@ func runCreateImage(cmd *cobra.Command, args []string) {
9191
bucket := gsURL.Host
9292
imageNameGS := strings.TrimPrefix(path.Join(gsURL.Path,
9393
createImageBoard, createImageVersion, createImageName), "/")
94-
imageNameGCE := gceSanitize(createImageFamily + "-" + createImageVersion)
94+
imageNameGCP := gcpSanitize(createImageFamily + "-" + createImageVersion)
9595

9696
ctx := context.Background()
9797
storageAPI, err := storage.NewService(ctx)
@@ -111,19 +111,19 @@ func runCreateImage(cmd *cobra.Command, args []string) {
111111
os.Exit(1)
112112
}
113113

114-
fmt.Printf("Creating image in GCE: %v...\n", imageNameGCE)
114+
fmt.Printf("Creating image in GCP: %v...\n", imageNameGCP)
115115

116-
// create image on gce
116+
// create image on gcp
117117
storageSrc := fmt.Sprintf("https://storage.googleapis.com/%v/%v", bucket, imageNameGS)
118118
_, pending, err := api.CreateImage(&gcloud.ImageSpec{
119-
Name: imageNameGCE,
119+
Name: imageNameGCP,
120120
SourceImage: storageSrc,
121121
}, createImageForce)
122122
if err == nil {
123123
err = pending.Wait()
124124
}
125125
if err != nil {
126-
fmt.Fprintf(os.Stderr, "Creating GCE image failed: %v\n", err)
126+
fmt.Fprintf(os.Stderr, "Creating GCP image failed: %v\n", err)
127127
os.Exit(1)
128128
}
129129
}

mantle/cmd/ore/gcloud/delete-images.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
var (
2727
cmdDeleteImage = &cobra.Command{
2828
Use: "delete-images <name>...",
29-
Short: "Delete GCE images",
29+
Short: "Delete GCP images",
3030
Run: runDeleteImage,
3131
}
3232
)

mantle/cmd/ore/gcloud/destroy.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
var (
2525
cmdDestroy = &cobra.Command{
2626
Use: "destroy-instances --prefix=<prefix> ",
27-
Short: "destroy cluster on GCE",
28-
Long: "Destroy GCE instances based on name prefix.",
27+
Short: "destroy cluster on GCP",
28+
Long: "Destroy GCP instances based on name prefix.",
2929
Run: runDestroy,
3030
}
3131
)

mantle/cmd/ore/gcloud/gc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
var (
2626
cmdGC = &cobra.Command{
2727
Use: "gc",
28-
Short: "GC resources in GCE",
28+
Short: "GC resources in GCP",
2929
Long: `Delete instances created over the given duration ago.`,
3030
RunE: runGC,
3131

mantle/cmd/ore/gcloud/gcloud.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func init() {
4747
sv(&opts.BaseName, "basename", "kola", "instance name prefix")
4848
sv(&opts.Network, "network", "default", "network name")
4949
sv(&opts.JSONKeyFile, "json-key", "", "use a service account's JSON key for authentication")
50-
GCloud.PersistentFlags().BoolVar(&opts.ServiceAuth, "service-auth", false, "use non-interactive auth when running within GCE")
50+
GCloud.PersistentFlags().BoolVar(&opts.ServiceAuth, "service-auth", false, "use non-interactive auth when running within GCP")
5151

5252
cli.WrapPreRun(GCloud, preauth)
5353
}

mantle/cmd/ore/gcloud/image.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
var (
2626
cmdImage = &cobra.Command{
2727
Use: "list-images --prefix=<prefix>",
28-
Short: "List images in GCE",
28+
Short: "List images in GCP",
2929
Run: runImage,
3030
}
3131

mantle/cmd/ore/gcloud/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
var (
2727
cmdList = &cobra.Command{
2828
Use: "list-instances --prefix=<prefix>",
29-
Short: "List instances on GCE",
29+
Short: "List instances on GCP",
3030
Run: runList,
3131
}
3232
)

mantle/cmd/ore/gcloud/upload.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var (
3333
cmdUpload = &cobra.Command{
3434
Use: "upload",
3535
Short: "Upload os image",
36-
Long: "Upload os image to Google Storage bucket and create image in GCE. Intended for use in SDK.",
36+
Long: "Upload os image to Google Storage bucket and create image in GCP. Intended for use in SDK.",
3737
Run: runUpload,
3838
}
3939

@@ -62,7 +62,7 @@ func init() {
6262
if err := cmdUpload.MarkFlagRequired("file"); err != nil {
6363
panic(err)
6464
}
65-
cmdUpload.Flags().BoolVar(&uploadForce, "force", false, "overwrite existing GS and GCE images without prompt")
65+
cmdUpload.Flags().BoolVar(&uploadForce, "force", false, "overwrite existing GS and GCP images without prompt")
6666
cmdUpload.Flags().StringVar(&uploadWriteUrl, "write-url", "", "output the uploaded URL to the named file")
6767
cmdUpload.Flags().StringVar(&uploadImageFamily, "family", "", "GCP image family to attach image to")
6868
cmdUpload.Flags().StringVar(&uploadImageDescription, "description", "", "The description that should be attached to the image")
@@ -101,8 +101,8 @@ func runUpload(cmd *cobra.Command, args []string) {
101101
uploadBucket = gsURL.Host
102102
imageNameGS := strings.TrimPrefix(gsURL.Path+"/"+uploadImageName, "/") + ".tar.gz"
103103

104-
// Sanitize the image name for GCE
105-
imageNameGCE := gceSanitize(uploadImageName)
104+
// Sanitize the image name for GCP
105+
imageNameGCP := gcpSanitize(uploadImageName)
106106

107107
ctx := context.Background()
108108
storageAPI, err := storage.NewService(ctx, option.WithHTTPClient(api.Client()))
@@ -143,9 +143,9 @@ func runUpload(cmd *cobra.Command, args []string) {
143143
imageStorageURL := fmt.Sprintf("https://storage.googleapis.com/%v/%v", uploadBucket, imageNameGS)
144144

145145
if uploadCreateImage {
146-
fmt.Printf("Creating image in GCE: %v...\n", imageNameGCE)
146+
fmt.Printf("Creating image in GCP: %v...\n", imageNameGCP)
147147
spec := &gcloud.ImageSpec{
148-
Name: imageNameGCE,
148+
Name: imageNameGCP,
149149
Family: uploadImageFamily,
150150
SourceImage: imageStorageURL,
151151
Description: uploadImageDescription,
@@ -161,7 +161,7 @@ func runUpload(cmd *cobra.Command, args []string) {
161161
// if image already exists ask to delete and try again
162162
if err != nil && strings.HasSuffix(err.Error(), "alreadyExists") {
163163
var ans string
164-
fmt.Printf("Image %v already exists on GCE. Overwrite? (y/n):", imageNameGCE)
164+
fmt.Printf("Image %v already exists on GCP. Overwrite? (y/n):", imageNameGCP)
165165
if _, err = fmt.Scan(&ans); err != nil {
166166
fmt.Fprintf(os.Stderr, "Scanning overwrite input: %v", err)
167167
os.Exit(1)
@@ -174,25 +174,25 @@ func runUpload(cmd *cobra.Command, args []string) {
174174
err = pending.Wait()
175175
}
176176
if err != nil {
177-
fmt.Fprintf(os.Stderr, "Creating GCE image failed: %v\n", err)
177+
fmt.Fprintf(os.Stderr, "Creating GCP image failed: %v\n", err)
178178
os.Exit(1)
179179
}
180-
fmt.Printf("Image %v sucessfully created in GCE\n", imageNameGCE)
180+
fmt.Printf("Image %v sucessfully created in GCP\n", imageNameGCP)
181181
default:
182-
fmt.Println("Skipped GCE image creation")
182+
fmt.Println("Skipped GCP image creation")
183183
}
184184
}
185185
if err != nil {
186-
fmt.Fprintf(os.Stderr, "Creating GCE image failed: %v\n", err)
186+
fmt.Fprintf(os.Stderr, "Creating GCP image failed: %v\n", err)
187187
os.Exit(1)
188188
}
189189

190190
// If requested, set the image ACL to public
191191
if uploadPublic {
192-
fmt.Printf("Setting image to have public access: %v\n", imageNameGCE)
193-
err = api.SetImagePublic(imageNameGCE)
192+
fmt.Printf("Setting image to have public access: %v\n", imageNameGCP)
193+
err = api.SetImagePublic(imageNameGCP)
194194
if err != nil {
195-
fmt.Fprintf(os.Stderr, "Marking GCE image with public ACLs failed: %v\n", err)
195+
fmt.Fprintf(os.Stderr, "Marking GCP image with public ACLs failed: %v\n", err)
196196
os.Exit(1)
197197
}
198198
}
@@ -208,11 +208,11 @@ func runUpload(cmd *cobra.Command, args []string) {
208208

209209
}
210210

211-
// Converts an image name from Google Storage to an equivalent GCE image
212-
// name. NOTE: Not a fully generlized sanitizer for GCE. Designed for
211+
// Converts an image name from Google Storage to an equivalent GCP image
212+
// name. NOTE: Not a fully generlized sanitizer for GCP. Designed for
213213
// the default version.txt name (ex: 633.1.0+2015-03-31-1538). See:
214214
// https://godoc.org/google.golang.org/api/compute/v1#Image
215-
func gceSanitize(name string) string {
215+
func gcpSanitize(name string) string {
216216
if name == "" {
217217
return name
218218
}

0 commit comments

Comments
 (0)