some final fixes and documentation work
This commit is contained in:
parent
a0285a1f4a
commit
6d6d262308
|
@ -9,6 +9,7 @@ import (
|
|||
)
|
||||
|
||||
const imageListDefault = "/oracle/public/OL_7.2_UEKR4_x86_64"
|
||||
const imageListEntryDefault = 5
|
||||
const usernameDefault = "opc"
|
||||
const shapeDefault = "oc3"
|
||||
const uploadImageCommandDefault = `
|
||||
|
@ -71,16 +72,9 @@ type PVConfig struct {
|
|||
// Builder Image
|
||||
BuilderShape string `mapstructure:"builder_shape"`
|
||||
BuilderImageList string `mapstructure:"builder_image_list"`
|
||||
BuilderImageListEntry int `mapstructure:"builder_image_list_entry"`
|
||||
BuilderImageListEntry *int `mapstructure:"builder_image_list_entry"`
|
||||
|
||||
BuilderComm communicator.Config `mapstructure:"builder_communicator"`
|
||||
/* TODO:
|
||||
* Documentation
|
||||
* split master/builder image/connection config. i.e. build anything, master only linux
|
||||
possible ignore everything for builder and always use SSH keys
|
||||
* Need to prepare the ssh config
|
||||
* Possible also to just have nested config?
|
||||
*/
|
||||
}
|
||||
|
||||
// IsPV tells us if we're using a persistent volume for this build
|
||||
|
@ -121,8 +115,12 @@ func (c *PVConfig) Prepare(ctx *interpolate.Context) (errs *packer.MultiError) {
|
|||
|
||||
// Entry 5 is a working default, so let's set it if the entry is unset and
|
||||
// we're using the default image list
|
||||
if c.BuilderImageList == imageListDefault && c.BuilderImageListEntry == 0 {
|
||||
c.BuilderImageListEntry = 5
|
||||
if c.BuilderImageListEntry == nil {
|
||||
var entry int
|
||||
if c.BuilderImageList == imageListDefault {
|
||||
entry = imageListEntryDefault
|
||||
}
|
||||
c.BuilderImageListEntry = &entry
|
||||
}
|
||||
|
||||
if c.BuilderUploadImageCommand == "" {
|
||||
|
|
|
@ -47,7 +47,7 @@ func (s *stepCreatePVBuilder) Run(_ context.Context, state multistep.StateBag) m
|
|||
},
|
||||
ImageList: config.BuilderImageList,
|
||||
SSHKeys: []string{config.Comm.SSHKeyPairName},
|
||||
Entry: config.BuilderImageListEntry,
|
||||
Entry: *config.BuilderImageListEntry,
|
||||
}
|
||||
|
||||
instanceInfo, err := instanceClient.CreateInstance(input)
|
||||
|
|
|
@ -59,6 +59,9 @@ builder. This builder currently only works with the SSH communicator.
|
|||
CLI, as described
|
||||
[here](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stopc/image-lists-stclr-and-nmcli.html#GUID-DB7E75FE-F752-4FF7-AB70-3C8DCDFCA0FA)
|
||||
|
||||
- `source_image_list_entry` (string) - The entry identifying the machine
|
||||
image to use in the image list. Defaults to the latest available entry.
|
||||
|
||||
- `password` (string) - Your account password.
|
||||
|
||||
- `shape` (string) - The template that determines the number of CPUs, amount
|
||||
|
@ -118,16 +121,20 @@ becomes your machine image. This relies on the disk of the created instance
|
|||
being large enough to perform your entire provisioning process. If that disk
|
||||
size isn't sufficient, we can build with a persistent volume of arbitrary size.
|
||||
|
||||
The way it works is that we create a persistent volume of the requested size.
|
||||
This volume is bootable and initialized with your image list. We start an
|
||||
instance with this volume as the boot volume. After this instance launches, we
|
||||
provision and terminate it, leaving the persistent volume around.
|
||||
First, we create a persistent volume of the requested size. This volume is
|
||||
bootable and initialized with your image list. We start an instance with this
|
||||
volume as the boot volume. After this instance launches, we provision and
|
||||
terminate it, leaving the persistent volume around.
|
||||
|
||||
Next, we create a second instance, the "builder", this time booting from
|
||||
instance storage. We also attach a new persistent volume to it, making it twice
|
||||
the size of the original. We connect to this instance and copy the contents of
|
||||
the first volume into a tarball file on the second volume. We can upload this
|
||||
file to Object Storage Classic, and create a new machine image with it.
|
||||
instance storage. We also attach a new persistent volume, making it twice the
|
||||
size of the original. We connect to this instance and copy the contents of the
|
||||
first volume into a tarball file on the second volume. We then upload this file
|
||||
to Object Storage Classic, and create a new machine image with it.
|
||||
|
||||
For more details, see this [blog
|
||||
post](https://blogs.oracle.com/cloudmarketplace/creating-an-oracle-compute-machine-image-from-an-instance-with-persistent-boot-storage),
|
||||
which discusses the strategy used here.
|
||||
|
||||
If this is set, a few more options become available.
|
||||
|
||||
|
@ -156,7 +163,8 @@ If this is set, a few more options become available.
|
|||
- `builder_image_list_entry` (string) - The entry identifying the machine
|
||||
image to use in the image list. If `builder_image_list` is unset, this
|
||||
defaults to `5`, which is a working image as of this time. Otherwise, it
|
||||
defaults to 0, which
|
||||
defaults to the latest entry. Set this to `0` to force it to use the latest
|
||||
entry when using the default `builder_image_list`.
|
||||
|
||||
- `builder_shape` (string) - The template that determines the number of CPUs,
|
||||
amount of memory, and other resources allocated to the builder instance.
|
||||
|
|
Loading…
Reference in New Issue