Skip to content

Commit

Permalink
Merge pull request #2339 from cliveseldon/1675_k8s_1.18
Browse files Browse the repository at this point in the history
k8s 1.18 fix
  • Loading branch information
axsaucedo authored Aug 30, 2020
2 parents c187a40 + af843c0 commit 0ff3a36
Show file tree
Hide file tree
Showing 14 changed files with 43,577 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.crd.create }}
{{- if semverCompare "<1.18.0" .Capabilities.KubeVersion.GitVersion }}
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -4216,3 +4217,4 @@ status:
conditions: []
storedVersions: []
{{- end }}
{{- end }}

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ install: manifests
uninstall: manifests
kustomize build config/crd | kubectl delete -f -

# Install V1 CRDs into a cluster
# Note use of create to stop too long annotation being created. See https://github.com/kubernetes-sigs/kubebuilder/issues/1140
install_v1: manifests_v1
kustomize build config/crd_v1 | kubectl create -f -

# Uninstall V1 CRDs into a cluster
uninstall_v1:
kustomize build config/crd_v1 | kubectl delete -f -

# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
deploy: manifests
cd config/manager && kustomize edit set image controller=${IMG}
Expand Down Expand Up @@ -113,6 +122,9 @@ deploy-lite: manifests
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases

manifests_v1: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd_v1/bases crd:crdVersions=v1

# Run go fmt against code
fmt:
go fmt ./...
Expand Down Expand Up @@ -225,3 +237,6 @@ generate-resources:
mkdir generated
kustomize build config/default/ -o generated
cp generated/apiextensions.k8s.io_v1beta1_customresourcedefinition_seldondeployments.machinelearning.seldon.io.yaml testing/machinelearning.seldon.io_seldondeployments.yaml

config/crd_v1/patches/graph_children.yaml:
python hack/create_graph_openapi_schema.py hack/graph_patch.tmpl.yaml config/crd_v1/patches/graph_children.yaml
4 changes: 4 additions & 0 deletions operator/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ patchesStrategicMerge:
# Also see: https://github.com/kubernetes-sigs/kubebuilder/issues/1128
# Remove volume patch below for Kubernetes 1.17, 1.18 when tested

# Warning
# apiextensions.k8s.io/v1beta1 version of CustomResourceDefinition is deprecated in v1.16 and will no longer be served in v1.19. Need use apiextensions.k8s.io/v1 which is defined in ../crd_v1.
# Remove this folder when 1.17 k8s is no longer used.

patchesJson6902:
- target:
group: apiextensions.k8s.io
Expand Down
25,115 changes: 25,115 additions & 0 deletions operator/config/crd_v1/bases/machinelearning.seldon.io_seldondeployments.yaml

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions operator/config/crd_v1/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This kustomization.yaml is not intended to be run by itself,
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/machinelearning.seldon.io_seldondeployments.yaml
# +kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
# Seldon: Add webhook conversion when we move to v1 of the API
#
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_seldondeployments.yaml
# +kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
- patches/cainjection_in_seldondeployments.yaml
# +kubebuilder:scaffold:crdkustomizecainjectionpatch

patchesJson6902:
# Ensure multiple levels of graph defn in OpenAPISpec as you can't have references let alone recursive refs
# https://github.com/kubernetes/kubernetes/issues/54579
- target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
name: seldondeployments.machinelearning.seldon.io
path: patches/graph_children.yaml
# kubebuilder/k8s has an issues that Protocol from core types is not fully specied w.r.t OpenAPISchema
# https://github.com/kubernetes/kubernetes/issues/91395
# This fixes that by adding a TCP default
- target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
name: seldondeployments.machinelearning.seldon.io
path: patches/protocol.yaml

# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
- kustomizeconfig.yaml



17 changes: 17 additions & 0 deletions operator/config/crd_v1/kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is for teaching kustomize how to substitute name and namespace reference in CRD
nameReference:
- kind: Service
version: v1
fieldSpecs:
- kind: CustomResourceDefinition
group: apiextensions.k8s.io
path: spec/conversion/webhookClientConfig/service/name

namespace:
- kind: CustomResourceDefinition
group: apiextensions.k8s.io
path: spec/conversion/webhookClientConfig/service/namespace
create: false

varReference:
- path: metadata/annotations
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
# CRD conversion requires k8s 1.13 or later.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: seldondeployments.machinelearning.seldon.io
Loading

0 comments on commit 0ff3a36

Please sign in to comment.