diff --git a/Makefile b/Makefile index 7a5728d0d..c4feaeb4b 100644 --- a/Makefile +++ b/Makefile @@ -135,11 +135,11 @@ controller.image: controller-manifest-$(subst :,$(comma),$(subst /,%,$(CONTROLLE $(KUBECFG) show -V CONTROLLER_IMAGE=$(CONTROLLER_IMAGE) -V IMAGE_PULL_POLICY=$(IMAGE_PULL_POLICY) -o yaml $< > $@.tmp mv $@.tmp $@ -controller.yaml: controller.jsonnet controller-norbac.jsonnet +controller.yaml: controller.jsonnet controller-norbac.jsonnet schema-v1alpha1.yaml kube-fixes.libsonnet -controller-norbac.yaml: controller-norbac.jsonnet +controller-norbac.yaml: controller-norbac.jsonnet schema-v1alpha1.yaml kube-fixes.libsonnet -controller-podmonitor.yaml: controller.jsonnet controller-norbac.jsonnet +controller-podmonitor.yaml: controller.jsonnet controller-norbac.jsonnet schema-v1alpha1.yaml kube-fixes.libsonnet test: $(GO) test $(GO_FLAGS) $(GO_PACKAGES) diff --git a/controller-norbac.jsonnet b/controller-norbac.jsonnet index 8ecf9c9e2..81d8904c4 100644 --- a/controller-norbac.jsonnet +++ b/controller-norbac.jsonnet @@ -1,19 +1,28 @@ // Minimal required deployment for a functional controller. +local kubecfg = import "kubecfg.libsonnet"; + local namespace = 'kube-system'; { kube:: (import 'vendor_jsonnet/kube-libsonnet/kube.libsonnet'), - local kube = self.kube, + local kube = self.kube + import 'kube-fixes.libsonnet', controllerImage:: std.extVar('CONTROLLER_IMAGE'), imagePullPolicy:: std.extVar('IMAGE_PULL_POLICY'), crd: kube.CustomResourceDefinition('bitnami.com', 'v1alpha1', 'SealedSecret') { spec+: { - subresources: { - status: {}, - } + versions_+: { + v1alpha1+: { + served: true, + storage: true, + subresources: { + status: {}, + }, + schema: kubecfg.parseYaml(importstr "schema-v1alpha1.yaml")[0], + }, + }, }, }, diff --git a/kube-fixes.libsonnet b/kube-fixes.libsonnet new file mode 100644 index 000000000..f48b8c4fe --- /dev/null +++ b/kube-fixes.libsonnet @@ -0,0 +1,27 @@ +{ + CustomResourceDefinition(group, version, kind): { + local this = self, + apiVersion: 'apiextensions.k8s.io/v1', + kind: 'CustomResourceDefinition', + metadata+: { + name: this.spec.names.plural + '.' + this.spec.group, + }, + spec: { + scope: 'Namespaced', + group: group, + versions_:: { + [version]: { + served: true, + storage: true, + }, + }, + versions: $.mapToNamedList(self.versions_), + names: { + kind: kind, + singular: $.toLower(self.kind), + plural: self.singular + 's', + listKind: self.kind + 'List', + }, + }, + }, +} diff --git a/schema-v1alpha1.yaml b/schema-v1alpha1.yaml new file mode 100644 index 000000000..2b4909a2f --- /dev/null +++ b/schema-v1alpha1.yaml @@ -0,0 +1,7 @@ +openAPIV3Schema: + type: object + properties: + spec: + type: object + x-kubernetes-preserve-unknown-fields: true + properties: {}