mirror of
https://github.com/imjasonh/git-k8s
synced 2026-07-07 22:35:17 +00:00
The *.k8s.io group is protected in Kubernetes and requires an api-approved.kubernetes.io annotation. Switch to a custom domain to avoid the restriction entirely. https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
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 name of the API group.
|
|
GroupName = "git-k8s.imjasonh.com"
|
|
|
|
// Version is the version of the API group.
|
|
Version = "v1alpha1"
|
|
)
|
|
|
|
// SchemeGroupVersion is the group version used to register these objects.
|
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
|
|
|
|
// Kind takes an unqualified kind and returns a Group-qualified GroupKind.
|
|
func Kind(kind string) schema.GroupKind {
|
|
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
|
}
|
|
|
|
// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
|
|
func Resource(resource string) schema.GroupResource {
|
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
|
}
|
|
|
|
var (
|
|
// SchemeBuilder adds types to the scheme.
|
|
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
|
// AddToScheme applies the SchemeBuilder functions to a scheme.
|
|
AddToScheme = SchemeBuilder.AddToScheme
|
|
)
|
|
|
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
|
&GitRepository{},
|
|
&GitRepositoryList{},
|
|
&GitBranch{},
|
|
&GitBranchList{},
|
|
&GitPushTransaction{},
|
|
&GitPushTransactionList{},
|
|
&GitRepoSync{},
|
|
&GitRepoSyncList{},
|
|
)
|
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
|
return nil
|
|
}
|