Skip to content

Commit

Permalink
Ingress: pathType can't be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
lippserd committed Sep 10, 2024
1 parent b17ae2f commit a046ab9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions pkg/schema/v1/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type IngressRule struct {
IngressUuid types.UUID
Host sql.NullString
Path sql.NullString
PathType sql.NullString
PathType string
}

func NewIngress() Resource {
Expand Down Expand Up @@ -106,11 +106,8 @@ func (i *Ingress) Obtain(k8s kmetav1.Object) {
}

for _, ruleValue := range rules.IngressRuleValue.HTTP.Paths {
var pathType sql.NullString
if ruleValue.PathType != nil {
pathType.String = string(*ruleValue.PathType)
pathType.Valid = true
}
// It is safe to use the pointer directly here.
pathType := string(*ruleValue.PathType)
if ruleValue.Backend.Service != nil {
ingressRuleUuid := NewUUID(i.Uuid, rules.Host+ruleValue.Path+ruleValue.Backend.Service.Name)
serviceUuid := NewUUID(ingressRuleUuid, ruleValue.Backend.Service.Name)
Expand Down
2 changes: 1 addition & 1 deletion schema/mysql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ CREATE TABLE ingress_rule (
ingress_uuid binary(16) NOT NULL,
host varchar(255) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
path varchar(255) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
path_type varchar(255) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
path_type enum('Exact', 'Prefix', 'ImplementationSpecific') COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (uuid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

Expand Down

0 comments on commit a046ab9

Please sign in to comment.