Skip to content

Commit ee8f90f

Browse files
committed
operator: add register-gen and conversion-gen
Adds the following binaries to our nix shell: - `conversion-gen` (unused) - `defaulter-gen` (unused) - `register-gen` Existing CRD packages have been refactored to rely on `register-gen` to generate `SchemaBuilder` and call `Register` on root object types. The majority of changes are rote; either changing AddToScheme -> Install, removal of modifications to k8s' global schema, or generated code differences.
1 parent e32ec70 commit ee8f90f

File tree

81 files changed

+582
-451
lines changed

Some content is hidden

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

81 files changed

+582
-451
lines changed

acceptance/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var setupSuite = sync.OnceValues(func() (*framework.Suite, error) {
5959
"quay.io/jetstack/cert-manager-startupapicheck:v1.14.2",
6060
"quay.io/jetstack/cert-manager-webhook:v1.14.2",
6161
}...).
62-
WithSchemeFunctions(redpandav1alpha1.AddToScheme, redpandav1alpha2.AddToScheme).
62+
WithSchemeFunctions(redpandav1alpha1.Install, redpandav1alpha2.Install).
6363
WithHelmChart("https://charts.jetstack.io", "jetstack", "cert-manager", helm.InstallOptions{
6464
Name: "cert-manager",
6565
Namespace: "cert-manager",

acceptance/steps/k8s.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func kubernetesObjectHasClusterOwner(ctx context.Context, t framework.TestingT,
3535
require.Eventually(t, func() bool {
3636
require.NoError(t, t.Get(ctx, t.ResourceKey(clusterName), &cluster))
3737
require.NoError(t, t.Get(ctx, t.ResourceKey(resourceName), o))
38-
cluster.SetGroupVersionKind(redpandav1alpha2.GroupVersion.WithKind("Redpanda"))
38+
cluster.SetGroupVersionKind(redpandav1alpha2.SchemeGroupVersion.WithKind("Redpanda"))
3939

4040
references := o.GetOwnerReferences()
4141
if len(references) != 1 {

ci/applyconfiguration-gen.nix

Lines changed: 0 additions & 24 deletions
This file was deleted.

ci/code-generator.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{ buildGoModule
2+
, fetchFromGitHub
3+
}:
4+
5+
buildGoModule rec {
6+
pname = "code-generator";
7+
version = "0.33.0";
8+
9+
# Don't run tests.
10+
doCheck = false;
11+
doInstallCheck = false;
12+
13+
src = fetchFromGitHub {
14+
owner = "kubernetes";
15+
repo = "code-generator";
16+
rev = "v${version}";
17+
hash = "sha256-orYME5Uzf1U/PGfYM9RzYzvy8XlEcnp1vTJXxZ1PJkA=";
18+
};
19+
20+
subPackages = [
21+
"cmd/applyconfiguration-gen"
22+
"cmd/conversion-gen"
23+
"cmd/defaulter-gen"
24+
"cmd/register-gen"
25+
];
26+
27+
vendorHash = "sha256-X3OuYF9mqbH6slH6bj1zJY40hDQ5omrDC16ZiM8l5I4=";
28+
}

ci/controller-gen.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ buildGoModule rec {
2323

2424
subPackages = [
2525
"cmd/controller-gen"
26-
"cmd/type-scaffold"
2726
"cmd/helpgen"
2827
];
2928

ci/overlay.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{ pkgs
22
}: (final: prev: {
3-
applyconfiguration-gen = pkgs.callPackage ./applyconfiguration-gen.nix { };
3+
code-generator = pkgs.callPackage ./code-generator.nix { };
44
backport = pkgs.callPackage ./backport.nix { };
55
controller-gen = pkgs.callPackage ./controller-gen.nix { };
66
crd-ref-docs = pkgs.callPackage ./crd-ref-docs.nix { };

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
# update TestToolVersions.
5050
packages = [
5151
pkgs.actionlint # Github Workflow definition linter https://github.com/rhysd/actionlint
52-
pkgs.applyconfiguration-gen
5352
pkgs.awscli2
5453
pkgs.backport
5554
pkgs.bk
5655
pkgs.buildkite-agent
5756
pkgs.changie # Changelog manager
57+
pkgs.code-generator
5858
pkgs.controller-gen
5959
pkgs.crd-ref-docs # Generates documentation from CRD definitions. Used by our docs but present here to let us control and test the config.yaml
6060
pkgs.diffutils # Provides `diff`, used by golangci-lint.

operator/api/applyconfiguration/redpanda/v1alpha2/aclresourcespec.go

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

operator/api/applyconfiguration/redpanda/v1alpha2/aclrule.go

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

operator/api/applyconfiguration/redpanda/v1alpha2/adminapispec.go

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

0 commit comments

Comments
 (0)