Skip to content

Commit

Permalink
Update CRD to apiextensions.k8s.io/v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Mikulicic committed Dec 18, 2020
1 parent 0b2ea97 commit a5c4f54
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 13 additions & 4 deletions controller-norbac.jsonnet
Original file line number Diff line number Diff line change
@@ -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],
},
},
},
},

Expand Down
27 changes: 27 additions & 0 deletions kube-fixes.libsonnet
Original file line number Diff line number Diff line change
@@ -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',
},
},
},
}
7 changes: 7 additions & 0 deletions schema-v1alpha1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
openAPIV3Schema:
type: object
properties:
spec:
type: object
x-kubernetes-preserve-unknown-fields: true
properties: {}

0 comments on commit a5c4f54

Please sign in to comment.