Skip to content

Commit

Permalink
feat: adding support for ceph S3 backends
Browse files Browse the repository at this point in the history
  • Loading branch information
drew-viles authored May 16, 2023
1 parent 48849dd commit 705fb70
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion baski-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ cloud:
# The rootfs-UUID. In testing this has only been required for bare-metal instances as the bare-metal instance needs know about the rootfs, so it knows what to boot.
rootfs-uuid: "ROOT_FS_UUID"

# Baski presumes there is an S3 endpoint available for the pulling of any items such as the ..trivyignore and nvidia files.
# Baski presumes there is an S3 endpoint available for the pulling of any items such as the .trivyignore and nvidia files.
# This is because the image builder defaults to this for the Nvidia support, and it is presumed that most if not all people can have/can set up an S3 endpoint for authenticated storage.
s3:
endpoint: "S3_ENDPOINT_URL"
access-key: "ACCESS_KEY"
secret-key: "SECRET_KEY"
# If the S3 endpoint is being used, set this to true to instruct the aws ansible role to do the same.
is-ceph: true

# Build stage options.
build:
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/util/flags/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ type S3Flags struct {
Endpoint string
AccessKey string
SecretKey string
IsCeph bool
}

func (o *S3Flags) SetOptionsFromViper() {
o.Endpoint = viper.GetString(fmt.Sprintf("%s.endpoint", viperS3Prefix))
o.AccessKey = viper.GetString(fmt.Sprintf("%s.access-key", viperS3Prefix))
o.SecretKey = viper.GetString(fmt.Sprintf("%s.secret-key", viperS3Prefix))
o.IsCeph = viper.GetBool(fmt.Sprintf("%s.is-ceph", viperS3Prefix))

}

func (o *S3Flags) AddFlags(cmd *cobra.Command, imageBuilderRepo string) {
StringVarWithViper(cmd, &o.Endpoint, viperS3Prefix, "endpoint", "", "The endpoint of the bucket from which to download resources")
StringVarWithViper(cmd, &o.AccessKey, viperS3Prefix, "access-key", "", "The access key used to access the bucket from which to download resources")
StringVarWithViper(cmd, &o.SecretKey, viperS3Prefix, "secret-key", "", "The secret key used to access the bucket from which to download resources")
BoolVarWithViper(cmd, &o.IsCeph, viperS3Prefix, "is-ceph", false, "If the S3 endpoint is CEPH then set this to true to allow ansible to work with the endpoint")

cmd.MarkFlagsRequiredTogether("endpoint", "access-key", "secret-key")
}
4 changes: 2 additions & 2 deletions pkg/openstack/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ func InitPackerConfig(o *flags.BuildOptions) *PackerBuildConfig {

if o.AddNvidiaSupport {
customRoles = "nvidia"
ansibleUserVars = fmt.Sprintf("nvidia_s3_url=%s nvidia_bucket=%s nvidia_bucket_access=%s nvidia_bucket_secret=%s nvidia_installer_location=%s nvidia_tok_location=%s gridd_feature_type=%d",
ansibleUserVars = fmt.Sprintf("nvidia_s3_url=%s nvidia_bucket=%s nvidia_bucket_access=%s nvidia_bucket_secret=%s nvidia_ceph=%t nvidia_installer_location=%s nvidia_tok_location=%s gridd_feature_type=%d",
o.Endpoint,
o.NvidiaBucket,
o.AccessKey,
o.SecretKey,
o.IsCeph,
o.NvidiaInstallerLocation,
o.NvidiaTOKLocation,
o.NvidiaGriddFeatureType)
fmt.Println(ansibleUserVars)
}

if o.AddFalco || o.AddTrivy {
Expand Down

0 comments on commit 705fb70

Please sign in to comment.