Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/docker/alpine-3.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ralikio authored Jan 21, 2025
2 parents e4e88cd + 1acd898 commit 32852a9
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 57 deletions.
18 changes: 11 additions & 7 deletions common/orchestration/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ type GardenerRuntimeResolver struct {
}

const (
globalAccountLabel = "account"
subAccountLabel = "subaccount"
runtimeIDAnnotation = "kcp.provisioner.kyma-project.io/runtime-id"
maintenanceWindowFormat = "150405-0700"
globalAccountLabel = "account"
subAccountLabel = "subaccount"
runtimeIDAnnotationProvisioner = "kcp.provisioner.kyma-project.io/runtime-id"
runtimeIDAnnotationKim = "infrastructuremanager.kyma-project.io/runtime-id"
maintenanceWindowFormat = "150405-0700"
)

// NewGardenerRuntimeResolver constructs a GardenerRuntimeResolver with the mandatory input parameters.
Expand Down Expand Up @@ -136,10 +137,13 @@ func (resolver *GardenerRuntimeResolver) resolveRuntimeTarget(rt RuntimeTarget,
// Iterate over all shoots. Evaluate target specs. If multiple are specified, all must match for a given shoot.
for _, s := range shoots {
shoot := &gardener.Shoot{Unstructured: s}
runtimeID := shoot.GetAnnotations()[runtimeIDAnnotation]
runtimeID := shoot.GetAnnotations()[runtimeIDAnnotationProvisioner]
if runtimeID == "" {
resolver.logger.Error(fmt.Sprintf("Failed to get runtimeID from %s annotation for Shoot %s", runtimeIDAnnotation, shoot.GetName()))
continue
runtimeID = shoot.GetAnnotations()[runtimeIDAnnotationKim]
if runtimeID == "" {
resolver.logger.Error(fmt.Sprintf("Failed to get runtimeID neither from %s annotation nor from %s for Shoot %s", runtimeIDAnnotationProvisioner, runtimeIDAnnotationKim, shoot.GetName()))
continue
}
}
r, ok := resolver.getRuntime(runtimeID)
if !ok {
Expand Down
43 changes: 36 additions & 7 deletions common/orchestration/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,17 @@ func TestResolver_Resolve_StorageFailure(t *testing.T) {
}

var (
shoot1 = fixShoot(1, globalAccountID1, region1)
shoot2 = fixShoot(2, globalAccountID1, region2)
shoot3 = fixShoot(3, globalAccountID2, region3)
shoot4 = fixShoot(4, globalAccountID3, region1)
shoot1 = fixShootForKIM(1, globalAccountID1, region1)
shoot2 = fixShootForKIM(2, globalAccountID1, region2)
shoot3 = fixShootForKIM(3, globalAccountID2, region3)
shoot4 = fixShootForKIM(4, globalAccountID3, region1)
shoot5 = fixShoot(5, globalAccountID1, region1)
shoot6 = fixShoot(6, globalAccountID1, region1)
// shoot7 is purposefully missing to test missing cluster scenario
shoot8 = fixShoot(8, globalAccountID1, region1)
shoot9 = fixShoot(9, globalAccountID1, region1)
shoot10 = fixShoot(10, globalAccountID1, region1)
shoot11 = fixShoot(11, globalAccountID1, region1)
shoot10 = fixShootForKIM(10, globalAccountID1, region1)
shoot11 = fixShootForKIM(11, globalAccountID1, region1)

runtime1 = fixRuntimeDTO(1, globalAccountID1, plan2, runtimeOpState{provision: string(brokerapi.Succeeded)})
runtime2 = fixRuntimeDTO(2, globalAccountID1, plan1, runtimeOpState{provision: string(brokerapi.Succeeded)})
Expand Down Expand Up @@ -294,7 +294,36 @@ func fixShoot(id int, globalAccountID, region string) unstructured.Unstructured
subAccountLabel: fmt.Sprintf("subaccount-id-%d", id),
},
"annotations": map[string]interface{}{
runtimeIDAnnotation: fmt.Sprintf("runtime-id-%d", id),
runtimeIDAnnotationProvisioner: fmt.Sprintf("runtime-id-%d", id),
},
},
"spec": map[string]interface{}{
"region": region,
"maintenance": map[string]interface{}{
"timeWindow": map[string]interface{}{
"begin": "030000+0000",
"end": "040000+0000",
},
},
},
},
}
}

func fixShootForKIM(id int, globalAccountID, region string) unstructured.Unstructured {
return unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": "core.gardener.cloud/v1beta1",
"kind": "Shoot",
"metadata": map[string]interface{}{
"name": fmt.Sprintf("shoot%d", id),
"namespace": shootNamespace,
"labels": map[string]interface{}{
globalAccountLabel: globalAccountID,
subAccountLabel: fmt.Sprintf("subaccount-id-%d", id),
},
"annotations": map[string]interface{}{
runtimeIDAnnotationKim: fmt.Sprintf("runtime-id-%d", id),
},
},
"spec": map[string]interface{}{
Expand Down
32 changes: 16 additions & 16 deletions internal/broker/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,28 +368,28 @@ func requiredOwnClusterSchemaProperties() []string {

func SapConvergedCloudSchema(machineTypesDisplay, regionsDisplay map[string]string, machineTypes []string, additionalParams, update bool, shootAndSeedFeatureFlag bool, sapConvergedCloudRegions []string) *map[string]interface{} {
properties := NewProvisioningProperties(machineTypesDisplay, regionsDisplay, machineTypes, sapConvergedCloudRegions, update)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedFeatureFlag)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedFeatureFlag, false)
}

func PreviewSchema(machineTypesDisplay, regionsDisplay map[string]string, machineTypes []string, additionalParams, update bool, euAccessRestricted bool) *map[string]interface{} {
properties := NewProvisioningProperties(machineTypesDisplay, regionsDisplay, machineTypes, AWSRegions(euAccessRestricted), update)
properties.Networking = NewNetworkingSchema()
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), false, false)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), false, false, true)
}

func GCPSchema(machineTypesDisplay, regionsDisplay map[string]string, machineTypes []string, additionalParams, update bool, shootAndSeedFeatureFlag bool, assuredWorkloads bool) *map[string]interface{} {
properties := NewProvisioningProperties(machineTypesDisplay, regionsDisplay, machineTypes, GcpRegions(assuredWorkloads), update)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedFeatureFlag)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedFeatureFlag, false)
}

func AWSSchema(machineTypesDisplay, regionsDisplay map[string]string, machineTypes []string, additionalParams, update bool, euAccessRestricted bool, shootAndSeedSameRegion bool) *map[string]interface{} {
properties := NewProvisioningProperties(machineTypesDisplay, regionsDisplay, machineTypes, AWSRegions(euAccessRestricted), update)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedSameRegion)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedSameRegion, false)
}

func AzureSchema(machineTypesDisplay, regionsDisplay map[string]string, machineTypes []string, additionalParams, update bool, euAccessRestricted bool, shootAndSeedFeatureFlag bool) *map[string]interface{} {
properties := NewProvisioningProperties(machineTypesDisplay, regionsDisplay, machineTypes, AzureRegions(euAccessRestricted), update)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedFeatureFlag)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedFeatureFlag, false)
}

func AzureLiteSchema(machineTypesDisplay, regionsDisplay map[string]string, machineTypes []string, additionalParams, update bool, euAccessRestricted bool, shootAndSeedFeatureFlag bool) *map[string]interface{} {
Expand All @@ -404,7 +404,7 @@ func AzureLiteSchema(machineTypesDisplay, regionsDisplay map[string]string, mach
properties.AutoScalerMin.Default = 2
}

return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedFeatureFlag)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), true, shootAndSeedFeatureFlag, false)
}

func FreemiumSchema(provider pkg.CloudProvider, regionsDisplay map[string]string, additionalParams, update bool, euAccessRestricted bool) *map[string]interface{} {
Expand Down Expand Up @@ -435,7 +435,7 @@ func FreemiumSchema(provider pkg.CloudProvider, regionsDisplay map[string]string
properties.Modules = NewModulesSchema()
}

return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), false, false)
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties(), false, false, false)
}

func TrialSchema(additionalParams, update bool) *map[string]interface{} {
Expand All @@ -451,7 +451,7 @@ func TrialSchema(additionalParams, update bool) *map[string]interface{} {
return empty()
}

return createSchemaWithProperties(properties, additionalParams, update, requiredTrialSchemaProperties(), false, false)
return createSchemaWithProperties(properties, additionalParams, update, requiredTrialSchemaProperties(), false, false, false)
}

func OwnClusterSchema(update bool) *map[string]interface{} {
Expand All @@ -465,10 +465,10 @@ func OwnClusterSchema(update bool) *map[string]interface{} {
}

if update {
return createSchemaWith(properties.UpdateProperties, update, requiredOwnClusterSchemaProperties())
return createSchemaWith(properties.UpdateProperties, update, requiredOwnClusterSchemaProperties(), false)
} else {
properties.Modules = NewModulesSchema()
return createSchemaWith(properties, update, requiredOwnClusterSchemaProperties())
return createSchemaWith(properties, update, requiredOwnClusterSchemaProperties(), false)
}
}

Expand All @@ -477,7 +477,7 @@ func empty() *map[string]interface{} {
return &empty
}

func createSchemaWithProperties(properties ProvisioningProperties, additionalParams, update bool, required []string, shootAndSeedSameRegion bool, shootAndSeedFeatureFlag bool) *map[string]interface{} {
func createSchemaWithProperties(properties ProvisioningProperties, additionalParams, update bool, required []string, shootAndSeedSameRegion bool, shootAndSeedFeatureFlag bool, loadCurrentConfig bool) *map[string]interface{} {
if additionalParams {
properties.IncludeAdditional()
}
Expand All @@ -487,14 +487,14 @@ func createSchemaWithProperties(properties ProvisioningProperties, additionalPar
}

if update {
return createSchemaWith(properties.UpdateProperties, update, required)
return createSchemaWith(properties.UpdateProperties, update, required, loadCurrentConfig)
} else {
return createSchemaWith(properties, update, required)
return createSchemaWith(properties, update, required, loadCurrentConfig)
}
}

func createSchemaWith(properties interface{}, update bool, requiered []string) *map[string]interface{} {
schema := NewSchema(properties, update, requiered)
func createSchemaWith(properties interface{}, update bool, requiered []string, loadCurrentConfig bool) *map[string]interface{} {
schema := NewSchema(properties, update, requiered, loadCurrentConfig)

return unmarshalSchema(schema)
}
Expand Down Expand Up @@ -552,7 +552,7 @@ func Plans(plans PlansConfig, provider pkg.CloudProvider, includeAdditionalParam
FreemiumPlanID: defaultServicePlan(FreemiumPlanID, FreemiumPlanName, plans, freemiumSchema, FreemiumSchema(provider, azureRegionsDisplay, includeAdditionalParamsInSchema, true, euAccessRestricted)),
TrialPlanID: defaultServicePlan(TrialPlanID, TrialPlanName, plans, trialSchema, TrialSchema(includeAdditionalParamsInSchema, true)),
OwnClusterPlanID: defaultServicePlan(OwnClusterPlanID, OwnClusterPlanName, plans, ownClusterSchema, OwnClusterSchema(true)),
PreviewPlanID: defaultServicePlan(PreviewPlanID, PreviewPlanName, plans, previewCatalogSchema, AWSSchema(awsMachinesDisplay, awsRegionsDisplay, awsMachineNames, includeAdditionalParamsInSchema, true, euAccessRestricted, false)),
PreviewPlanID: defaultServicePlan(PreviewPlanID, PreviewPlanName, plans, previewCatalogSchema, PreviewSchema(awsMachinesDisplay, awsRegionsDisplay, awsMachineNames, includeAdditionalParamsInSchema, true, euAccessRestricted)),
}

if len(sapConvergedCloudRegions) != 0 {
Expand Down
8 changes: 7 additions & 1 deletion internal/broker/plans_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type RootSchema struct {
ShowFormView bool `json:"_show_form_view"`
// Specifies in what order properties will be displayed on the form
ControlsOrder []string `json:"_controlsOrder"`
// Specified to true loads current instance configuration into the update instance schema
LoadCurrentConfig *bool `json:"_load_current_config,omitempty"`
}

type ProvisioningProperties struct {
Expand Down Expand Up @@ -356,7 +358,7 @@ func NewOIDCSchema() *OIDCType {
}
}

func NewSchema(properties interface{}, update bool, required []string) *RootSchema {
func NewSchema(properties interface{}, update bool, required []string, loadCurrentConfig bool) *RootSchema {
schema := &RootSchema{
Schema: "http://json-schema.org/draft-04/schema#",
Type: Type{
Expand All @@ -371,6 +373,10 @@ func NewSchema(properties interface{}, update bool, required []string) *RootSche
schema.Required = []string{}
}

if loadCurrentConfig {
schema.LoadCurrentConfig = &loadCurrentConfig
}

return schema
}

Expand Down
4 changes: 2 additions & 2 deletions resources/keb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
appVersion: "1.11.11"
appVersion: "1.11.12"
name: keb
description:
description: Kyma Environment Broker Helm chart for Kubernetes
version: 1.11.11
version: 1.11.12
type: application
20 changes: 10 additions & 10 deletions resources/keb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,34 @@ global:
path: europe-docker.pkg.dev/kyma-project/prod
kyma_environment_broker:
dir:
version: "1.11.11"
version: "1.11.12"
kyma_environment_broker_schema_migrator:
dir:
version: 1.11.11
version: 1.11.12
kyma_environments_subaccount_cleanup_job:
dir:
version: "1.11.11"
version: "1.11.12"
kyma_environment_trial_cleanup_job:
dir:
version: "1.11.11"
version: "1.11.12"
kyma_environment_expirator_job:
dir:
version: "1.11.11"
version: "1.11.12"
kyma_environment_deprovision_retrigger_job:
dir:
version: "1.11.11"
version: "1.11.12"
kyma_environment_runtime_reconciler:
dir:
version: "1.11.11"
version: "1.11.12"
kyma_environment_subaccount_sync:
dir:
version: "1.11.11"
version: "1.11.12"
kyma_environment_globalaccounts:
dir:
version: "1.11.11"
version: "1.11.12"
kyma_environment_service_binding_cleanup_job:
dir:
version: 1.11.11
version: 1.11.12

kyma_environment_broker:
serviceAccountName: "kcp-kyma-environment-broker"
Expand Down
24 changes: 12 additions & 12 deletions sec-scanners-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module-name: kyma-environment-broker
rc-tag: 1.11.11
rc-tag: 1.11.12
protecode:
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-broker:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-deprovision-retrigger-job:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environments-cleanup-job:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-runtime-reconciler:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-archiver-job:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-expirator-job:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-subaccount-cleanup-job:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-subaccount-sync:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-broker-globalaccounts:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-broker-schema-migrator:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-service-binding-cleanup-job:1.11.11
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-broker:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-deprovision-retrigger-job:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environments-cleanup-job:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-runtime-reconciler:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-archiver-job:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-expirator-job:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-subaccount-cleanup-job:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-subaccount-sync:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-broker-globalaccounts:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-broker-schema-migrator:1.11.12
- europe-docker.pkg.dev/kyma-project/prod/kyma-environment-service-binding-cleanup-job:1.11.12
whitesource:
language: golang-mod
subprojects: false
Expand Down
2 changes: 1 addition & 1 deletion utils/archiver/kyma-environment-broker-archiver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ spec:
template:
spec:
containers:
- image: europe-docker.pkg.dev/kyma-project/prod/kyma-environment-archiver-job:1.11.11
- image: europe-docker.pkg.dev/kyma-project/prod/kyma-environment-archiver-job:1.11.12
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
containers:
- name: kyma-environments-cleanup
command: ["/bin/main"]
image: europe-docker.pkg.dev/kyma-project/prod/kyma-environments-cleanup-job:1.11.11
image: europe-docker.pkg.dev/kyma-project/prod/kyma-environments-cleanup-job:1.11.12
imagePullPolicy: IfNotPresent
env:
- name: DATABASE_EMBEDDED
Expand Down

0 comments on commit 32852a9

Please sign in to comment.