-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use kubernetes/code-generator (#215)
* Use kubernetes/code-generator * Use v1apha1 instead of internal version * Move api helpers to v1alpha1
- Loading branch information
Showing
567 changed files
with
302,428 additions
and
3,481 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// package monitoring is the internal version of the API. | ||
|
||
// +k8s:deepcopy-gen=package,register | ||
// +groupName=monitoring.appscode.com | ||
package monitoring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package install | ||
|
||
import ( | ||
tapi "github.com/appscode/searchlight/apis/monitoring" | ||
"github.com/appscode/searchlight/apis/monitoring/v1alpha1" | ||
"k8s.io/apimachinery/pkg/apimachinery/announced" | ||
"k8s.io/apimachinery/pkg/apimachinery/registered" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
) | ||
|
||
// Install registers the API group and adds types to a scheme | ||
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) { | ||
if err := announced.NewGroupMetaFactory( | ||
&announced.GroupMetaFactoryArgs{ | ||
GroupName: tapi.GroupName, | ||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version}, | ||
ImportPrefix: "gitub.com/appscode/searchlight/apis/monitoring", | ||
RootScopedKinds: sets.NewString("CustomResourceDefinition"), | ||
AddInternalObjectsToScheme: tapi.AddToScheme, | ||
}, | ||
announced.VersionToSchemeFunc{ | ||
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme, | ||
}, | ||
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package api | ||
package v1alpha1 | ||
|
||
import "time" | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
api/cluster_alert.go → apis/monitoring/v1alpha1/cluster_alert.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package api | ||
package v1alpha1 | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Package v1alpha1 is the v1alpha1 version of the API. | ||
|
||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:conversion-gen=github.com/appscode/searchlight/apis/monitoring | ||
// +k8s:openapi-gen=true | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +groupName=monitoring.appscode.com | ||
package v1alpha1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package api | ||
package v1alpha1 | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package api | ||
package v1alpha1 | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package api | ||
package v1alpha1 | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"github.com/appscode/searchlight/apis/monitoring" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
var SchemeGroupVersion = schema.GroupVersion{Group: monitoring.GroupName, Version: "v1alpha1"} | ||
|
||
var ( | ||
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. | ||
// 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) | ||
} | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} | ||
|
||
// Adds the list of known types to api.Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&ClusterAlert{}, | ||
&ClusterAlertList{}, | ||
&NodeAlert{}, | ||
&NodeAlertList{}, | ||
&PodAlert{}, | ||
&PodAlertList{}, | ||
) | ||
|
||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&metav1.Status{}, | ||
) | ||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
Oops, something went wrong.