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

Commit 262c593

Browse files
xyhuangk8s-ci-robot
authored andcommitted
Change API group/version to kubeflow.org/v1alpha1 and version operator 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
1 parent 8b84c91 commit 262c593

File tree

41 files changed

+1080
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1080
-431
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM golang:1.8 AS build
2-
COPY kubebench-operator /app/kubebench-operator
3-
ENTRYPOINT /app/kubebench-operator
2+
COPY kubebench-operator-v1alpha1 /app/kubebench-operator-v1alpha1
3+
ENTRYPOINT /app/kubebench-operator-v1alpha1

build/images/kubebench-operator/build_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ echo "Change working directory to ${BUILD_DIR}"
3030
cd ${BUILD_DIR}
3131

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

3535
echo "Authenticate gcloud account"
3636
gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS}

controller/cmd/kubebench-operator/main.go renamed to controller/cmd/operator/kubebench-operator-v1alpha1/main.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import (
66
"syscall"
77

88
kubeclient "github.com/kubeflow/kubebench/controller/pkg/client"
9-
controllers "github.com/kubeflow/kubebench/controller/pkg/controller"
9+
controllerv1alpha1 "github.com/kubeflow/kubebench/controller/pkg/controller/kubebenchjob/v1alpha1"
1010
log "github.com/sirupsen/logrus"
1111

12-
// "github.com/kubeflow/kubebench/controller/pkg/handler"
1312
"github.com/kubeflow/kubebench/controller/pkg/util"
1413
)
1514

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

2322
argoClient := kubeclient.GetArgoClient()
2423

25-
controller := controllers.KubebenchJobController{
24+
controller := controllerv1alpha1.KubebenchJobController{
2625
Logger: log.NewEntry(log.New()),
2726
Clientset: client,
2827
Informer: teaminformer,
2928
Queue: queue,
30-
// Handler: handler.KubebenchJobHandler{},
3129

3230
//pass correct namespace here
3331
Workflows: argoClient.Workflows("default"),

controller/hack/update-codegen.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

controller/pkg/apis/kubebenchjob/register.go

Lines changed: 0 additions & 3 deletions
This file was deleted.

controller/pkg/apis/kubebenchjob/v1/doc.go

Lines changed: 0 additions & 4 deletions
This file was deleted.

controller/pkg/apis/kubebenchjob/v1/register.go

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2019 The Kubeflow Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// +k8s:deepcopy-gen=package,register
16+
// +k8s:defaulter-gen=TypeMeta
17+
// +k8s:openapi-gen=true
18+
19+
// Package v1alpha1 is the v1alpha1 version of the API.
20+
// +groupName=kubeflow.org
21+
package v1alpha1
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2019 The Kubeflow Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package v1alpha1
16+
17+
import (
18+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19+
"k8s.io/apimachinery/pkg/runtime"
20+
"k8s.io/apimachinery/pkg/runtime/schema"
21+
)
22+
23+
const (
24+
// GroupName is the group name use in this package.
25+
GroupName = "kubeflow.org"
26+
// GroupVersion is the version.
27+
GroupVersion = "v1alpha1"
28+
)
29+
30+
// SchemeGroupVersion is group version used to register these objects
31+
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion}
32+
33+
// Resource takes an unqualified resource and returns a Group qualified GroupResource
34+
func Resource(resource string) schema.GroupResource {
35+
return SchemeGroupVersion.WithResource(resource).GroupResource()
36+
}
37+
38+
var (
39+
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
40+
SchemeBuilder runtime.SchemeBuilder
41+
localSchemeBuilder = &SchemeBuilder
42+
AddToScheme = localSchemeBuilder.AddToScheme
43+
)
44+
45+
func init() {
46+
// We only register manually written functions here. The registration of the
47+
// generated functions takes place in the generated files. The separation
48+
// makes the code compile even when the generated files are missing.
49+
localSchemeBuilder.Register(addKnownTypes)
50+
}
51+
52+
// Adds the list of known types to api.Scheme.
53+
func addKnownTypes(scheme *runtime.Scheme) error {
54+
scheme.AddKnownTypes(SchemeGroupVersion,
55+
&KubebenchJob{},
56+
&KubebenchJobList{},
57+
)
58+
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
59+
return nil
60+
}

controller/pkg/apis/kubebenchjob/v1/types.go renamed to controller/pkg/apis/kubebenchjob/v1alpha1/types.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
package v1
1+
// Copyright 2019 The Kubeflow Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package v1alpha1
216

317
import (
418
apiv1 "k8s.io/api/core/v1"
@@ -7,10 +21,9 @@ import (
721

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

11-
// KubebenchJob
12-
// +k8s:openapi-gen=true
13-
// +kubebuilder:resource:path=kubebenchjobs
26+
// KubebenchJob is the configuration of a Kubebench job
1427
type KubebenchJob struct {
1528
metav1.TypeMeta `json:",inline"`
1629
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -20,7 +33,6 @@ type KubebenchJob struct {
2033
}
2134

2235
// KubebenchJobSpec defines the desired state of KubebenchJob
23-
2436
type KubebenchJobSpec struct {
2537
ServiceAccount string `json:"serviceAccount,omitempty"`
2638
Volumes VolumeSpecs `json:"volumeSpecs"`

0 commit comments

Comments
 (0)