From 333b43e35c0cc5e190d239f87d3b276f4f8dcca8 Mon Sep 17 00:00:00 2001 From: Jordan Singer Date: Fri, 17 Nov 2023 19:33:01 -0600 Subject: [PATCH] visualization fixes --- pkg/engine2/operational_eval/eval.go | 13 ++- pkg/engine2/operational_eval/evaluator.go | 6 + pkg/engine2/path_selection/edge_validity.go | 8 +- pkg/engine2/path_selection/path_expansion.go | 18 ++- pkg/engine2/visualizer.go | 109 +++++++++++------- pkg/templates/aws/edges/service_api.yaml | 1 - .../aws/edges/subnet-service_api.yaml.yaml | 4 + .../aws/resources/api_integration.yaml | 6 + pkg/templates/aws/resources/ecs_service.yaml | 1 - .../aws/resources/load_balancer.yaml | 2 +- pkg/templates/aws/resources/rds_instance.yaml | 1 - .../kubernetes/models/object_meta.yaml | 2 +- .../kubernetes/resources/cluster_set.yaml | 2 +- .../kubernetes/resources/config_map.yaml | 2 +- .../kubernetes/resources/deployment.yaml | 8 +- .../resources/horizontal_pod_autoscaler.yaml | 3 +- .../resources/kustomize_directory.yaml | 1 + .../kubernetes/resources/namespace.yaml | 2 +- .../resources/persistent_volume.yaml | 3 +- .../resources/persistent_volume_claim.yaml | 3 +- pkg/templates/kubernetes/resources/pod.yaml | 8 +- .../kubernetes/resources/service.yaml | 8 +- .../kubernetes/resources/service_account.yaml | 5 +- .../kubernetes/resources/service_export.yaml | 3 +- .../kubernetes/resources/storage_class.yaml | 3 +- .../resources/target_group_binding.yaml | 3 +- 26 files changed, 152 insertions(+), 73 deletions(-) create mode 100644 pkg/templates/aws/edges/subnet-service_api.yaml.yaml diff --git a/pkg/engine2/operational_eval/eval.go b/pkg/engine2/operational_eval/eval.go index 60893243e..22aee7e10 100644 --- a/pkg/engine2/operational_eval/eval.go +++ b/pkg/engine2/operational_eval/eval.go @@ -137,7 +137,6 @@ func (eval *Evaluator) RecalculateUnevaluated() error { return err } - changes := newChanges() var errs error for _, key := range topo { vertex, err := eval.unevaluated.Vertex(key) @@ -145,10 +144,12 @@ func (eval *Evaluator) RecalculateUnevaluated() error { errs = errors.Join(errs, err) continue } - errs = errors.Join(errs, changes.AddVertexAndDeps(eval, vertex)) - } - if errs != nil { - return errs + changes := newChanges() + err = changes.AddVertexAndDeps(eval, vertex) + if err == nil { + err = eval.enqueue(changes) + } + errs = errors.Join(errs, err) } - return eval.enqueue(changes) + return errs } diff --git a/pkg/engine2/operational_eval/evaluator.go b/pkg/engine2/operational_eval/evaluator.go index c69f00a0f..8c8c2997d 100644 --- a/pkg/engine2/operational_eval/evaluator.go +++ b/pkg/engine2/operational_eval/evaluator.go @@ -469,5 +469,11 @@ func (eval *Evaluator) UpdateId(oldId, newId construct.ResourceId) error { } } + if eval.currentKey != nil { + if eval.currentKey.Ref.Resource == oldId { + eval.currentKey.Ref.Resource = newId + } + eval.currentKey.Edge = UpdateEdgeId(eval.currentKey.Edge, oldId, newId) + } return nil } diff --git a/pkg/engine2/path_selection/edge_validity.go b/pkg/engine2/path_selection/edge_validity.go index eafcaadcb..551a9a390 100644 --- a/pkg/engine2/path_selection/edge_validity.go +++ b/pkg/engine2/path_selection/edge_validity.go @@ -135,8 +135,12 @@ func checkProperties(ctx solution_context.SolutionContext, resource, toCheck *co func checkIfPropertyContainsResource(property interface{}, resource construct.ResourceId) bool { switch reflect.ValueOf(property).Kind() { case reflect.Slice, reflect.Array: - for _, p := range property.([]construct.ResourceId) { - if p.Matches(resource) { + for i := 0; i < reflect.ValueOf(property).Len(); i++ { + val := reflect.ValueOf(property).Index(i).Interface() + if id, ok := val.(construct.ResourceId); ok && id.Matches(resource) { + return true + } + if pref, ok := val.(construct.PropertyRef); ok && pref.Resource.Matches(resource) { return true } } diff --git a/pkg/engine2/path_selection/path_expansion.go b/pkg/engine2/path_selection/path_expansion.go index df206ba2f..d84191714 100644 --- a/pkg/engine2/path_selection/path_expansion.go +++ b/pkg/engine2/path_selection/path_expansion.go @@ -181,7 +181,11 @@ func handleProperties( errs = errors.Join(errs, err) continue } - + id := res.ID + exists, err := ctx.RawView().Vertex(id) + if err != nil && !errors.Is(err, graph.ErrVertexNotFound) { + return err + } handleProp := func(prop *knowledgebase.Property) error { oldId := res.ID opRuleCtx := operational_rule.OperationalRuleContext{ @@ -202,6 +206,12 @@ func handleProperties( if err != nil { errs = errors.Join(errs, err) } + if prop.Namespace && exists != nil { + err = construct.PropagateUpdatedId(ctx.OperationalView(), id) + if err != nil { + errs = errors.Join(errs, err) + } + } } } else if i > 0 { upstreamRes := resultResources[i-1] @@ -211,6 +221,12 @@ func handleProperties( if err != nil { errs = errors.Join(errs, err) } + if prop.Namespace && exists != nil { + err = construct.PropagateUpdatedId(ctx.OperationalView(), id) + if err != nil { + errs = errors.Join(errs, err) + } + } } } diff --git a/pkg/engine2/visualizer.go b/pkg/engine2/visualizer.go index 4c731ee5c..03238fb4b 100644 --- a/pkg/engine2/visualizer.go +++ b/pkg/engine2/visualizer.go @@ -119,49 +119,52 @@ func (e *Engine) GetViewsDag(view View, ctx solution_context.SolutionContext) (c }) seenSmall := make(set.Set[construct.ResourceId]) for _, path := range deps.Paths { - for _, dst := range path[1:] { - dstTag := e.GetResourceVizTag(string(DataflowView), dst) - switch dstTag { - case ParentIconTag: - hasPath, err := HasPath(topo, ctx, src, dst) - if err != nil { - errs = errors.Join(errs, err) - } - if node.Parent.IsZero() && hasPath { - node.Parent = dst - } - case BigIconTag: - hasPath, err := HasPath(topo, ctx, src, dst) - if err != nil { - errs = errors.Join(errs, err) - } - if hasPath { - edge := construct.SimpleEdge{ - Source: src, - Target: dst, - } - topo.Edges[edge] = path[1 : len(path)-1] - } - case SmallIconTag: - if seenSmall.Contains(dst) { - continue - } - seenSmall.Add(dst) - isSideEffect, err := knowledgebase.IsOperationalResourceSideEffect(df, ctx.KnowledgeBase(), src, dst) - if err != nil { - errs = errors.Join(errs, err) - continue - } - if isSideEffect { - node.Children.Add(dst) + dst := path[len(path)-1] + if dst == src { + continue + } + dstTag := e.GetResourceVizTag(string(DataflowView), dst) + switch dstTag { + case ParentIconTag: + hasPath, err := HasParent(topo, ctx, src, dst) + if err != nil { + errs = errors.Join(errs, err) + } + if node.Parent.IsZero() && hasPath { + node.Parent = dst + } + case BigIconTag: + hasPath, err := HasPath(topo, ctx, src, dst) + if err != nil { + errs = errors.Join(errs, err) + } + if hasPath { + edge := construct.SimpleEdge{ + Source: src, + Target: dst, } - case NoRenderTag: + topo.Edges[edge] = path[1 : len(path)-1] + } + case SmallIconTag: + if seenSmall.Contains(dst) { continue - default: - errs = errors.Join(errs, fmt.Errorf("unknown tag %s, for resource %s", dstTag, dst)) } + seenSmall.Add(dst) + isSideEffect, err := knowledgebase.IsOperationalResourceSideEffect(df, ctx.KnowledgeBase(), src, dst) + if err != nil { + errs = errors.Join(errs, err) + continue + } + if isSideEffect { + node.Children.Add(dst) + } + case NoRenderTag: + continue + default: + errs = errors.Join(errs, fmt.Errorf("unknown tag %s, for resource %s", dstTag, dst)) } } + } if errs != nil { return nil, errs @@ -231,7 +234,7 @@ func (e *Engine) GetViewsDag(view View, ctx solution_context.SolutionContext) (c func (e *Engine) getParentFromNamespace(resource construct.ResourceId, resources []construct.ResourceId) construct.ResourceId { if resource.Namespace != "" { for _, potentialParent := range resources { - if potentialParent.Provider == resource.Provider && potentialParent.Name == resource.Namespace && e.GetResourceVizTag(string(DataflowView), potentialParent) == ParentIconTag { + if potentialParent.Name == resource.Namespace && e.GetResourceVizTag(string(DataflowView), potentialParent) == ParentIconTag { return potentialParent } } @@ -239,7 +242,27 @@ func (e *Engine) getParentFromNamespace(resource construct.ResourceId, resources return construct.ResourceId{} } +func HasParent(topo Topology, sol solution_context.SolutionContext, source, target construct.ResourceId) (bool, error) { + return checkPaths(topo, sol, source, target) +} + func HasPath(topo Topology, sol solution_context.SolutionContext, source, target construct.ResourceId) (bool, error) { + srcTemplate, err := sol.KnowledgeBase().GetResourceTemplate(source) + if err != nil || srcTemplate == nil { + return false, fmt.Errorf("has path could not find source resource %s: %w", source, err) + } + targetTemplate, err := sol.KnowledgeBase().GetResourceTemplate(target) + if err != nil || targetTemplate == nil { + return false, fmt.Errorf("has path could not find target resource %s: %w", target, err) + } + if len(targetTemplate.PathSatisfaction.AsTarget) == 0 || len(srcTemplate.PathSatisfaction.AsSource) == 0 { + return false, nil + } + return checkPaths(topo, sol, source, target) + +} + +func checkPaths(topo Topology, sol solution_context.SolutionContext, source, target construct.ResourceId) (bool, error) { var errs error pathsCache := map[construct.SimpleEdge][][]construct.ResourceId{} pathSatisfactions, err := sol.KnowledgeBase().GetPathSatisfactionsFromEdge(source, target) @@ -280,7 +303,13 @@ func HasPath(topo Topology, sol solution_context.SolutionContext, source, target PATHS: for _, path := range paths { for i, res := range path { - if i != 0 && i < len(path)-1 && (topo.Nodes[res.String()] != nil && res != source && res != target) { + if i == 0 { + continue + } + if et := sol.KnowledgeBase().GetEdgeTemplate(path[i-1], res); et != nil && et.DirectEdgeOnly { + continue PATHS + } + if i < len(path)-1 && (topo.Nodes[res.String()] != nil && res != source && res != target) { continue PATHS } } diff --git a/pkg/templates/aws/edges/service_api.yaml b/pkg/templates/aws/edges/service_api.yaml index e1a89b10f..9558e3046 100644 --- a/pkg/templates/aws/edges/service_api.yaml +++ b/pkg/templates/aws/edges/service_api.yaml @@ -3,7 +3,6 @@ resource: aws:SERVICE_API sources: - aws:lambda_function - aws:app_runner_service - - aws:subnet targets: - aws:lambda_function - aws:dynamodb_table diff --git a/pkg/templates/aws/edges/subnet-service_api.yaml.yaml b/pkg/templates/aws/edges/subnet-service_api.yaml.yaml new file mode 100644 index 000000000..17b48e864 --- /dev/null +++ b/pkg/templates/aws/edges/subnet-service_api.yaml.yaml @@ -0,0 +1,4 @@ +source: aws:subnet +target: aws:SERVICE_API + +edge_weight_multiplier: 10 # We want to prefer staying public if a resource does not need to be placed in a vpc \ No newline at end of file diff --git a/pkg/templates/aws/resources/api_integration.yaml b/pkg/templates/aws/resources/api_integration.yaml index b7d67bfe1..133b97a9d 100644 --- a/pkg/templates/aws/resources/api_integration.yaml +++ b/pkg/templates/aws/resources/api_integration.yaml @@ -65,6 +65,12 @@ properties: configuration_disabled: true deploy_time: true +path_satisfaction: + as_target: + - api_route + as_source: + - api_route + classification: is: - api_route diff --git a/pkg/templates/aws/resources/ecs_service.yaml b/pkg/templates/aws/resources/ecs_service.yaml index 4add8d32c..e3930e51f 100644 --- a/pkg/templates/aws/resources/ecs_service.yaml +++ b/pkg/templates/aws/resources/ecs_service.yaml @@ -68,7 +68,6 @@ properties: path_satisfaction: as_target: - network - - network#Subnets as_source: - network#Subnets diff --git a/pkg/templates/aws/resources/load_balancer.yaml b/pkg/templates/aws/resources/load_balancer.yaml index 9dfb41e37..43d360327 100644 --- a/pkg/templates/aws/resources/load_balancer.yaml +++ b/pkg/templates/aws/resources/load_balancer.yaml @@ -51,9 +51,9 @@ properties: deploy_time: true path_satisfaction: +# See comment above for why we are not solving the network path as_target: - network - - network#Subnets as_source: - network#Subnets - target_group diff --git a/pkg/templates/aws/resources/rds_instance.yaml b/pkg/templates/aws/resources/rds_instance.yaml index 8e87eded8..054c57d9b 100644 --- a/pkg/templates/aws/resources/rds_instance.yaml +++ b/pkg/templates/aws/resources/rds_instance.yaml @@ -81,7 +81,6 @@ classification: path_satisfaction: as_target: - - network#SubnetGroup#Subnets - network - permissions diff --git a/pkg/templates/kubernetes/models/object_meta.yaml b/pkg/templates/kubernetes/models/object_meta.yaml index a77e1c85b..c02032e2d 100644 --- a/pkg/templates/kubernetes/models/object_meta.yaml +++ b/pkg/templates/kubernetes/models/object_meta.yaml @@ -8,6 +8,6 @@ properties: labels: type: map(string,string) default_value: - KLOTHO_ID_LABEL: '{{ .Self.String | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" }}' + KLOTHO_ID_LABEL: '{{ .Self.String | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" }}' annotations: type: map(string,string) diff --git a/pkg/templates/kubernetes/resources/cluster_set.yaml b/pkg/templates/kubernetes/resources/cluster_set.yaml index f0d621166..4f5e9fa4b 100644 --- a/pkg/templates/kubernetes/resources/cluster_set.yaml +++ b/pkg/templates/kubernetes/resources/cluster_set.yaml @@ -6,7 +6,7 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: diff --git a/pkg/templates/kubernetes/resources/config_map.yaml b/pkg/templates/kubernetes/resources/config_map.yaml index d723056c7..73222801b 100644 --- a/pkg/templates/kubernetes/resources/config_map.yaml +++ b/pkg/templates/kubernetes/resources/config_map.yaml @@ -6,7 +6,7 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: diff --git a/pkg/templates/kubernetes/resources/deployment.yaml b/pkg/templates/kubernetes/resources/deployment.yaml index fc6dd6f12..0719ff4bc 100644 --- a/pkg/templates/kubernetes/resources/deployment.yaml +++ b/pkg/templates/kubernetes/resources/deployment.yaml @@ -1,17 +1,18 @@ qualified_type_name: kubernetes:deployment -display_name: Kubernetes Deployment +display_name: K8s Deployment sanitize_name: # a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', # and must start and end with an alphanumeric character # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream @@ -57,6 +58,9 @@ properties: path_satisfaction: as_target: + - service + - network#Cluster + as_source: - network#Cluster#Subnets classification: diff --git a/pkg/templates/kubernetes/resources/horizontal_pod_autoscaler.yaml b/pkg/templates/kubernetes/resources/horizontal_pod_autoscaler.yaml index 79636dc7e..48b5b22b8 100644 --- a/pkg/templates/kubernetes/resources/horizontal_pod_autoscaler.yaml +++ b/pkg/templates/kubernetes/resources/horizontal_pod_autoscaler.yaml @@ -6,12 +6,13 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream diff --git a/pkg/templates/kubernetes/resources/kustomize_directory.yaml b/pkg/templates/kubernetes/resources/kustomize_directory.yaml index 9285c4698..dde6adf02 100644 --- a/pkg/templates/kubernetes/resources/kustomize_directory.yaml +++ b/pkg/templates/kubernetes/resources/kustomize_directory.yaml @@ -4,6 +4,7 @@ display_name: Kustomize Directory properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream diff --git a/pkg/templates/kubernetes/resources/namespace.yaml b/pkg/templates/kubernetes/resources/namespace.yaml index eb2115cdf..f28b10003 100644 --- a/pkg/templates/kubernetes/resources/namespace.yaml +++ b/pkg/templates/kubernetes/resources/namespace.yaml @@ -7,7 +7,7 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} diff --git a/pkg/templates/kubernetes/resources/persistent_volume.yaml b/pkg/templates/kubernetes/resources/persistent_volume.yaml index d256fd330..5670757eb 100644 --- a/pkg/templates/kubernetes/resources/persistent_volume.yaml +++ b/pkg/templates/kubernetes/resources/persistent_volume.yaml @@ -7,13 +7,14 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream diff --git a/pkg/templates/kubernetes/resources/persistent_volume_claim.yaml b/pkg/templates/kubernetes/resources/persistent_volume_claim.yaml index 07178e64c..f8978dd3e 100644 --- a/pkg/templates/kubernetes/resources/persistent_volume_claim.yaml +++ b/pkg/templates/kubernetes/resources/persistent_volume_claim.yaml @@ -7,13 +7,14 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream diff --git a/pkg/templates/kubernetes/resources/pod.yaml b/pkg/templates/kubernetes/resources/pod.yaml index 191edda29..7e9b62140 100644 --- a/pkg/templates/kubernetes/resources/pod.yaml +++ b/pkg/templates/kubernetes/resources/pod.yaml @@ -1,5 +1,5 @@ qualified_type_name: kubernetes:pod -display_name: Kubernetes Pod +display_name: K8s Pod sanitize_name: # a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', @@ -7,13 +7,14 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream @@ -36,6 +37,9 @@ properties: path_satisfaction: as_target: + - service + - network#Cluster + as_source: - network#Cluster#Subnets classification: diff --git a/pkg/templates/kubernetes/resources/service.yaml b/pkg/templates/kubernetes/resources/service.yaml index 0d096bd1f..f7f92c5e4 100644 --- a/pkg/templates/kubernetes/resources/service.yaml +++ b/pkg/templates/kubernetes/resources/service.yaml @@ -7,7 +7,7 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} @@ -58,9 +58,9 @@ properties: sessionAffinity: type: string -path_satisfaction: - as_target: - - network#Cluster#Subnets +classification: + is: + - service delete_context: requires_no_upstream_or_downstream: true diff --git a/pkg/templates/kubernetes/resources/service_account.yaml b/pkg/templates/kubernetes/resources/service_account.yaml index 6556016cf..693b9817e 100644 --- a/pkg/templates/kubernetes/resources/service_account.yaml +++ b/pkg/templates/kubernetes/resources/service_account.yaml @@ -7,13 +7,14 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream @@ -40,7 +41,7 @@ classification: - role - kubernetes - permissions - + delete_context: require_no_upstream: true views: diff --git a/pkg/templates/kubernetes/resources/service_export.yaml b/pkg/templates/kubernetes/resources/service_export.yaml index 063910232..08f10f4f4 100644 --- a/pkg/templates/kubernetes/resources/service_export.yaml +++ b/pkg/templates/kubernetes/resources/service_export.yaml @@ -7,13 +7,14 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream diff --git a/pkg/templates/kubernetes/resources/storage_class.yaml b/pkg/templates/kubernetes/resources/storage_class.yaml index 4ea7b04aa..8895e98cc 100644 --- a/pkg/templates/kubernetes/resources/storage_class.yaml +++ b/pkg/templates/kubernetes/resources/storage_class.yaml @@ -7,13 +7,14 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream diff --git a/pkg/templates/kubernetes/resources/target_group_binding.yaml b/pkg/templates/kubernetes/resources/target_group_binding.yaml index 571b5dd1a..5475ee7c1 100644 --- a/pkg/templates/kubernetes/resources/target_group_binding.yaml +++ b/pkg/templates/kubernetes/resources/target_group_binding.yaml @@ -7,13 +7,14 @@ sanitize_name: # (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')] | {{ . - | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" + | replace `[^a-zA-Z0-9-]+` "" | replace `^[-]+` "" | replace `[-]+$` "" | length 1 50 }} properties: Cluster: type: resource + namespace: true operational_rule: steps: - direction: downstream