Skip to content

Commit

Permalink
Provisioner: Add support to fetch kbs pod ip
Browse files Browse the repository at this point in the history
Fixes: confidential-containers#1471
Signed-off-by: Kartik Joshi <kartikjoshi@microsoft.com>
  • Loading branch information
kartikjoshi21 authored and root committed Dec 21, 2023
1 parent 9366722 commit 82f8a0e
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 107 deletions.
1 change: 1 addition & 0 deletions install/overlays/azure/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ configMapGenerator:
# /subscriptions/<AZURE_SUBSCRIPTION_ID>/resourceGroups/<AZURE_RESOURCE_GROUP>/providers/Microsoft.Compute/images/<AZURE_IMAGE>
- AZURE_IMAGE_ID="" #set
- SSH_USERNAME="" #set peer pod vm admin user name
- AA_KBC_PARAMS="" #set
#- DISABLECVM="" # Uncomment it if you want a generic VM
#- PAUSE_IMAGE="" # Uncomment and set if you want to use a specific pause image
#- VXLAN_PORT="" # Uncomment and set if you want to use a specific vxlan port. Defaults to 4789
Expand Down
22 changes: 16 additions & 6 deletions test/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package e2e

import (
"context"
"fmt"
"os"
"testing"

Expand Down Expand Up @@ -81,9 +82,6 @@ func TestMain(m *testing.M) {
// the VPC images storage.
podvmImage := os.Getenv("TEST_PODVM_IMAGE")

kbsImage := os.Getenv("TEST_KBS_IMAGE")
kbsImageTag := os.Getenv("TEST_KBS_IMAGE_TAG")

// The TEST_PROVISION_FILE is an optional variable which specifies the path
// to the provision properties file. The file must have the format:
//
Expand Down Expand Up @@ -118,6 +116,8 @@ func TestMain(m *testing.M) {
testEnv.Setup(func(ctx context.Context, cfg *envconf.Config) (context.Context, error) {
log.Info("Do setup")
var err error
// Get properties
props := provisioner.GetProperties(ctx, cfg)

if shouldProvisionCluster {
log.Info("Cluster provisioning")
Expand All @@ -132,14 +132,24 @@ func TestMain(m *testing.M) {

if shouldDeployKbs {
log.Info("Deploying kbs")
if props["KBS_IMAGE"] == "" || props["KBS_IMAGE_TAG"] == "" {
return ctx, fmt.Errorf("kbs image not provided")
}

if keyBrokerService, err = pv.NewKeyBrokerService(cloudProvider); err != nil {
if keyBrokerService, err = pv.NewKeyBrokerService(props["CLUSTER_NAME"]); err != nil {
return ctx, err
}

if err = keyBrokerService.Deploy(ctx, kbsImage, kbsImageTag); err != nil {
if err = keyBrokerService.Deploy(ctx, cfg, props); err != nil {
return ctx, err
}
var kbsPodIP string
if kbsPodIP, err = keyBrokerService.GetKbsPodIP(ctx, cfg); err != nil {
return ctx, err
}

kbsparams := "cc_kbc::http:" + kbsPodIP + ":8080"
props["AA_KBC_PARAMS"] = kbsparams
}

if podvmImage != "" {
Expand Down Expand Up @@ -186,7 +196,7 @@ func TestMain(m *testing.M) {
}

if shouldDeployKbs {
if err = keyBrokerService.Delete(ctx); err != nil {
if err = keyBrokerService.Delete(ctx, cfg); err != nil {
return ctx, err
}
}
Expand Down
Loading

0 comments on commit 82f8a0e

Please sign in to comment.