From a047d0997d9814dec33245539935919b4974c648 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 2 Jan 2024 10:33:02 +0000 Subject: [PATCH 01/12] change persistent directory name to sdp-persistent-key-perisstent-key-hash --- .../enclave_object_attributes_provider.go | 3 ++- .../enclave_object_attributes_provider.go | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/enclave_object_attributes_provider.go b/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/enclave_object_attributes_provider.go index c6840ef219..86ad7c4330 100644 --- a/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/enclave_object_attributes_provider.go +++ b/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/enclave_object_attributes_provider.go @@ -27,7 +27,7 @@ const ( apiContainerNamePrefix = "kurtosis-api" artifactExpansionVolumeNameFragment = "files-artifact-expansion" - persistentServiceDirectoryNameFragment = "service-persistent-directory" + persistentServiceDirectoryNameFragment = "spd" artifactsExpanderContainerNameFragment = "files-artifacts-expander" logsCollectorFragment = "kurtosis-logs-collector" @@ -340,6 +340,7 @@ func (provider *dockerEnclaveObjectAttributesProviderImpl) ForSinglePersistentDi name, err := provider.getNameForEnclaveObject([]string{ persistentServiceDirectoryNameFragment, + string(persistentKey), persistentKeyHash, }) if err != nil { diff --git a/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/enclave_object_attributes_provider.go b/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/enclave_object_attributes_provider.go index 6ac31c84b8..0de45bdfea 100644 --- a/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/enclave_object_attributes_provider.go +++ b/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/enclave_object_attributes_provider.go @@ -25,7 +25,7 @@ const ( enclaveDataDirFragment = "enclave-data-dir" - persistentServiceDirectoryNameFragment = "service-persistent-directory" + persistentServiceDirectoryNameFragment = "spd" traefikIngressRouterEntrypointsValue = "web" ) @@ -264,7 +264,7 @@ func (provider *kubernetesEnclaveObjectAttributesProviderImpl) ForSinglePersiste //No userServiceService annotations. annotations := map[*kubernetes_annotation_key.KubernetesAnnotationKey]*kubernetes_annotation_value.KubernetesAnnotationValue{} - name, err := getKubernetesPersistentDirectoryName(persistentKeyHash) + name, err := getKubernetesPersistentDirectoryName(string(persistentKey), persistentKeyHash) if err != nil { return nil, stacktrace.Propagate(err, "Failed to create service persistent directory name for hash: '%s'", persistentKeyHash) } @@ -329,12 +329,14 @@ func getKubernetesObjectName( } func getKubernetesPersistentDirectoryName( - persistentServiceDirectoryName string, + persistentKey string, + persistentKeyHash string, ) (*kubernetes_object_name.KubernetesObjectName, error) { name, err := getCompositeKubernetesObjectName( []string{ persistentServiceDirectoryNameFragment, - persistentServiceDirectoryName, + persistentKey, + persistentKeyHash, }) return name, err } From feec842936be635c8b363e6b44b6242136cfd670 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 2 Jan 2024 11:34:48 +0000 Subject: [PATCH 02/12] change persistent directory name to be just the name of the persistent_key --- .../enclave_object_attributes_provider.go | 12 +----------- .../enclave_object_attributes_provider.go | 7 +------ 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/enclave_object_attributes_provider.go b/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/enclave_object_attributes_provider.go index 86ad7c4330..549dff52cd 100644 --- a/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/enclave_object_attributes_provider.go +++ b/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/enclave_object_attributes_provider.go @@ -1,8 +1,6 @@ package object_attributes_provider import ( - "crypto/md5" - "encoding/hex" "fmt" "net" "strconv" @@ -26,8 +24,7 @@ const ( networkPrefix = "kt-" apiContainerNamePrefix = "kurtosis-api" - artifactExpansionVolumeNameFragment = "files-artifact-expansion" - persistentServiceDirectoryNameFragment = "spd" + artifactExpansionVolumeNameFragment = "files-artifact-expansion" artifactsExpanderContainerNameFragment = "files-artifacts-expander" logsCollectorFragment = "kurtosis-logs-collector" @@ -333,15 +330,8 @@ func (provider *dockerEnclaveObjectAttributesProviderImpl) ForSinglePersistentDi return nil, stacktrace.Propagate(err, "An error occurred generating a UUID for the persistent directory volume for service '%v'", serviceUuidStr) } - hasher := md5.New() - hasher.Write([]byte(serviceUUID)) - hasher.Write([]byte(persistentKey)) - persistentKeyHash := hex.EncodeToString(hasher.Sum(nil)) - name, err := provider.getNameForEnclaveObject([]string{ - persistentServiceDirectoryNameFragment, string(persistentKey), - persistentKeyHash, }) if err != nil { return nil, stacktrace.Propagate(err, "An error occurred creating the files artifact expansion volume name object using GUID '%v' and service GUID '%v'", guidStr, serviceUuidStr) diff --git a/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/enclave_object_attributes_provider.go b/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/enclave_object_attributes_provider.go index 0de45bdfea..88c2c4493d 100644 --- a/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/enclave_object_attributes_provider.go +++ b/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/enclave_object_attributes_provider.go @@ -25,8 +25,6 @@ const ( enclaveDataDirFragment = "enclave-data-dir" - persistentServiceDirectoryNameFragment = "spd" - traefikIngressRouterEntrypointsValue = "web" ) @@ -264,7 +262,7 @@ func (provider *kubernetesEnclaveObjectAttributesProviderImpl) ForSinglePersiste //No userServiceService annotations. annotations := map[*kubernetes_annotation_key.KubernetesAnnotationKey]*kubernetes_annotation_value.KubernetesAnnotationValue{} - name, err := getKubernetesPersistentDirectoryName(string(persistentKey), persistentKeyHash) + name, err := getKubernetesPersistentDirectoryName(string(persistentKey)) if err != nil { return nil, stacktrace.Propagate(err, "Failed to create service persistent directory name for hash: '%s'", persistentKeyHash) } @@ -330,13 +328,10 @@ func getKubernetesObjectName( func getKubernetesPersistentDirectoryName( persistentKey string, - persistentKeyHash string, ) (*kubernetes_object_name.KubernetesObjectName, error) { name, err := getCompositeKubernetesObjectName( []string{ - persistentServiceDirectoryNameFragment, persistentKey, - persistentKeyHash, }) return name, err } From 8a75d9a69336bcc1aeeb53594b82fafaea5c0ec8 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 2 Jan 2024 11:48:23 +0000 Subject: [PATCH 03/12] added validation --- .../persistent_directories.go | 24 +++++++++++++++++++ .../add_service/add_service_shared.go | 19 +++++++++++++++ test.star | 7 ++++++ 3 files changed, 50 insertions(+) create mode 100644 test.star diff --git a/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go b/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go index fc96d20a45..4a5ea5f621 100644 --- a/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go +++ b/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go @@ -1,5 +1,25 @@ package service_directory +import "regexp" + +const ( + // PersistentKeyRegex implements RFC-1035 for naming persistent directory keys, namely: + // * contain at most 63 characters + // * contain only lowercase alphanumeric characters or '-' + // * start with an alphabetic character + // * end with an alphanumeric character + // The adoption of RFC-1035 is to maintain compatability with current Kubernetes service and pod naming standards: + // We use this over RFC-1035 as Service Names require 1035 to be followed + // https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names + // https://kubernetes.io/docs/concepts/services-networking/service/ + PersistentKeyRegex = "[a-z]([-a-z0-9]{0,61}[a-z0-9])?" + WordWrappedPersistentKeyRegex = "^" + PersistentKeyRegex + "$" +) + +var ( + compiledWordWrappedPersistentKeyRegex = regexp.MustCompile(WordWrappedPersistentKeyRegex) +) + type DirectoryPersistentKey string type DirectoryPersistentSize int64 @@ -17,3 +37,7 @@ func NewPersistentDirectories(persistentDirectories map[string]PersistentDirecto ServiceDirpathToPersistentDirectory: persistentDirectories, } } + +func IsPersistentKeyValid(persistentKey DirectoryPersistentKey) bool { + return compiledWordWrappedPersistentKeyRegex.MatchString(string(persistentKey)) +} diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go index c9e6192026..35e2fc09aa 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/service" + "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/service_directory" "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/service_network" "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/kurtosis_instruction/shared_helpers" "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/kurtosis_instruction/shared_helpers/magic_string_helper" @@ -70,6 +71,14 @@ func validateSingleService(validatorEnvironment *startosis_validator.ValidatorEn return startosis_errors.NewValidationError(invalidServiceNameErrorText(serviceName)) } + if persistentDirectories := serviceConfig.GetPersistentDirectories(); persistentDirectories != nil { + for _, directory := range persistentDirectories.ServiceDirpathToPersistentDirectory { + if !service_directory.IsPersistentKeyValid(directory.PersistentKey) { + return startosis_errors.NewValidationError(invalidPersistentKeyErrorText(directory.PersistentKey)) + } + } + } + if validatorEnvironment.DoesServiceNameExist(serviceName) == startosis_validator.ComponentCreatedOrUpdatedDuringPackageRun { return startosis_errors.NewValidationError("There was an error validating '%s' as service with the name '%s' already exists inside the package. Adding two different services with the same name isn't allowed; we recommend prefixing/suffixing the two service names or using two different names entirely.", AddServiceBuiltinName, serviceName) } @@ -117,6 +126,16 @@ func invalidServiceNameErrorText( ) } +func invalidPersistentKeyErrorText( + persistentKey service_directory.DirectoryPersistentKey, +) string { + return fmt.Sprintf( + "Persistent Key '%v' is invalid as it contains disallowed characters. Persistent Key must adhere to the RFC 1035 standard, specifically implementing this regex and be 1-63 characters long: %s. This means the service name must only contain lowercase alphanumeric characters or '-', and must start with a lowercase alphabet and end with a lowercase alphanumeric character.", + persistentKey, + service_directory.WordWrappedPersistentKeyRegex, + ) +} + func replaceMagicStrings( runtimeValueStore *runtime_value_store.RuntimeValueStore, serviceName service.ServiceName, diff --git a/test.star b/test.star new file mode 100644 index 0000000000..48fbf46e90 --- /dev/null +++ b/test.star @@ -0,0 +1,7 @@ +def run(plan): + plan.add_service( + name = "this_is_not_valid", + config = ServiceConfig( + image = "postgres:15.2-alpine" + ) + ) \ No newline at end of file From cc972eccc89f66417b1ee026338d929f2d9f4226 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 2 Jan 2024 12:49:37 +0000 Subject: [PATCH 04/12] made key compatible --- .../startosis_persistent_directory_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal_testsuites/golang/testsuite/startosis_persistent_directory_test/startosis_persistent_directory_test.go b/internal_testsuites/golang/testsuite/startosis_persistent_directory_test/startosis_persistent_directory_test.go index ea30082164..5376c8f09f 100644 --- a/internal_testsuites/golang/testsuite/startosis_persistent_directory_test/startosis_persistent_directory_test.go +++ b/internal_testsuites/golang/testsuite/startosis_persistent_directory_test/startosis_persistent_directory_test.go @@ -21,7 +21,7 @@ def run(plan): image=IMAGE, files={ "/data": Directory( - persistent_key="persistent_data", + persistent_key="persistent-data", ), }, min_cpu=%d, From e172e8b269776c2e369d5dba5bbc37308cf82548 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 2 Jan 2024 12:50:23 +0000 Subject: [PATCH 05/12] remove file mistakeny added --- test.star | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 test.star diff --git a/test.star b/test.star deleted file mode 100644 index 48fbf46e90..0000000000 --- a/test.star +++ /dev/null @@ -1,7 +0,0 @@ -def run(plan): - plan.add_service( - name = "this_is_not_valid", - config = ServiceConfig( - image = "postgres:15.2-alpine" - ) - ) \ No newline at end of file From d77db4dba676229b2227b3a5aba28e54ef4f88e2 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 2 Jan 2024 12:51:05 +0000 Subject: [PATCH 06/12] fix name --- .../objects/service_directory/persistent_directories.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go b/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go index 4a5ea5f621..a5e399c186 100644 --- a/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go +++ b/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go @@ -9,7 +9,7 @@ const ( // * start with an alphabetic character // * end with an alphanumeric character // The adoption of RFC-1035 is to maintain compatability with current Kubernetes service and pod naming standards: - // We use this over RFC-1035 as Service Names require 1035 to be followed + // We use this over RFC-1035 as persistent data require 1035 to be followed // https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names // https://kubernetes.io/docs/concepts/services-networking/service/ PersistentKeyRegex = "[a-z]([-a-z0-9]{0,61}[a-z0-9])?" From b23d36b2f52013a34602d69d58037840e9cde68f Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 2 Jan 2024 12:54:04 +0000 Subject: [PATCH 07/12] fix name --- .../objects/service_directory/persistent_directories.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go b/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go index a5e399c186..0b195a71b5 100644 --- a/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go +++ b/container-engine-lib/lib/backend_interface/objects/service_directory/persistent_directories.go @@ -8,10 +8,8 @@ const ( // * contain only lowercase alphanumeric characters or '-' // * start with an alphabetic character // * end with an alphanumeric character - // The adoption of RFC-1035 is to maintain compatability with current Kubernetes service and pod naming standards: - // We use this over RFC-1035 as persistent data require 1035 to be followed + // This is in order to stick to the 1035 standard which we enforce for all objects created // https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names - // https://kubernetes.io/docs/concepts/services-networking/service/ PersistentKeyRegex = "[a-z]([-a-z0-9]{0,61}[a-z0-9])?" WordWrappedPersistentKeyRegex = "^" + PersistentKeyRegex + "$" ) From 80ab06510ce0d04e989c03d182b8568e1aa95acf Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Fri, 5 Jan 2024 12:44:49 +0000 Subject: [PATCH 08/12] added a comment for some future validations --- .../kurtosis_instruction/add_service/add_service_shared.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go index 35e2fc09aa..81127da593 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go @@ -71,6 +71,7 @@ func validateSingleService(validatorEnvironment *startosis_validator.ValidatorEn return startosis_errors.NewValidationError(invalidServiceNameErrorText(serviceName)) } + // TODO perhaps add AddPersistentKey DoesPersistentKeyExist methods to the validator environment checks for it here if persistentDirectories := serviceConfig.GetPersistentDirectories(); persistentDirectories != nil { for _, directory := range persistentDirectories.ServiceDirpathToPersistentDirectory { if !service_directory.IsPersistentKeyValid(directory.PersistentKey) { From e2784c4e2db6043e575bf9918db7863e11041fa8 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Fri, 5 Jan 2024 14:42:34 +0000 Subject: [PATCH 09/12] ensure that persitent keys are unique --- .../add_service/add_service_shared.go | 5 ++++- .../startosis_validator/validator_environment.go | 14 ++++++++++++++ .../api-reference/starlark-reference/directory.md | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go index 95238e0a79..79a0309b8f 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go @@ -71,12 +71,15 @@ func validateSingleService(validatorEnvironment *startosis_validator.ValidatorEn return startosis_errors.NewValidationError(invalidServiceNameErrorText(serviceName)) } - // TODO perhaps add AddPersistentKey DoesPersistentKeyExist methods to the validator environment checks for it here if persistentDirectories := serviceConfig.GetPersistentDirectories(); persistentDirectories != nil { for _, directory := range persistentDirectories.ServiceDirpathToPersistentDirectory { if !service_directory.IsPersistentKeyValid(directory.PersistentKey) { return startosis_errors.NewValidationError(invalidPersistentKeyErrorText(directory.PersistentKey)) } + if validatorEnvironment.DoesPersistentKeyExist(directory.PersistentKey) == startosis_validator.ComponentCreatedOrUpdatedDuringPackageRun { + return startosis_errors.NewValidationError("There was an error validating '%s' as persistent key '%s' already exists inside the enclave") + } + validatorEnvironment.AddPersistentKey(directory.PersistentKey) } } diff --git a/core/server/api_container/server/startosis_engine/startosis_validator/validator_environment.go b/core/server/api_container/server/startosis_engine/startosis_validator/validator_environment.go index 2d581810ad..89784491d5 100644 --- a/core/server/api_container/server/startosis_engine/startosis_validator/validator_environment.go +++ b/core/server/api_container/server/startosis_engine/startosis_validator/validator_environment.go @@ -5,6 +5,7 @@ import ( "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/image_build_spec" "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/image_download_mode" "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/service" + "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/service_directory" "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_errors" "github.com/sirupsen/logrus" ) @@ -15,6 +16,7 @@ type ValidatorEnvironment struct { imagesToBuild map[string]*image_build_spec.ImageBuildSpec serviceNames map[service.ServiceName]ComponentExistence artifactNames map[string]ComponentExistence + persistentKeys map[service_directory.DirectoryPersistentKey]ComponentExistence serviceNameToPrivatePortIDs map[service.ServiceName][]string availableCpuInMilliCores compute_resources.CpuMilliCores availableMemoryInMegaBytes compute_resources.MemoryInMegaBytes @@ -160,3 +162,15 @@ func (environment *ValidatorEnvironment) HasEnoughMemory(memoryToConsume uint64, } return startosis_errors.NewValidationError("service '%v' requires '%v' megabytes of memory but based on our calculation we will only have '%v' megabytes available at the time we start the service", serviceNameForLogging, memoryToConsume, environment.availableMemoryInMegaBytes) } + +func (environment *ValidatorEnvironment) AddPersistentKey(persistentKey service_directory.DirectoryPersistentKey) { + environment.persistentKeys[persistentKey] = ComponentCreatedOrUpdatedDuringPackageRun +} + +func (environment *ValidatorEnvironment) DoesPersistentKeyExist(persistentKey service_directory.DirectoryPersistentKey) ComponentExistence { + persistentKeyExistence, found := environment.persistentKeys[persistentKey] + if !found { + return ComponentNotFound + } + return persistentKeyExistence +} diff --git a/docs/docs/api-reference/starlark-reference/directory.md b/docs/docs/api-reference/starlark-reference/directory.md index 716b94e680..d6a717e9f2 100644 --- a/docs/docs/api-reference/starlark-reference/directory.md +++ b/docs/docs/api-reference/starlark-reference/directory.md @@ -24,7 +24,7 @@ the above example, `files_artifact_1` is a files artifact name. (see [upload_fil on how to create file artifacts). A persistent directory, as its name indicates, persists over service updates and restarts. It is uniquely identified -by its `persistent_key` and the service ID on which it is being used (a persistent directory cannot be shared across +by its `persistent_key` (a persistent directory cannot be shared across multiple services). When it is first created, it will be empty. The service can write anything in it. When the service gets updated, the data in it persists. It is particularly useful for a service's data directory, logs directory, etc. From 9d4f1428b90f08ffbb954197fe101600d1bfd3d4 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Fri, 5 Jan 2024 14:45:11 +0000 Subject: [PATCH 10/12] fixed bug --- .../kurtosis_instruction/add_service/add_service_shared.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go index 79a0309b8f..70d40974ee 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service_shared.go @@ -77,7 +77,7 @@ func validateSingleService(validatorEnvironment *startosis_validator.ValidatorEn return startosis_errors.NewValidationError(invalidPersistentKeyErrorText(directory.PersistentKey)) } if validatorEnvironment.DoesPersistentKeyExist(directory.PersistentKey) == startosis_validator.ComponentCreatedOrUpdatedDuringPackageRun { - return startosis_errors.NewValidationError("There was an error validating '%s' as persistent key '%s' already exists inside the enclave") + return startosis_errors.NewValidationError("There was an error validating '%s' as persistent key '%s' already exists inside the enclave", serviceName, directory.PersistentKey) } validatorEnvironment.AddPersistentKey(directory.PersistentKey) } From 9037580ff01b7d3817c9c619b499558444502afc Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Fri, 5 Jan 2024 15:26:50 +0000 Subject: [PATCH 11/12] create the cache --- .../startosis_validator/validator_environment.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/server/api_container/server/startosis_engine/startosis_validator/validator_environment.go b/core/server/api_container/server/startosis_engine/startosis_validator/validator_environment.go index 89784491d5..dcea4e0338 100644 --- a/core/server/api_container/server/startosis_engine/startosis_validator/validator_environment.go +++ b/core/server/api_container/server/startosis_engine/startosis_validator/validator_environment.go @@ -44,9 +44,11 @@ func NewValidatorEnvironment(serviceNames map[service.ServiceName]bool, artifact availableCpuInMilliCores: availableCpuInMilliCores, availableMemoryInMegaBytes: availableMemoryInMegaBytes, isResourceInformationComplete: isResourceInformationComplete, - minMemoryByServiceName: map[service.ServiceName]compute_resources.MemoryInMegaBytes{}, - minCPUByServiceName: map[service.ServiceName]compute_resources.CpuMilliCores{}, - imageDownloadMode: imageDownloadMode, + // TODO account for idempotent runs on this and make it pre-load the cache whenever we create a NewValidatorEnvironment + persistentKeys: map[service_directory.DirectoryPersistentKey]ComponentExistence{}, + minMemoryByServiceName: map[service.ServiceName]compute_resources.MemoryInMegaBytes{}, + minCPUByServiceName: map[service.ServiceName]compute_resources.CpuMilliCores{}, + imageDownloadMode: imageDownloadMode, } } From f322c5c952df504e576d188507bdca1c5823b28c Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Mon, 8 Jan 2024 11:15:24 +0000 Subject: [PATCH 12/12] fix readme --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a0810b1d6..373d90c0bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### Features -* docker compose integration [pt. 1] ([#2001](https://github.com/kurtosis-tech/kurtosis/issues/2001)) ([385833d](https://github.com/kurtosis-tech/kurtosis/commit/385833de9d7620f4c65473adc763bb38df8fb995)) +* docker compose integration([#2001](https://github.com/kurtosis-tech/kurtosis/issues/2001)) ([385833d](https://github.com/kurtosis-tech/kurtosis/commit/385833de9d7620f4c65473adc763bb38df8fb995)) ### Bug Fixes