refactor(yaml): Moved organisation to metadata
Some checks failed
test / test (push) Failing after 51s
Some checks failed
test / test (push) Failing after 51s
This commit is contained in:
parent
fdb931acc2
commit
b958acd94e
5 changed files with 16 additions and 16 deletions
|
|
@ -265,7 +265,7 @@ func (rm *EdgeConnectResourceManager) rollbackInstance(ctx context.Context, acti
|
|||
for _, instanceAction := range plan.InstanceActions {
|
||||
if instanceAction.InstanceName == action.Target {
|
||||
instanceKey := edgeconnect.AppInstanceKey{
|
||||
Organization: instanceAction.Target.Organization,
|
||||
Organization: plan.AppAction.Desired.Organization,
|
||||
Name: instanceAction.InstanceName,
|
||||
CloudletKey: edgeconnect.CloudletKey{
|
||||
Organization: instanceAction.Target.CloudletOrg,
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ func (p *EdgeConnectPlanner) planAppAction(ctx context.Context, config *config.E
|
|||
desired := &AppState{
|
||||
Name: config.Metadata.Name,
|
||||
Version: config.Metadata.AppVersion,
|
||||
Organization: config.Spec.InfraTemplate[0].Organization, // Use first infra template for org
|
||||
Organization: config.Metadata.Organization, // Use first infra template for org
|
||||
Region: config.Spec.InfraTemplate[0].Region, // Use first infra template for region
|
||||
Exists: false, // Will be set based on current state
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ func (p *EdgeConnectPlanner) planInstanceActions(ctx context.Context, config *co
|
|||
desired := &InstanceState{
|
||||
Name: instanceName,
|
||||
AppVersion: config.Metadata.AppVersion,
|
||||
Organization: infra.Organization,
|
||||
Organization: config.Metadata.Organization,
|
||||
Region: infra.Region,
|
||||
CloudletOrg: infra.CloudletOrg,
|
||||
CloudletName: infra.CloudletName,
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ func (r *RecreateStrategy) executeAppActionWithRetry(ctx context.Context, action
|
|||
// deleteInstance deletes an instance (reuse existing logic from manager.go)
|
||||
func (r *RecreateStrategy) deleteInstance(ctx context.Context, action InstanceAction) (bool, error) {
|
||||
instanceKey := edgeconnect.AppInstanceKey{
|
||||
Organization: action.Target.Organization,
|
||||
Organization: action.Desired.Organization,
|
||||
Name: action.InstanceName,
|
||||
CloudletKey: edgeconnect.CloudletKey{
|
||||
Organization: action.Target.CloudletOrg,
|
||||
|
|
@ -430,7 +430,7 @@ func (r *RecreateStrategy) createInstance(ctx context.Context, action InstanceAc
|
|||
Region: action.Target.Region,
|
||||
AppInst: edgeconnect.AppInstance{
|
||||
Key: edgeconnect.AppInstanceKey{
|
||||
Organization: action.Target.Organization,
|
||||
Organization: action.Desired.Organization,
|
||||
Name: action.InstanceName,
|
||||
CloudletKey: edgeconnect.CloudletKey{
|
||||
Organization: action.Target.CloudletOrg,
|
||||
|
|
@ -438,7 +438,7 @@ func (r *RecreateStrategy) createInstance(ctx context.Context, action InstanceAc
|
|||
},
|
||||
},
|
||||
AppKey: edgeconnect.AppKey{
|
||||
Organization: action.Target.Organization,
|
||||
Organization: action.Desired.Organization,
|
||||
Name: config.Metadata.Name,
|
||||
Version: config.Metadata.AppVersion,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ type EdgeConnectConfig struct {
|
|||
type Metadata struct {
|
||||
Name string `yaml:"name"`
|
||||
AppVersion string `yaml:"appVersion"`
|
||||
Organization string `yaml:"organization"`
|
||||
}
|
||||
|
||||
// Spec defines the application and infrastructure specification
|
||||
|
|
@ -44,7 +45,6 @@ type DockerApp struct {
|
|||
|
||||
// InfraTemplate defines infrastructure deployment targets
|
||||
type InfraTemplate struct {
|
||||
Organization string `yaml:"organization"`
|
||||
Region string `yaml:"region"`
|
||||
CloudletOrg string `yaml:"cloudletOrg"`
|
||||
CloudletName string `yaml:"cloudletName"`
|
||||
|
|
@ -121,6 +121,11 @@ func (m *Metadata) Validate() error {
|
|||
return fmt.Errorf("metadata.appVersion cannot have leading/trailing whitespace")
|
||||
}
|
||||
|
||||
if m.Organization == "" {
|
||||
return fmt.Errorf("organization is required")
|
||||
}
|
||||
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -209,10 +214,6 @@ func (d *DockerApp) Validate() error {
|
|||
|
||||
// Validate validates infrastructure template configuration
|
||||
func (i *InfraTemplate) Validate() error {
|
||||
if i.Organization == "" {
|
||||
return fmt.Errorf("organization is required")
|
||||
}
|
||||
|
||||
if i.Region == "" {
|
||||
return fmt.Errorf("region is required")
|
||||
}
|
||||
|
|
@ -231,7 +232,6 @@ func (i *InfraTemplate) Validate() error {
|
|||
|
||||
// Validate no leading/trailing whitespace
|
||||
fields := map[string]string{
|
||||
"organization": i.Organization,
|
||||
"region": i.Region,
|
||||
"cloudletOrg": i.CloudletOrg,
|
||||
"cloudletName": i.CloudletName,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ kind: edgeconnect-deployment
|
|||
metadata:
|
||||
name: "edge-app-demo" # name could be used for appName
|
||||
appVersion: "1.0.0"
|
||||
organization: "edp2"
|
||||
spec:
|
||||
# dockerApp: # Docker is OBSOLETE
|
||||
# appVersion: "1.0.0"
|
||||
|
|
@ -12,8 +13,7 @@ spec:
|
|||
k8sApp:
|
||||
manifestFile: "./k8s-deployment.yaml"
|
||||
infraTemplate:
|
||||
- organization: "edp2"
|
||||
region: "EU"
|
||||
- region: "EU"
|
||||
cloudletOrg: "TelekomOP"
|
||||
cloudletName: "Munich"
|
||||
flavorName: "EU.small"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue