Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seldon CRD Status Removal #2941

Merged
merged 3 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: '{{ include "seldon.namespace" . }}/seldon-serving-cert'
controller-gen.kubebuilder.io/version: v0.2.9
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
labels:
app: seldon
Expand Down Expand Up @@ -4546,11 +4546,5 @@ spec:
- name: v1alpha3
served: true
storage: false
status:
acceptedNames:
kind: ''
plural: ''
conditions: []
storedVersions: []
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: '{{ include "seldon.namespace" . }}/seldon-serving-cert'
controller-gen.kubebuilder.io/version: v0.2.9
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: seldondeployments.machinelearning.seldon.io
spec:
Expand Down Expand Up @@ -2033,6 +2033,7 @@ spec:
description: If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP".
type: string
required:
Expand Down Expand Up @@ -7826,6 +7827,7 @@ spec:
description: If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP".
type: string
required:
Expand Down Expand Up @@ -13619,6 +13621,7 @@ spec:
description: If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP".
type: string
required:
Expand Down Expand Up @@ -17398,11 +17401,5 @@ spec:
specReplicasPath: .spec.replicas
statusReplicasPath: .status.replicas
status: {}
status:
acceptedNames:
kind: ''
plural: ''
conditions: []
storedVersions: []
{{- end }}
{{- end }}
28 changes: 14 additions & 14 deletions helm-charts/seldon-core-operator/templates/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@
{{- $cert := genSignedCert "seldon-webhook-service" nil $altNames 365 $ca -}}
---

{{- if not .Values.certManager.enabled -}}
apiVersion: v1
data:
ca.crt: '{{ $ca.Cert | b64enc }}'
tls.crt: '{{ $cert.Cert | b64enc }}'
tls.key: '{{ $cert.Key | b64enc }}'
kind: Secret
metadata:
name: seldon-webhook-server-cert
namespace: '{{ include "seldon.namespace" . }}'
type: kubernetes.io/tls
{{- end }}
---

apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingWebhookConfiguration
metadata:
Expand Down Expand Up @@ -184,5 +170,19 @@ webhooks:
resources:
- seldondeployments
sideEffects: None
---

{{- if not .Values.certManager.enabled -}}
apiVersion: v1
data:
ca.crt: '{{ $ca.Cert | b64enc }}'
tls.crt: '{{ $cert.Cert | b64enc }}'
tls.key: '{{ $cert.Key | b64enc }}'
kind: Secret
metadata:
name: seldon-webhook-server-cert
namespace: '{{ include "seldon.namespace" . }}'
type: kubernetes.io/tls
{{- end }}

{{- end }}
7 changes: 2 additions & 5 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ IMAGE_NAME_BASE=seldon-core-operator
IMG ?= seldonio/${IMAGE_NAME_BASE}:${VERSION}
IMG_VERSION_REDHAT ?= ${IMAGE_NAME_BASE}-ubi8:${VERSION}
IMG_REDHAT ?= seldonio/${IMG_VERSION_REDHAT}
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
#CRD_OPTIONS ?= ""

KIND_NAME ?= kind

Expand Down Expand Up @@ -121,7 +118,7 @@ deploy-lite: manifests

# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases crd:crdVersions=v1beta1

# Commented out alternative is looking ahead to issue that on Openshift our v1 CRD is too large
# to be installed. This may also affect operator-sdk community operators.
Expand Down Expand Up @@ -189,7 +186,7 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.9 ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (r *SeldonDeploymentSpec) ValidateSeldonDeployment() error {
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
// +kubebuilder:webhook:verbs=create;update,path=/validate-machinelearning-seldon-io-v1-seldondeployment,mutating=false,failurePolicy=fail,sideEffects=None,groups=machinelearning.seldon.io,resources=seldondeployments,versions=v1,name=v1.vseldondeployment.kb.io
// +kubebuilder:webhook:webhookVersions=v1beta1,verbs=create;update,path=/validate-machinelearning-seldon-io-v1-seldondeployment,mutating=false,failurePolicy=fail,sideEffects=None,admissionReviewVersions=v1;v1beta1,groups=machinelearning.seldon.io,resources=seldondeployments,versions=v1,name=v1.vseldondeployment.kb.io

var _ webhook.Validator = &SeldonDeployment{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (r *SeldonDeployment) SetupWebhookWithManager(mgr ctrl.Manager) error {
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
// +kubebuilder:webhook:verbs=create;update,path=/validate-machinelearning-seldon-io-v1alpha2-seldondeployment,mutating=false,failurePolicy=fail,sideEffects=None,groups=machinelearning.seldon.io,resources=seldondeployments,versions=v1alpha2,name=v1alpha2.vseldondeployment.kb.io
// +kubebuilder:webhook:webhookVersions=v1beta1,verbs=create;update,path=/validate-machinelearning-seldon-io-v1alpha2-seldondeployment,mutating=false,failurePolicy=fail,sideEffects=None,groups=machinelearning.seldon.io,resources=seldondeployments,versions=v1alpha2,name=v1alpha2.vseldondeployment.kb.io

var _ webhook.Validator = &SeldonDeployment{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (r *SeldonDeployment) SetupWebhookWithManager(mgr ctrl.Manager) error {
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
// +kubebuilder:webhook:verbs=create;update,path=/validate-machinelearning-seldon-io-v1alpha3-seldondeployment,mutating=false,failurePolicy=fail,sideEffects=None,groups=machinelearning.seldon.io,resources=seldondeployments,versions=v1alpha3,name=v1alpha3.vseldondeployment.kb.io
// +kubebuilder:webhook:webhookVersions=v1beta1,verbs=create;update,path=/validate-machinelearning-seldon-io-v1alpha3-seldondeployment,mutating=false,failurePolicy=fail,sideEffects=None,groups=machinelearning.seldon.io,resources=seldondeployments,versions=v1alpha3,name=v1alpha3.vseldondeployment.kb.io

var _ webhook.Validator = &SeldonDeployment{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.9
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: seldondeployments.machinelearning.seldon.io
spec:
Expand Down
7 changes: 7 additions & 0 deletions operator/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ patchesJson6902:
kind: CustomResourceDefinition
name: seldondeployments.machinelearning.seldon.io
path: patches/protocol.yaml
# Fix for https://github.com/kubernetes-sigs/controller-tools/issues/456
- target:
group: apiextensions.k8s.io
version: v1beta1
kind: CustomResourceDefinition
name: seldondeployments.machinelearning.seldon.io
path: patches/status.json

# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
Expand Down
3 changes: 3 additions & 0 deletions operator/config/crd/patches/status.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{"op": "remove", "path": "/status"}
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.9
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: seldondeployments.machinelearning.seldon.io
spec:
Expand Down Expand Up @@ -2359,6 +2359,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be
UDP, TCP, or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -3653,6 +3654,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be
UDP, TCP, or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -4955,6 +4957,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be
UDP, TCP, or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -8063,6 +8066,7 @@ spec:
port that can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP,
or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -11274,6 +11278,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be
UDP, TCP, or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -12568,6 +12573,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be
UDP, TCP, or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -13870,6 +13876,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be
UDP, TCP, or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -16978,6 +16985,7 @@ spec:
port that can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP,
or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -20189,6 +20197,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be
UDP, TCP, or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -21483,6 +21492,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be
UDP, TCP, or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -22785,6 +22795,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be
UDP, TCP, or SCTP. Defaults to "TCP".
type: string
Expand Down Expand Up @@ -25893,6 +25904,7 @@ spec:
port that can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP,
or SCTP. Defaults to "TCP".
type: string
Expand Down
6 changes: 2 additions & 4 deletions operator/config/crd_v1/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ patchesJson6902:
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
# Fix for https://github.com/kubernetes-sigs/controller-tools/issues/456
- target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
name: seldondeployments.machinelearning.seldon.io
path: patches/protocol.yaml
path: patches/status.json

# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
Expand Down
28 changes: 0 additions & 28 deletions operator/config/crd_v1/patches/protocol.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions operator/config/crd_v1/patches/status.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{"op": "remove", "path": "/status"}
]
Loading