Skip to content

Commit

Permalink
feat(crd): upgrade crd (#221)
Browse files Browse the repository at this point in the history
* feat(crd): upgrade crd

* fix(helm): fix helm charts

* fix(version): release v0.3.0-alpha.1

* chore(*): fix e2e k8s version
  • Loading branch information
simon-cj authored Dec 24, 2020
1 parent 61c0a64 commit a5f213c
Show file tree
Hide file tree
Showing 10 changed files with 2,491 additions and 1,198 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
# v1.18.2 does not work when installing seldon core because of
# https://github.com/kubernetes-sigs/controller-tools/issues/444
k8s_version: [v1.17.5, v1.16.9]
k8s_version: [v1.19.3]
steps:
- name: checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,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.3.0 ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
Expand Down
17 changes: 9 additions & 8 deletions cmd/modeljob-operator/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import (
"context"
"io"
"io/ioutil"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"os"
"path/filepath"

apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -53,7 +54,7 @@ const (
// CustomResourceDefinitionKind is the kind of resource customresourcedefinition.
CustomResourceDefinitionKind = "CustomResourceDefinition"
// CustomResourceDefinitionPath is the path of crd yaml.
CustomResourceDefinitionPath = "crds"
CustomResourceDefinitionPath = "/crds"
)

func init() {
Expand Down Expand Up @@ -112,7 +113,7 @@ func Run(opt *options.ServerOption) error {
return nil
}

func renderCRDs(crdpath string) ([]*apiextensionsv1beta1.CustomResourceDefinition, error) {
func renderCRDs(crdpath string) ([]*apiextensionsv1.CustomResourceDefinition, error) {
var (
info os.FileInfo
files []os.FileInfo
Expand All @@ -137,8 +138,8 @@ func renderCRDs(crdpath string) ([]*apiextensionsv1beta1.CustomResourceDefinitio
}

// readCRDs reads the CRDs from files and Unmarshals them into structs
func readCRDs(basePath string, files []os.FileInfo) ([]*apiextensionsv1beta1.CustomResourceDefinition, error) {
crds := make([]*apiextensionsv1beta1.CustomResourceDefinition, 0, len(files))
func readCRDs(basePath string, files []os.FileInfo) ([]*apiextensionsv1.CustomResourceDefinition, error) {
crds := make([]*apiextensionsv1.CustomResourceDefinition, 0, len(files))
crdExts := sets.NewString(".yaml", ".yml")
for _, file := range files {
// Only parse allowed file types
Expand All @@ -153,7 +154,7 @@ func readCRDs(basePath string, files []os.FileInfo) ([]*apiextensionsv1beta1.Cus
}

for _, doc := range docs {
crd := &apiextensionsv1beta1.CustomResourceDefinition{}
crd := &apiextensionsv1.CustomResourceDefinition{}
if err = yaml.Unmarshal(doc, crd); err != nil {
return nil, err
}
Expand Down Expand Up @@ -206,7 +207,7 @@ func ensureCRD(config *rest.Config) error {
return err
}
for _, crd := range crds {
_, err = client.ApiextensionsV1beta1().CustomResourceDefinitions().Create(context.TODO(), crd, metav1.CreateOptions{})
_, err = client.ApiextensionsV1().CustomResourceDefinitions().Create(context.TODO(), crd, metav1.CreateOptions{})
if err != nil {
if !errors.IsAlreadyExists(err) {
setupLog.Error(err, "unable to ensure crds")
Expand Down
2,319 changes: 1,168 additions & 1,151 deletions crds/kleveross.io_modeljobs.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions manifests/model-registry/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: v0.2.0
version: v0.3.0-alpha.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: v0.2.0
appVersion: v0.3.0-alpha.1
8 changes: 4 additions & 4 deletions manifests/model-registry/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ model:
serving:
trt:
image: ghcr.io/kleveross/tritonserver
tag: v0.2.0
tag: v0.3.0-alpha.1
pmml:
image: ghcr.io/kleveross/openscoring
tag: v0.2.0
tag: v0.3.0-alpha.1
mlserver:
image: ghcr.io/kleveross/mlserver
tag: v0.2.0
tag: v0.3.0-alpha.1
initializer:
image: ghcr.io/kleveross/klever-ormb-storage-initializer
tag: v0.0.7
tag: v0.0.8

#
# set Pod SchedulerName.
Expand Down
4 changes: 2 additions & 2 deletions manifests/modeljob-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: v0.2.0
version: v0.3.0-alpha.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: v0.2.0
appVersion: v0.3.0-alpha.1
Loading

0 comments on commit a5f213c

Please sign in to comment.