mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-11 07:29:29 -05:00
image: upload OpenStack images to OpenStack
This commit is contained in:
parent
6f9020d527
commit
75f16ce87b
63
flake.lock
generated
63
flake.lock
generated
@ -18,40 +18,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_2": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1701680307,
|
|
||||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1704008649,
|
|
||||||
"narHash": "sha256-rGPSWjXTXTurQN9beuHdyJhB8O761w1Zc5BqSSmHvoM=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "d44d59d2b5bd694cd9d996fd8c51d03e3e9ba7f7",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgsUnstable": {
|
"nixpkgsUnstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1706173671,
|
"lastModified": 1706173671,
|
||||||
@ -90,32 +56,21 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"uplosi": {
|
"uplosi": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": [
|
||||||
"nixpkgs": "nixpkgs"
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgsUnstable"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1706283202,
|
"lastModified": 1708338970,
|
||||||
"narHash": "sha256-vQq8589wzi9aUYgoqyOl/oYgmyq0TB4e9A4E6SaIwgs=",
|
"narHash": "sha256-eX86SesWRQN7S5g6sXgKG5Q6KJLcip2MxJIIIM1Lj+E=",
|
||||||
"owner": "edgelesssys",
|
"owner": "edgelesssys",
|
||||||
"repo": "uplosi",
|
"repo": "uplosi",
|
||||||
"rev": "9730d61d4216607eb7f8d38e21507790b7fa5a9a",
|
"rev": "32e47c6d2445cdc76b8458f785b921431c2ae609",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
};
|
};
|
||||||
uplosi = {
|
uplosi = {
|
||||||
url = "github:edgelesssys/uplosi";
|
url = "github:edgelesssys/uplosi";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgsUnstable";
|
||||||
|
inputs.flake-utils.follows = "flake-utils";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ func runUplosi(cmd *cobra.Command, _ []string) error {
|
|||||||
|
|
||||||
var uploadC uploader
|
var uploadC uploader
|
||||||
switch flags.provider {
|
switch flags.provider {
|
||||||
case cloudprovider.AWS, cloudprovider.Azure, cloudprovider.GCP:
|
case cloudprovider.AWS, cloudprovider.Azure, cloudprovider.GCP, cloudprovider.OpenStack:
|
||||||
uploadC = uplosiupload.New(flags.uplosiPath, log)
|
uploadC = uplosiupload.New(flags.uplosiPath, log)
|
||||||
default:
|
default:
|
||||||
uploadC = nopupload.New(log)
|
uploadC = nopupload.New(log)
|
||||||
|
@ -19,3 +19,8 @@ publisher = "edgelesssys"
|
|||||||
project = "constellation-images"
|
project = "constellation-images"
|
||||||
location = "europe-west3"
|
location = "europe-west3"
|
||||||
bucket = "constellation-os-images"
|
bucket = "constellation-os-images"
|
||||||
|
|
||||||
|
[base.openstack]
|
||||||
|
cloud = "stackit"
|
||||||
|
visibility = "private"
|
||||||
|
properties = { "hw_firmware_type" = "uefi", "os_type" = "linux" }
|
||||||
|
@ -82,12 +82,14 @@ func prepareUplosiConfig(req *osimage.UploadRequest) ([]byte, error) {
|
|||||||
awsConfig := baseConfig["aws"].(map[string]any)
|
awsConfig := baseConfig["aws"].(map[string]any)
|
||||||
azureConfig := baseConfig["azure"].(map[string]any)
|
azureConfig := baseConfig["azure"].(map[string]any)
|
||||||
gcpConfig := baseConfig["gcp"].(map[string]any)
|
gcpConfig := baseConfig["gcp"].(map[string]any)
|
||||||
|
openstackConfig := baseConfig["openstack"].(map[string]any)
|
||||||
|
|
||||||
baseConfig["imageVersion"] = imageVersionStr
|
baseConfig["imageVersion"] = imageVersionStr
|
||||||
baseConfig["provider"] = strings.ToLower(req.Provider.String())
|
baseConfig["provider"] = strings.ToLower(req.Provider.String())
|
||||||
extendAWSConfig(awsConfig, req.Version, req.AttestationVariant, req.Timestamp)
|
extendAWSConfig(awsConfig, req.Version, req.AttestationVariant, req.Timestamp)
|
||||||
extendAzureConfig(azureConfig, req.Version, req.AttestationVariant, req.Timestamp)
|
extendAzureConfig(azureConfig, req.Version, req.AttestationVariant, req.Timestamp)
|
||||||
extendGCPConfig(gcpConfig, req.Version, req.AttestationVariant)
|
extendGCPConfig(gcpConfig, req.Version, req.AttestationVariant)
|
||||||
|
extendOpenStackConfig(openstackConfig, req.Version, req.AttestationVariant)
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
if err := toml.NewEncoder(buf).Encode(config); err != nil {
|
if err := toml.NewEncoder(buf).Encode(config); err != nil {
|
||||||
@ -264,6 +266,10 @@ func extendGCPConfig(gcpConfig map[string]any, version versionsapi.Version, atte
|
|||||||
gcpConfig["blobName"] = gcpImageName(version, attestationVariant) + ".tar.gz"
|
gcpConfig["blobName"] = gcpImageName(version, attestationVariant) + ".tar.gz"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func extendOpenStackConfig(openstackConfig map[string]any, version versionsapi.Version, attestationVariant string) {
|
||||||
|
openstackConfig["imageName"] = fmt.Sprintf("constellation-%s-%s-%s", version.Stream(), version.Version(), attestationVariant)
|
||||||
|
}
|
||||||
|
|
||||||
func gcpImageFamily(version versionsapi.Version) string {
|
func gcpImageFamily(version versionsapi.Version) string {
|
||||||
if version.Stream() == "stable" {
|
if version.Stream() == "stable" {
|
||||||
return "constellation"
|
return "constellation"
|
||||||
|
Loading…
Reference in New Issue
Block a user