Skip to content

Commit d39103a

Browse files
committed
feat: Add httproute support for vmauth.
1 parent 48769e9 commit d39103a

File tree

18 files changed

+3609
-5
lines changed

18 files changed

+3609
-5
lines changed

api/go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ require (
1414
k8s.io/apimachinery v0.34.1
1515
k8s.io/client-go v0.34.1
1616
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
17-
sigs.k8s.io/controller-runtime v0.20.2
17+
sigs.k8s.io/controller-runtime v0.20.4
18+
sigs.k8s.io/gateway-api v1.3.0
1819
)
1920

2021
require (

api/go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,10 @@ k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt
617617
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
618618
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
619619
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
620-
sigs.k8s.io/controller-runtime v0.20.2 h1:/439OZVxoEc02psi1h4QO3bHzTgu49bb347Xp4gW1pc=
621-
sigs.k8s.io/controller-runtime v0.20.2/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY=
620+
sigs.k8s.io/controller-runtime v0.20.4 h1:X3c+Odnxz+iPTRobG4tp092+CvBU9UK0t/bRf+n0DGU=
621+
sigs.k8s.io/controller-runtime v0.20.4/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY=
622+
sigs.k8s.io/gateway-api v1.3.0 h1:q6okN+/UKDATola4JY7zXzx40WO4VISk7i9DIfOvr9M=
623+
sigs.k8s.io/gateway-api v1.3.0/go.mod h1:d8NV8nJbaRbEKem+5IuxkL8gJGOZ+FJ+NvOIltV8gDk=
622624
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE=
623625
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
624626
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=

api/operator/v1beta1/vmauth_types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"k8s.io/apimachinery/pkg/labels"
1414
"k8s.io/utils/ptr"
1515
"sigs.k8s.io/controller-runtime/pkg/client"
16+
gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"
1617
)
1718

1819
var labelNameRegexp = regexp.MustCompile("^[a-zA-Z_:.][a-zA-Z0-9_:.]*$")
@@ -66,6 +67,8 @@ type VMAuthSpec struct {
6667
PodDisruptionBudget *EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty" yaml:"podDisruptionBudget,omitempty"`
6768
// Ingress enables ingress configuration for VMAuth.
6869
Ingress *EmbeddedIngress `json:"ingress,omitempty"`
70+
// HTTPRoute enables httproute configuration for VMAuth.
71+
HTTPRoute *EmbeddedHTTPRoute `json:"httpRoute,omitempty"`
6972
// LivenessProbe that will be added to VMAuth pod
7073
*EmbeddedProbes `json:",inline"`
7174
// UnauthorizedAccessConfig configures access for un authorized users
@@ -469,6 +472,15 @@ func (cr *VMAuthSpec) UnmarshalJSON(src []byte) error {
469472
return nil
470473
}
471474

475+
// EmbeddedHTTPRoute describes httproute configuration options.
476+
type EmbeddedHTTPRoute struct {
477+
// EmbeddedObjectMetadata adds labels and annotations for object.
478+
EmbeddedObjectMetadata `json:",inline"`
479+
// Spec describes the attributes that a user creates on a httproute.
480+
// More info: https://gateway-api.sigs.k8s.io/api-types/httproute/
481+
Spec gwapiv1.HTTPRouteSpec `json:"spec"`
482+
}
483+
472484
// EmbeddedIngress describes ingress configuration options.
473485
type EmbeddedIngress struct {
474486
// ClassName defines ingress class name for VMAuth

api/operator/v1beta1/zz_generated.deepcopy.go

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/base-with-webhook/kustomization.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,9 @@ replacements:
8080
group: cert-manager.io
8181
kind: Certificate
8282
version: v1
83+
apiVersion: kustomize.config.k8s.io/v1beta1
84+
kind: Kustomization
85+
images:
86+
- name: manager
87+
newName: localhost:5001/victoriametrics/operator
88+
newTag: heads-master-0-g1a308796-dirty-8e974fa6

config/crd/overlay/crd.yaml

Lines changed: 3389 additions & 0 deletions
Large diffs are not rendered by default.

config/manager/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
resources:
22
- manager.yaml
3+
- ../rbac

config/rbac/role.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,9 @@ rules:
200200
- vmanomalies/status
201201
verbs:
202202
- '*'
203+
- apiGroups:
204+
- gateway.networking.k8s.io
205+
resources:
206+
- httproutes
207+
verbs:
208+
- '*'

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ aliases:
1818
* FEATURE: [vmoperator](https://docs.victoriametrics.com/operator/): add `VM_ENABLETCP6` variable that runs all operator CRs in IPv6 mode. See [#1581](https://github.com/VictoriaMetrics/operator/issues/1581).
1919
* FEATURE: [config-reloader](https://github.com/VictoriaMetrics/operator/blob/master/cmd/config-reloader/README.md): set default config reloader image version equal to current operator version. See [#2562](https://github.com/VictoriaMetrics/helm-charts/pull/2562).
2020
* FEATURE: [vmagent](https://docs.victoriametrics.com/operator/resources/vmagent/): do not set `promscrape.cluster.membersCount` and `promscrape.cluster.memberNum` flags in ingestOnly mode. See [#1594](https://github.com/VictoriaMetrics/operator/issues/1594).
21+
* FEATURE: [vmauth](https://docs.victoriametrics.com/operator/resources/vmauth/): Add httproute support for vmauth. See[#1625](https://github.com/VictoriaMetrics/operator/issues/1625)
2122

2223
* BUGFIX: [vmalertmanager](https://docs.victoriametrics.com/operator/resources/vmalertmanager/): check `mute_time_intervals` in subroutes: See [#1618](https://github.com/VictoriaMetrics/operator/issues/1618).
2324

docs/api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,14 @@ Appears in: [VMAuthSpec](#vmauthspec)
17261726
| tlsSecretName<a href="#embeddedingress-tlssecretname" id="embeddedingress-tlssecretname">#</a><br/>_string_ | _(Optional)_<br/>TlsSecretName defines secretname at the VMAuth namespace with cert and key<br />https://kubernetes.io/docs/concepts/services-networking/ingress/#tls |
17271727

17281728

1729+
#### EmbeddedHTTPRoute
1730+
1731+
1732+
| Field | Description |
1733+
| ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1734+
| **spec**<a href="#embeddedhttproute-spec" id="embeddedhttproute-spec">#</a><br/>*[HTTPRouteSpec](https://gateway-api.sigs.k8s.io/reference/spec/#httproutespec)* | *(Required)*<br/>The specification of the HTTPRoute resource. This field defines routing rules, matches, filters, backend references, and other HTTP-level behaviors.<br/>See: [https://gateway-api.sigs.k8s.io/api-types/httproute/](https://gateway-api.sigs.k8s.io/api-types/httproute/) |
1735+
1736+
17291737
#### EmbeddedObjectMetadata
17301738

17311739

0 commit comments

Comments
 (0)