metropolis/build: add kube-code-generator

This implements kube-code-generator, a set of Bazel rules for generating
Kubernetes resource APIs based on a Go library, using
k8s.io/code-generator.

Test Plan: Was considering adding a test for this - but this is practically best tested with the next change in the stack, which actually uses it to implement the VM hypervisor kube API.

X-Origin-Diff: phab/D751
GitOrigin-RevId: 31e3b632c2e83282c8b2c415402cddea66d4ce51
diff --git a/metropolis/build/kube-code-generator/BUILD.bazel b/metropolis/build/kube-code-generator/BUILD.bazel
new file mode 100644
index 0000000..52d6327
--- /dev/null
+++ b/metropolis/build/kube-code-generator/BUILD.bazel
@@ -0,0 +1,21 @@
+load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
+
+exports_files(["boilerplate.go.txt"])
+
+# Flag determining whether the current build graph traversal is happening for
+# preprocessing by kube-code-generator ('yes'), or not ('no'). Set by
+# preprocessing_transition.
+string_flag(
+    name = "preprocessing",
+    build_setting_default = "no",
+)
+
+# Config setting on which go_libraries embedding go_kubernetes_libraries
+# potentially forming a cycle (eg. deepcopy, which is embedded in the same
+# go_library from which it is generated) can rely on to break this cycle.
+config_setting(
+    name = "embed_deepcopy",
+    flag_values = {
+        ":preprocessing": "no",
+    },
+)