Skip to content

Commit

Permalink
Add API package for sharding including constants
Browse files Browse the repository at this point in the history
  • Loading branch information
timebertt committed Nov 1, 2023
1 parent 70df10d commit 5a803d5
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/apis/sharding/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Copyright 2023 Tim Ebert.
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.
*/

// +groupName=sharding.timebertt.dev

package sharding // import "github.com/timebertt/kubernetes-controller-sharding/pkg/apis/sharding"
37 changes: 37 additions & 0 deletions pkg/apis/sharding/v1alpha1/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
Copyright 2023 Tim Ebert.
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

// This file contains API-related constants for the sharding implementation, e.g. well-known annotations and labels.

const (
// alphaPrefix is a common prefix for all well-known annotations and labels.
// We use the kubernetes.io domain here for interoperability with other approaches evaluated in the thesis.
// If we want to make the approach implemented in this repository production-ready, this should eventually be changed
// to "alpha.sharding.timebertt.dev".
alphaPrefix = "sharding.alpha.kubernetes.io/"

// LabelRing is the label on Lease objects that identifies the ring that the shard belongs to.
LabelRing = alphaPrefix + "ring"
// LabelState is the label on Lease objects that reflects the state of a shard for observability purposes.
// This label is maintained by the shardlease controller.
LabelState = alphaPrefix + "state"

// IdentityShardLeaseController is the identity that the shardlease controller uses to acquire leases of unavailable
// shards.
IdentityShardLeaseController = "shardlease-controller"
)
19 changes: 19 additions & 0 deletions pkg/apis/sharding/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Copyright 2023 Tim Ebert.
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:defaulter-gen=TypeMeta

package v1alpha1 // import "github.com/timebertt/kubernetes-controller-sharding/pkg/apis/sharding/v1alpha1"
30 changes: 30 additions & 0 deletions pkg/apis/sharding/v1alpha1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright 2023 Tim Ebert.
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 contains API Schema definitions for the sharding v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=sharding.timebertt.dev
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
)

// GroupName is the group name used in this package.
const GroupName = "sharding.timebertt.dev"

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

0 comments on commit 5a803d5

Please sign in to comment.