Skip to content
Open
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
6 changes: 3 additions & 3 deletions deps.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
!!! GENERATED FILE, DO NOT EDIT !!!
This file contains the list of modules that this package depends on
in order to trigger CI on changes
Run 'make gen-deps-files' to regenerate.

go 1.25.7
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
Expand Down Expand Up @@ -38,13 +37,14 @@ gopkg.in/evanphx/json-patch.v4 v4.13.0
gopkg.in/inf.v0 v0.9.1
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.34.4
k8s.io/apiextensions-apiserver v0.34.4
k8s.io/apimachinery v0.34.4
k8s.io/apiserver v0.34.4
k8s.io/client-go v0.34.4
k8s.io/klog v0.2.0
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20250814151709-d7b6acb124c3
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730
sigs.k8s.io/randfill v1.0.0
sigs.k8s.io/structured-merge-diff/v6 v6.3.0
Expand Down
53 changes: 53 additions & 0 deletions embed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright (c) 2026 Tigera, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

import (
"embed"
"fmt"
"strings"

v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"sigs.k8s.io/yaml"
)

// crdFiles contains the v3 CRD YAML definitions.
//
//go:embed config/crd/*.yaml
var crdFiles embed.FS

// AllCRDs loads and returns all embedded v3 CRD definitions.
func AllCRDs() ([]*v1.CustomResourceDefinition, error) {
var crds []*v1.CustomResourceDefinition
entries, err := crdFiles.ReadDir("config/crd")
if err != nil {
return nil, fmt.Errorf("failed to read embedded CRD directory: %w", err)
}
for _, d := range entries {
if d.IsDir() || !strings.HasSuffix(d.Name(), ".yaml") {
continue
}
rawYAML, err := crdFiles.ReadFile("config/crd/" + d.Name())
if err != nil {
return nil, fmt.Errorf("failed to read embedded CRD %s: %w", d.Name(), err)
}
var crd v1.CustomResourceDefinition
if err := yaml.Unmarshal(rawYAML, &crd); err != nil {
return nil, fmt.Errorf("failed to unmarshal CRD %s: %w", d.Name(), err)
}
crds = append(crds, &crd)
}
return crds, nil
}
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ require (
github.com/onsi/ginkgo/v2 v2.28.1
github.com/onsi/gomega v1.39.1
k8s.io/api v0.34.4
k8s.io/apiextensions-apiserver v0.0.0-00010101000000-000000000000
k8s.io/apimachinery v0.34.4
k8s.io/apiserver v0.34.4
k8s.io/client-go v0.34.4
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b
sigs.k8s.io/yaml v1.6.0
)

require (
Expand Down Expand Up @@ -58,7 +60,6 @@ require (
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)

replace (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.34.4 h1:Z5hsoQcZ2yBjelb9j5JKzCVo9qv9XLkVm5llnqS4h+0=
k8s.io/api v0.34.4/go.mod h1:6SaGYuGPkMqqCgg8rPG/OQoCrhgSEV+wWn9v21fDP3o=
k8s.io/apiextensions-apiserver v0.34.4 h1:TAh2mEduc27sR7lfEthOL2oNeQuux9pQCEJCVC9Gxrs=
k8s.io/apiextensions-apiserver v0.34.4/go.mod h1:13rZ7iu/F4APVV0I0StgBmhvWBGgjGTDaqi21G0113E=
k8s.io/apimachinery v0.34.4 h1:C5SiSzLEMyWIk53sSbnk0WlOOyqv/MFnWvuc/d6M+xc=
k8s.io/apimachinery v0.34.4/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw=
k8s.io/apiserver v0.34.4 h1:QmMakuCjlFBJpsXKIUom8OUE7+PhZk7hyNiLqlyDH58=
Expand Down
Loading