Skip to content

Commit 509a160

Browse files
committed
MEDIUM: update certificates through runtime
1 parent 3038d04 commit 509a160

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+836
-112
lines changed

crs/api/ingress/v1/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
// +genclient
2424
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
25-
// +kubebuilder:metadata:annotations="haproxy.org/client-native=v5.1.11"
25+
// +kubebuilder:metadata:annotations="haproxy.org/client-native=v5.1.15-0.20241106115115-75c12953fe1f"
2626

2727
// Backend is a specification for a Backend resource
2828
type Backend struct {

crs/api/ingress/v1/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
// +genclient
2424
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
25-
// +kubebuilder:metadata:annotations="haproxy.org/client-native=v5.1.11"
25+
// +kubebuilder:metadata:annotations="haproxy.org/client-native=v5.1.15-0.20241106115115-75c12953fe1f"
2626

2727
// Defaults is a specification for a Defaults resource
2828
type Defaults struct {

crs/api/ingress/v1/global.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
// +genclient
2424
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
25-
// +kubebuilder:metadata:annotations="haproxy.org/client-native=v5.1.11"
25+
// +kubebuilder:metadata:annotations="haproxy.org/client-native=v5.1.15-0.20241106115115-75c12953fe1f"
2626
// +kubebuilder:validation:XValidation:rule="!has(self.spec.config.default_path)", message="spec.config.default_path is set by ingress controller internally"
2727
// +kubebuilder:validation:XValidation:rule="!has(self.spec.config.master__dash__worker)", message="spec.config.master-worker is set by ingress controller internally"
2828
// +kubebuilder:validation:XValidation:rule="!has(self.spec.config.pidfile)", message="spec.config.pidfile is set by ingress controller internally"

crs/api/ingress/v1/tcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
// +genclient
2525
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
26-
// +kubebuilder:metadata:annotations="haproxy.org/client-native=v5.1.11"
26+
// +kubebuilder:metadata:annotations="haproxy.org/client-native=v5.1.15-0.20241106115115-75c12953fe1f"
2727

2828
// TCP is a specification for a TCP resource
2929
type TCP struct {

crs/definition/ingress.v1.haproxy.org_backends.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.14.0
7-
haproxy.org/client-native: v5.1.11
7+
haproxy.org/client-native: v5.1.15-0.20241106115115-75c12953fe1f
88
name: backends.ingress.v1.haproxy.org
99
spec:
1010
group: ingress.v1.haproxy.org
@@ -2241,8 +2241,8 @@ spec:
22412241
capture_sample:
22422242
description: |-
22432243
capture sample
2244-
Pattern: ^[^\s]+$
2245-
pattern: ^[^\s]+$
2244+
Pattern: ^(?:[A-Za-z]+\("([A-Za-z\s]+)"\)|[A-Za-z]+)
2245+
pattern: ^(?:[A-Za-z]+\("([A-Za-z\s]+)"\)|[A-Za-z]+)
22462246
type: string
22472247
cond:
22482248
description: |-
@@ -2488,6 +2488,10 @@ spec:
24882488
maximum: 599
24892489
minimum: 200
24902490
type: integer
2491+
rst_ttl:
2492+
description: rst ttl
2493+
format: int64
2494+
type: integer
24912495
sc_expr:
24922496
description: sc expr
24932497
type: string

crs/definition/ingress.v1.haproxy.org_defaults.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.14.0
7-
haproxy.org/client-native: v5.1.11
7+
haproxy.org/client-native: v5.1.15-0.20241106115115-75c12953fe1f
88
name: defaults.ingress.v1.haproxy.org
99
spec:
1010
group: ingress.v1.haproxy.org

crs/definition/ingress.v1.haproxy.org_globals.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.14.0
7-
haproxy.org/client-native: v5.1.11
7+
haproxy.org/client-native: v5.1.15-0.20241106115115-75c12953fe1f
88
name: globals.ingress.v1.haproxy.org
99
spec:
1010
group: ingress.v1.haproxy.org

crs/definition/ingress.v1.haproxy.org_tcps.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.14.0
7-
haproxy.org/client-native: v5.1.11
7+
haproxy.org/client-native: v5.1.15-0.20241106115115-75c12953fe1f
88
name: tcps.ingress.v1.haproxy.org
99
spec:
1010
group: ingress.v1.haproxy.org
@@ -1613,8 +1613,8 @@ spec:
16131613
capture_sample:
16141614
description: |-
16151615
capture sample
1616-
Pattern: ^[^\s]+$
1617-
pattern: ^[^\s]+$
1616+
Pattern: ^(?:[A-Za-z]+\("([A-Za-z\s]+)"\)|[A-Za-z]+)
1617+
pattern: ^(?:[A-Za-z]+\("([A-Za-z\s]+)"\)|[A-Za-z]+)
16181618
type: string
16191619
cond:
16201620
description: |-
@@ -1692,6 +1692,10 @@ spec:
16921692
resolve_var:
16931693
description: resolve var
16941694
type: string
1695+
rst_ttl:
1696+
description: rst ttl
1697+
format: int64
1698+
type: integer
16951699
sc_idx:
16961700
description: sc idx
16971701
type: string

deploy/tests/e2e/client.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,34 @@ func GetGlobalHAProxyInfo() (info GlobalHAProxyInfo, err error) {
239239
}
240240
return
241241
}
242+
243+
type CertInfo struct {
244+
Used bool
245+
Subject string
246+
Issuer string
247+
}
248+
249+
func GetCertSubject(filename string) (certInfo CertInfo, err error) {
250+
var result []byte
251+
result, err = runtimeCommand("show ssl cert " + filename)
252+
if err != nil {
253+
return
254+
}
255+
scanner := bufio.NewScanner(bytes.NewReader(result))
256+
for scanner.Scan() {
257+
line := scanner.Text()
258+
switch {
259+
case strings.HasPrefix(line, "Used:"):
260+
used, convErr := strconv.ParseBool(strings.Split(line, ": ")[1])
261+
if convErr != nil {
262+
return
263+
}
264+
certInfo.Used = used
265+
case strings.HasPrefix(line, "Subject:"):
266+
certInfo.Subject = strings.Split(line, ": ")[1]
267+
case strings.HasPrefix(line, "Issuer:"):
268+
certInfo.Issuer = strings.Split(line, ": ")[1]
269+
}
270+
}
271+
return
272+
}

deploy/tests/e2e/crd-tcp/cr_tcp_additional_services_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import (
2020
"strings"
2121
"testing"
2222

23-
parser "github.com/haproxytech/config-parser/v5"
24-
"github.com/haproxytech/config-parser/v5/options"
25-
"github.com/haproxytech/config-parser/v5/params"
26-
"github.com/haproxytech/config-parser/v5/types"
23+
parser "github.com/haproxytech/client-native/v5/config-parser"
24+
"github.com/haproxytech/client-native/v5/config-parser/options"
25+
"github.com/haproxytech/client-native/v5/config-parser/params"
26+
"github.com/haproxytech/client-native/v5/config-parser/types"
2727
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
2828
"github.com/stretchr/testify/suite"
2929
)

deploy/tests/e2e/crd-tcp/cr_tcp_backend_switching_rule_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121
"strings"
2222
"testing"
2323

24-
parser "github.com/haproxytech/config-parser/v5"
25-
"github.com/haproxytech/config-parser/v5/options"
26-
tcp_actions "github.com/haproxytech/config-parser/v5/parsers/tcp/actions"
27-
tcptypes "github.com/haproxytech/config-parser/v5/parsers/tcp/types"
28-
"github.com/haproxytech/config-parser/v5/types"
24+
parser "github.com/haproxytech/client-native/v5/config-parser"
25+
"github.com/haproxytech/client-native/v5/config-parser/options"
26+
tcp_actions "github.com/haproxytech/client-native/v5/config-parser/parsers/tcp/actions"
27+
tcptypes "github.com/haproxytech/client-native/v5/config-parser/parsers/tcp/types"
28+
"github.com/haproxytech/client-native/v5/config-parser/types"
2929
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
3030
"github.com/stretchr/testify/suite"
3131
)

deploy/tests/e2e/crd-tcp/cr_tcp_full_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import (
2020
"strings"
2121
"testing"
2222

23-
parser "github.com/haproxytech/config-parser/v5"
24-
"github.com/haproxytech/config-parser/v5/options"
25-
filtertypes "github.com/haproxytech/config-parser/v5/parsers/filters"
26-
tcp_actions "github.com/haproxytech/config-parser/v5/parsers/tcp/actions"
27-
tcptypes "github.com/haproxytech/config-parser/v5/parsers/tcp/types"
28-
"github.com/haproxytech/config-parser/v5/types"
23+
parser "github.com/haproxytech/client-native/v5/config-parser"
24+
"github.com/haproxytech/client-native/v5/config-parser/options"
25+
filtertypes "github.com/haproxytech/client-native/v5/config-parser/parsers/filters"
26+
tcp_actions "github.com/haproxytech/client-native/v5/config-parser/parsers/tcp/actions"
27+
tcptypes "github.com/haproxytech/client-native/v5/config-parser/parsers/tcp/types"
28+
"github.com/haproxytech/client-native/v5/config-parser/types"
2929
"github.com/stretchr/testify/suite"
3030
)
3131

deploy/tests/e2e/crd-tcp/cr_tcp_no_ingress_class_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import (
2020
"strings"
2121
"testing"
2222

23-
parser "github.com/haproxytech/config-parser/v5"
24-
"github.com/haproxytech/config-parser/v5/options"
23+
parser "github.com/haproxytech/client-native/v5/config-parser"
24+
"github.com/haproxytech/client-native/v5/config-parser/options"
2525
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
2626
"github.com/stretchr/testify/suite"
2727
)

deploy/tests/e2e/crd-tcp/cr_tcp_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import (
2020
"strings"
2121
"testing"
2222

23-
parser "github.com/haproxytech/config-parser/v5"
24-
"github.com/haproxytech/config-parser/v5/options"
25-
"github.com/haproxytech/config-parser/v5/params"
26-
"github.com/haproxytech/config-parser/v5/types"
23+
parser "github.com/haproxytech/client-native/v5/config-parser"
24+
"github.com/haproxytech/client-native/v5/config-parser/options"
25+
"github.com/haproxytech/client-native/v5/config-parser/params"
26+
"github.com/haproxytech/client-native/v5/config-parser/types"
2727
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
2828
"github.com/stretchr/testify/suite"
2929
)

deploy/tests/e2e/crd-tcp/suite_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import (
2323

2424
"github.com/stretchr/testify/suite"
2525

26-
parser "github.com/haproxytech/config-parser/v5"
27-
"github.com/haproxytech/config-parser/v5/common"
28-
"github.com/haproxytech/config-parser/v5/params"
29-
"github.com/haproxytech/config-parser/v5/types"
26+
parser "github.com/haproxytech/client-native/v5/config-parser"
27+
"github.com/haproxytech/client-native/v5/config-parser/common"
28+
"github.com/haproxytech/client-native/v5/config-parser/params"
29+
"github.com/haproxytech/client-native/v5/config-parser/types"
3030
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
3131
)
3232

deploy/tests/e2e/crd/cr_global_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121
"strings"
2222
"testing"
2323

24-
parser "github.com/haproxytech/config-parser/v5"
25-
"github.com/haproxytech/config-parser/v5/common"
26-
"github.com/haproxytech/config-parser/v5/options"
27-
"github.com/haproxytech/config-parser/v5/params"
28-
"github.com/haproxytech/config-parser/v5/types"
24+
parser "github.com/haproxytech/client-native/v5/config-parser"
25+
"github.com/haproxytech/client-native/v5/config-parser/common"
26+
"github.com/haproxytech/client-native/v5/config-parser/options"
27+
"github.com/haproxytech/client-native/v5/config-parser/params"
28+
"github.com/haproxytech/client-native/v5/config-parser/types"
2929
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
3030
"github.com/stretchr/testify/suite"
3131
)

deploy/tests/e2e/crd/suite_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121

2222
"github.com/stretchr/testify/suite"
2323

24-
parser "github.com/haproxytech/config-parser/v5"
25-
"github.com/haproxytech/config-parser/v5/options"
26-
"github.com/haproxytech/config-parser/v5/types"
24+
parser "github.com/haproxytech/client-native/v5/config-parser"
25+
"github.com/haproxytech/client-native/v5/config-parser/options"
26+
"github.com/haproxytech/client-native/v5/config-parser/types"
2727
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
2828
)
2929

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: ingress.v1.haproxy.org/v1
2+
kind: Backend
3+
metadata:
4+
name: be-test
5+
spec:
6+
config:
7+
name: test-be-simple
8+
abortonclose: "enabled"
9+
accept_invalid_http_response: "enabled"
10+
default_server:
11+
check: "enabled"
12+
acls:
13+
- acl_name: switch_be_0
14+
criterion: req_ssl_sni
15+
index: 0
16+
value: -i backend100.example.com
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
kind: Deployment
2+
apiVersion: apps/v1
3+
metadata:
4+
name: http-echo-offload
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: http-echo-offload
10+
template:
11+
metadata:
12+
labels:
13+
app: http-echo-offload
14+
spec:
15+
containers:
16+
- name: http-echo
17+
image: "haproxytech/http-echo:latest"
18+
imagePullPolicy: Never
19+
ports:
20+
- name: http
21+
containerPort: 8888
22+
protocol: TCP
23+
- name: https
24+
containerPort: 8443
25+
protocol: TCP
26+
---
27+
kind: Service
28+
apiVersion: v1
29+
metadata:
30+
name: http-echo-offload
31+
annotations:
32+
cr-backend: be-test
33+
spec:
34+
ports:
35+
- name: http
36+
protocol: TCP
37+
port: 80
38+
targetPort: http
39+
- name: https
40+
protocol: TCP
41+
port: 443
42+
targetPort: https
43+
selector:
44+
app: http-echo-offload
45+
---
46+
kind: Ingress
47+
apiVersion: networking.k8s.io/v1
48+
metadata:
49+
name: http-echo-offload
50+
annotations:
51+
ingress.class: haproxy
52+
spec:
53+
tls:
54+
- hosts:
55+
- offload-test.haproxy
56+
secretName: haproxy-offload-test
57+
- hosts:
58+
- offload-test-1.haproxy
59+
secretName: haproxy-offload-test-1
60+
- hosts:
61+
- offload-test-2.haproxy
62+
secretName: haproxy-offload-test-2
63+
- hosts:
64+
- offload-test-3.haproxy
65+
secretName: haproxy-offload-test-3
66+
- hosts:
67+
- offload-test-4.haproxy
68+
secretName: haproxy-offload-test-4
69+
- hosts:
70+
- default.haproxy
71+
secretName: haproxy-default
72+
rules:
73+
- host: "offload-test.haproxy"
74+
http:
75+
paths:
76+
- path: /
77+
pathType: Prefix
78+
backend:
79+
service:
80+
name: http-echo-offload
81+
port:
82+
name: http
83+
- host: "offload-test-1.haproxy"
84+
http:
85+
paths:
86+
- path: /test1
87+
pathType: Prefix
88+
backend:
89+
service:
90+
name: http-echo-offload
91+
port:
92+
name: http
93+
---

0 commit comments

Comments
 (0)