Skip to content

Commit

Permalink
apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalSkolasinski committed Feb 24, 2021
1 parent 4a1f0ad commit aa49607
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 36 deletions.
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,6 +4,20 @@
{{- $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 @@ -170,19 +184,5 @@ 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 }}
3 changes: 0 additions & 3 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ install-cert-manager:

manifests_all: manifests manifests_v1

install_all: install install_v1


# Install CRDs into a cluster
install: manifests
kustomize build config/crd | kubectl apply -f -
Expand Down
16 changes: 4 additions & 12 deletions operator/controllers/seldondeployment_prepackaged_servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ func extractEnvSecretRefName(pu *machinelearningv1.PredictiveUnit) string {
return envSecretRefName
}

func extractStorageInitializerImage(pu *machinelearningv1.PredictiveUnit) string {
return pu.StorageInitializerImage
}

func createTensorflowServingContainer(mlDepSepc *machinelearningv1.SeldonDeploymentSpec, pu *machinelearningv1.PredictiveUnit, tensorflowProtocol bool) *v1.Container {
ServerConfig := machinelearningv1.GetPrepackServerConfig(string(*pu.Implementation))

Expand Down Expand Up @@ -133,10 +129,9 @@ func (pi *PrePackedInitialiser) addTFServerContainer(mlDepSpec *machinelearningv
}

envSecretRefName := extractEnvSecretRefName(pu)
storageInitializerImage := extractStorageInitializerImage(pu)

mi := NewModelInitializer(pi.ctx, pi.clientset)
_, err := mi.InjectModelInitializer(deploy, tfServingContainer.Name, pu.ModelURI, pu.ServiceAccountName, envSecretRefName, storageInitializerImage)
_, err := mi.InjectModelInitializer(deploy, tfServingContainer.Name, pu.ModelURI, pu.ServiceAccountName, envSecretRefName, pu.StorageInitializerImage)
if err != nil {
return err
}
Expand Down Expand Up @@ -234,9 +229,8 @@ func (pi *PrePackedInitialiser) addTritonServer(mlDepSpec *machinelearningv1.Sel
}

envSecretRefName := extractEnvSecretRefName(pu)
storageInitializerImage := extractStorageInitializerImage(pu)
mi := NewModelInitializer(pi.ctx, pi.clientset)
_, err := mi.InjectModelInitializer(deploy, c.Name, pu.ModelURI, pu.ServiceAccountName, envSecretRefName, storageInitializerImage)
_, err := mi.InjectModelInitializer(deploy, c.Name, pu.ModelURI, pu.ServiceAccountName, envSecretRefName, pu.StorageInitializerImage)
if err != nil {
return err
}
Expand All @@ -262,10 +256,9 @@ func (pi *PrePackedInitialiser) addMLServerDefault(pu *machinelearningv1.Predict
}

envSecretRefName := extractEnvSecretRefName(pu)
storageInitializerImage := extractStorageInitializerImage(pu)
mi := NewModelInitializer(pi.ctx, pi.clientset)

_, err = mi.InjectModelInitializer(deploy, c.Name, pu.ModelURI, pu.ServiceAccountName, envSecretRefName, storageInitializerImage)
_, err = mi.InjectModelInitializer(deploy, c.Name, pu.ModelURI, pu.ServiceAccountName, envSecretRefName, pu.StorageInitializerImage)
if err != nil {
return err
}
Expand Down Expand Up @@ -330,10 +323,9 @@ func (pi *PrePackedInitialiser) addModelDefaultServers(mlDepSepc *machinelearnin
}

envSecretRefName := extractEnvSecretRefName(pu)
storageInitializerImage := extractStorageInitializerImage(pu)

mi := NewModelInitializer(pi.ctx, pi.clientset)
_, err = mi.InjectModelInitializer(deploy, c.Name, pu.ModelURI, pu.ServiceAccountName, envSecretRefName, storageInitializerImage)
_, err = mi.InjectModelInitializer(deploy, c.Name, pu.ModelURI, pu.ServiceAccountName, envSecretRefName, pu.StorageInitializerImage)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions operator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.14.1 h1:jMU0WaQrP0a/YAEq8eJmJKjBoMs+pClEr1vDMlM/Do4=
github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.15.0 h1:1V1NfVQR87RtWAgp1lv9JZJ5Jap+XFGKPi00andXGi4=
github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: seldon-system/seldon-serving-cert
controller-gen.kubebuilder.io/version: v0.2.9
controller-gen.kubebuilder.io/version: v0.4.1
labels:
app: seldon
app.kubernetes.io/instance: seldon1
Expand Down Expand Up @@ -4520,9 +4520,3 @@ spec:
- name: v1alpha3
served: true
storage: false
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

0 comments on commit aa49607

Please sign in to comment.