Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Change API group/version to kubeflow.org/v1alpha1 and version operato…
Browse files Browse the repository at this point in the history
…r correspondingly (#176)

- Change API group to "kubeflow.org" and API version to "v1alpha1"
- Move operator to "v1alpha1" versioned directories
- Update image building to adapt to the changes
- Improve update-codegen script and add verify-codegen script
  • Loading branch information
xyhuang authored and k8s-ci-robot committed Mar 5, 2019
1 parent 8b84c91 commit 262c593
Show file tree
Hide file tree
Showing 41 changed files with 1,080 additions and 431 deletions.
4 changes: 2 additions & 2 deletions build/images/kubebench-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM golang:1.8 AS build
COPY kubebench-operator /app/kubebench-operator
ENTRYPOINT /app/kubebench-operator
COPY kubebench-operator-v1alpha1 /app/kubebench-operator-v1alpha1
ENTRYPOINT /app/kubebench-operator-v1alpha1
2 changes: 1 addition & 1 deletion build/images/kubebench-operator/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ echo "Change working directory to ${BUILD_DIR}"
cd ${BUILD_DIR}

echo "Build go binaries"
GOOS=linux CGO_ENABLED=0 go build github.com/kubeflow/kubebench/controller/cmd/kubebench-operator
GOOS=linux CGO_ENABLED=0 go build github.com/kubeflow/kubebench/controller/cmd/operator/kubebench-operator-v1alpha1

echo "Authenticate gcloud account"
gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import (
"syscall"

kubeclient "github.com/kubeflow/kubebench/controller/pkg/client"
controllers "github.com/kubeflow/kubebench/controller/pkg/controller"
controllerv1alpha1 "github.com/kubeflow/kubebench/controller/pkg/controller/kubebenchjob/v1alpha1"
log "github.com/sirupsen/logrus"

// "github.com/kubeflow/kubebench/controller/pkg/handler"
"github.com/kubeflow/kubebench/controller/pkg/util"
)

Expand All @@ -22,12 +21,11 @@ func main() {

argoClient := kubeclient.GetArgoClient()

controller := controllers.KubebenchJobController{
controller := controllerv1alpha1.KubebenchJobController{
Logger: log.NewEntry(log.New()),
Clientset: client,
Informer: teaminformer,
Queue: queue,
// Handler: handler.KubebenchJobHandler{},

//pass correct namespace here
Workflows: argoClient.Workflows("default"),
Expand Down
12 changes: 0 additions & 12 deletions controller/hack/update-codegen.sh

This file was deleted.

3 changes: 0 additions & 3 deletions controller/pkg/apis/kubebenchjob/register.go

This file was deleted.

4 changes: 0 additions & 4 deletions controller/pkg/apis/kubebenchjob/v1/doc.go

This file was deleted.

40 changes: 0 additions & 40 deletions controller/pkg/apis/kubebenchjob/v1/register.go

This file was deleted.

21 changes: 21 additions & 0 deletions controller/pkg/apis/kubebenchjob/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2019 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// +k8s:deepcopy-gen=package,register
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true

// Package v1alpha1 is the v1alpha1 version of the API.
// +groupName=kubeflow.org
package v1alpha1
60 changes: 60 additions & 0 deletions controller/pkg/apis/kubebenchjob/v1alpha1/resgiter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2019 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

const (
// GroupName is the group name use in this package.
GroupName = "kubeflow.org"
// GroupVersion is the version.
GroupVersion = "v1alpha1"
)

// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

var (
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
SchemeBuilder runtime.SchemeBuilder
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
)

func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addKnownTypes)
}

// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&KubebenchJob{},
&KubebenchJobList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package v1
// Copyright 2019 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1

import (
apiv1 "k8s.io/api/core/v1"
Expand All @@ -7,10 +21,9 @@ import (

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +resource:path=kubebenchjob

// KubebenchJob
// +k8s:openapi-gen=true
// +kubebuilder:resource:path=kubebenchjobs
// KubebenchJob is the configuration of a Kubebench job
type KubebenchJob struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -20,7 +33,6 @@ type KubebenchJob struct {
}

// KubebenchJobSpec defines the desired state of KubebenchJob

type KubebenchJobSpec struct {
ServiceAccount string `json:"serviceAccount,omitempty"`
Volumes VolumeSpecs `json:"volumeSpecs"`
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 28 additions & 30 deletions controller/pkg/client/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 262c593

Please sign in to comment.