Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions internal/module/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func helmFormatModuleImages(m *Module, rawValues map[string]any) (chartutil.Valu
caps := &capsCopy
vers := append([]string{}, caps.APIVersions...)
vers = append(vers, "autoscaling.k8s.io/v1/VerticalPodAutoscaler", "cert-manager.io/v1")
vers = appendIfMissing(vers, "gateway.networking.k8s.io/v1/Gateway")
vers = appendIfMissing(vers, "gateway.networking.k8s.io/v1/HTTPRoute")
vers = appendIfMissing(vers, "gateway.networking.k8s.io/v1/ListenerSet")

caps.APIVersions = vers

digests := map[string]any{
Expand All @@ -86,6 +90,17 @@ func helmFormatModuleImages(m *Module, rawValues map[string]any) (chartutil.Valu
}

applyDigests(m.GetName(), digests, rawValues)
_ = mergo.Merge(&rawValues, map[string]any{
"global": map[string]any{
"discovery": map[string]any{
"gatewayAPIDefaultGateway": map[string]any{
"name": "default",
"namespace": "d8-alb",
},
},
},
}, mergo.WithOverride)

top := map[string]any{
"Chart": m.GetMetadata(),
"Capabilities": caps,
Expand All @@ -103,6 +118,16 @@ func helmFormatModuleImages(m *Module, rawValues map[string]any) (chartutil.Valu
return top, nil
}

func appendIfMissing(values []string, value string) []string {
for _, item := range values {
if item == value {
return values
}
}

return append(values, value)
}

func ComposeValuesFromSchemas(m *Module, globalSchema *spec.Schema) (chartutil.Values, error) {
return ComposeValuesFromSchemasForValuesFile(m, globalSchema, "values.yaml")
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ type TemplatesLinterRules struct {
ServicePortRule RuleConfig
ClusterDomainRule RuleConfig
RegistryRule RuleConfig
HTTPRouteRule RuleConfig
EnabledModulesRule RuleConfig
}

Expand All @@ -156,6 +157,7 @@ type TemplatesExcludeRules struct {
ServicePort ServicePortExcludeList
KubeRBACProxy StringRuleExcludeList
Ingress KindRuleExcludeList
HTTPRoute KindRuleExcludeList
EnabledModules EnabledModulesExcludeRule
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/linters/hooks/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (h *Hooks) Run(m *module.Module) {

r := rules.NewHookRule(h.cfg)
for _, object := range m.GetStorage() {
r.CheckIngressCopyCustomCertificateRule(m, object, errorList)
r.CheckCopyCustomCertificateRule(m, object, errorList)
}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/linters/hooks/rules/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewHookRule(cfg *pkg.HooksLinterConfig) *HookRule {
}
}

func (l *HookRule) CheckIngressCopyCustomCertificateRule(m *module.Module, object storage.StoreObject, errorList *errors.LintRuleErrorsList) {
func (l *HookRule) CheckCopyCustomCertificateRule(m *module.Module, object storage.StoreObject, errorList *errors.LintRuleErrorsList) {
errorList = errorList.WithRule(l.GetName()).WithFilePath(object.GetPath())

const (
Expand All @@ -59,7 +59,7 @@ func (l *HookRule) CheckIngressCopyCustomCertificateRule(m *module.Module, objec
errorList = errorList.WithMaxLevel(ptr.To(pkg.Ignored))
}

if object.Unstructured.GetKind() != "Ingress" {
if object.Unstructured.GetKind() != "Ingress" && object.Unstructured.GetKind() != "HTTPRoute" {
return
}

Expand All @@ -82,7 +82,7 @@ func (l *HookRule) CheckIngressCopyCustomCertificateRule(m *module.Module, objec
}

if _, ok := imports[copyCustomCertificateImport]; !ok {
errorList.Error("Ingress resource exists but module does not have copy_custom_certificate hook")
errorList.Errorf("%s resource exists but module does not have copy_custom_certificate hook", object.Unstructured.GetKind())
}
}

Expand Down
Loading
Loading