Skip to content

Commit

Permalink
Rename to PetSet
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Feb 3, 2024
1 parent 5ad8bc3 commit 5f10296
Show file tree
Hide file tree
Showing 76 changed files with 1,960 additions and 1,961 deletions.
6 changes: 3 additions & 3 deletions .config/api-rules/violation_exceptions.list
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
API rule violation: list_type_missing,k8s.io/api/apps/v1,DaemonSetStatus,Conditions
API rule violation: list_type_missing,k8s.io/api/apps/v1,DeploymentStatus,Conditions
API rule violation: list_type_missing,k8s.io/api/apps/v1,ReplicaSetStatus,Conditions
API rule violation: list_type_missing,k8s.io/api/apps/v1,StatefulSetSpec,VolumeClaimTemplates
API rule violation: list_type_missing,k8s.io/api/apps/v1,PetSetSpec,VolumeClaimTemplates
API rule violation: list_type_missing,k8s.io/api/apps/v1,StatefulSetStatus,Conditions
API rule violation: list_type_missing,k8s.io/api/core/v1,AvoidPods,PreferAvoidPods
API rule violation: list_type_missing,k8s.io/api/core/v1,Capabilities,Add
Expand Down Expand Up @@ -152,8 +152,8 @@ API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,X509Subject,
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,X509Subject,PostalCodes
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,X509Subject,Provinces
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,X509Subject,StreetAddresses
API rule violation: list_type_missing,kubeops.dev/statefulset/apis/apps/v1,ObjectMeta,Finalizers
API rule violation: list_type_missing,kubeops.dev/statefulset/apis/apps/v1,ObjectMeta,OwnerReferences
API rule violation: list_type_missing,kubeops.dev/petset/apis/apps/v1,ObjectMeta,Finalizers
API rule violation: list_type_missing,kubeops.dev/petset/apis/apps/v1,ObjectMeta,OwnerReferences
API rule violation: names_match,k8s.io/api/core/v1,AzureDiskVolumeSource,DataDiskURI
API rule violation: names_match,k8s.io/api/core/v1,ContainerStatus,LastTerminationState
API rule violation: names_match,k8s.io/api/core/v1,DaemonEndpoint,Port
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dbg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FROM ghcr.io/appscode/dlv:1.21.2

FROM {ARG_FROM}

LABEL org.opencontainers.image.source https://github.com/kubeops/statefulset
LABEL org.opencontainers.image.source https://github.com/kubeops/petset

RUN set -x \
&& apt-get update \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FROM {ARG_FROM}

LABEL org.opencontainers.image.source https://github.com/kubeops/statefulset
LABEL org.opencontainers.image.source https://github.com/kubeops/petset

RUN set -x \
&& apk add --update --upgrade --no-cache pcre2 ca-certificates tzdata \
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
SHELL=/bin/bash -o pipefail

PRODUCT_OWNER_NAME := appscode
PRODUCT_NAME := statefulset
PRODUCT_NAME := petset
ENFORCE_LICENSE ?=

GO_PKG := kubeops.dev
REPO := $(notdir $(shell pwd))
BIN := statefulset
BIN := petset
COMPRESS ?= no

# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
Expand Down Expand Up @@ -425,7 +425,7 @@ install:
@cd ../installer; \
kubectl create ns $(KUBE_NAMESPACE) || true; \
kubectl label ns $(KUBE_NAMESPACE) pod-security.kubernetes.io/enforce=restricted; \
helm upgrade -i statefulset charts/statefulset --wait --debug --force \
helm upgrade -i petset charts/petset --wait --debug --force \
--namespace=$(KUBE_NAMESPACE) --create-namespace \
--set registryFQDN="" \
--set operator.registry=$(REGISTRY) \
Expand All @@ -439,7 +439,7 @@ install:
.PHONY: uninstall
uninstall:
@cd ../installer; \
helm uninstall statefulset --namespace=$(KUBE_NAMESPACE) || true
helm uninstall petset --namespace=$(KUBE_NAMESPACE) || true

.PHONY: purge
purge: uninstall
Expand Down Expand Up @@ -524,7 +524,7 @@ clean:

.PHONY: run
run:
go run -mod=vendor ./cmd/statefulset run \
go run -mod=vendor ./cmd/petset run \
--v=3 \
--secure-port=8443 \
--kubeconfig=$(KUBECONFIG) \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# statefulset
# petset
4 changes: 2 additions & 2 deletions apis/apps/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package fuzzer

import (
v1 "kubeops.dev/statefulset/apis/apps/v1"
v1 "kubeops.dev/petset/apis/apps/v1"

fuzz "github.com/google/gofuzz"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
Expand All @@ -27,7 +27,7 @@ import (
var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
return []interface{}{
// v1
func(s *v1.StatefulSet, c fuzz.Continue) {
func(s *v1.PetSet, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
}
Expand Down
2 changes: 1 addition & 1 deletion apis/apps/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package install

import (
v1 "kubeops.dev/statefulset/apis/apps/v1"
v1 "kubeops.dev/petset/apis/apps/v1"

"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
Expand Down
2 changes: 1 addition & 1 deletion apis/apps/install/roundtrip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package install
import (
"testing"

identityfuzzer "kubeops.dev/statefulset/apis/apps/fuzzer"
identityfuzzer "kubeops.dev/petset/apis/apps/fuzzer"

"k8s.io/apimachinery/pkg/api/apitesting/roundtrip"
)
Expand Down
2 changes: 1 addition & 1 deletion apis/apps/v1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +k8s:defaulter-gen=TypeMeta
// +groupName=apps.k8s.appscode.com
package v1 // import "kubeops.dev/statefulset/apis/apps/v1"
package v1 // import "kubeops.dev/petset/apis/apps/v1"
50 changes: 25 additions & 25 deletions apis/apps/v1/statefulset_types.go → apis/apps/v1/petset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ import (
// +kubebuilder:subresource:status
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas

// StatefulSet represents a set of pods with consistent identities.
// PetSet represents a set of pods with consistent identities.
// Identities are defined as:
// - Network: A single stable DNS and hostname.
// - Storage: As many VolumeClaims as requested.
//
// The StatefulSet guarantees that a given network identity will always
// The PetSet guarantees that a given network identity will always
// map to the same storage identity.
type StatefulSet struct {
type PetSet struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
Expand All @@ -46,16 +46,16 @@ type StatefulSet struct {

// Spec defines the desired identities of pods in this set.
// +optional
Spec StatefulSetSpec `json:"spec,omitempty"`
Spec PetSetSpec `json:"spec,omitempty"`

// Status is the current status of Pods in this StatefulSet. This data
// Status is the current status of Pods in this PetSet. This data
// may be out of date by some window of time.
// +optional
Status apps.StatefulSetStatus `json:"status,omitempty"`
}

// A StatefulSetSpec is the specification of a StatefulSet.
type StatefulSetSpec struct {
// A PetSetSpec is the specification of a PetSet.
type PetSetSpec struct {
// replicas is the desired number of replicas of the given Template.
// These are replicas in the sense that they are instantiations of the
// same Template, but individual replicas also have a consistent identity.
Expand All @@ -70,16 +70,16 @@ type StatefulSetSpec struct {
Selector *metav1.LabelSelector `json:"selector"`

// template is the object that describes the pod that will be created if
// insufficient replicas are detected. Each pod stamped out by the StatefulSet
// insufficient replicas are detected. Each pod stamped out by the PetSet
// will fulfill this Template, but have a unique identity from the rest
// of the StatefulSet. Each pod will be named with the format
// <statefulsetname>-<podindex>. For example, a pod in a StatefulSet named
// of the PetSet. Each pod will be named with the format
// <petsetname>-<podindex>. For example, a pod in a PetSet named
// "web" with index number "3" would be named "web-3".
// The only allowed template.spec.restartPolicy value is "Always".
Template PodTemplateSpec `json:"template"`

// volumeClaimTemplates is a list of claims that pods are allowed to reference.
// The StatefulSet controller is responsible for mapping network identities to
// The PetSet controller is responsible for mapping network identities to
// claims in a way that maintains the identity of a pod. Every claim in
// this list must have at least one matching (by name) volumeMount in one
// container in the template. A claim in this list takes precedence over
Expand All @@ -89,11 +89,11 @@ type StatefulSetSpec struct {
// +listType=atomic
VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`

// serviceName is the name of the service that governs this StatefulSet.
// This service must exist before the StatefulSet, and is responsible for
// serviceName is the name of the service that governs this PetSet.
// This service must exist before the PetSet, and is responsible for
// the network identity of the set. Pods get DNS/hostnames that follow the
// pattern: pod-specific-string.serviceName.default.svc.cluster.local
// where "pod-specific-string" is managed by the StatefulSet controller.
// where "pod-specific-string" is managed by the PetSet controller.
ServiceName string `json:"serviceName"`

// podManagementPolicy controls how pods are created during initial scale up,
Expand All @@ -107,15 +107,15 @@ type StatefulSetSpec struct {
// +optional
PodManagementPolicy apps.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`

// updateStrategy indicates the StatefulSetUpdateStrategy that will be
// employed to update Pods in the StatefulSet when a revision is made to
// updateStrategy indicates the PetSetUpdateStrategy that will be
// employed to update Pods in the PetSet when a revision is made to
// Template.
UpdateStrategy apps.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`

// revisionHistoryLimit is the maximum number of revisions that will
// be maintained in the StatefulSet's revision history. The revision history
// be maintained in the PetSet's revision history. The revision history
// consists of all revisions not represented by a currently applied
// StatefulSetSpec version. The default value is 10.
// PetSetSpec version. The default value is 10.
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`

// Minimum number of seconds for which a newly created pod should be ready
Expand All @@ -129,14 +129,14 @@ type StatefulSetSpec struct {
// volume claims are created as needed and retained until manually deleted. This
// policy allows the lifecycle to be altered, for example by deleting persistent
// volume claims when their stateful set is deleted, or when their pod is scaled
// down. This requires the StatefulSetAutoDeletePVC feature gate to be enabled,
// down. This requires the PetSetAutoDeletePVC feature gate to be enabled,
// which is alpha. +optional
PersistentVolumeClaimRetentionPolicy *apps.StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty"`

// ordinals controls the numbering of replica indices in a StatefulSet. The
// ordinals controls the numbering of replica indices in a PetSet. The
// default ordinals behavior assigns a "0" index to the first replica and
// increments the index by one for each additional replica requested. Using
// the ordinals field requires the StatefulSetStartOrdinal feature gate to be
// the ordinals field requires the PetSetStartOrdinal feature gate to be
// enabled, which is beta.
// +optional
Ordinals *apps.StatefulSetOrdinals `json:"ordinals,omitempty"`
Expand All @@ -160,18 +160,18 @@ type PodTemplateSpec struct {

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// StatefulSetList is a collection of StatefulSets.
type StatefulSetList struct {
// PetSetList is a collection of PetSets.
type PetSetList struct {
metav1.TypeMeta `json:",inline"`
// Standard list's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ListMeta `json:"metadata,omitempty"`

// Items is the list of stateful sets.
Items []StatefulSet `json:"items"`
Items []PetSet `json:"items"`
}

func init() {
SchemeBuilder.Register(&StatefulSet{}, &StatefulSetList{})
SchemeBuilder.Register(&PetSet{}, &PetSetList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package v1

import (
"kubeops.dev/statefulset/pkg/features"
"kubeops.dev/petset/pkg/features"

appsv1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -31,23 +31,23 @@ import (
)

// log is for logging in this package.
var statefulsetlog = logf.Log.WithName("statefulset-resource")
var petsetlog = logf.Log.WithName("petset-resource")

// SetupWebhookWithManager will setup the manager to manage the webhooks
func (r *StatefulSet) SetupWebhookWithManager(mgr ctrl.Manager) error {
func (r *PetSet) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(r).
Complete()
}

// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

//+kubebuilder:webhook:path=/mutate-apps-k8s-appscode-com-v1-statefulset,mutating=true,failurePolicy=fail,sideEffects=None,groups=apps.k8s.appscode.com,resources=statefulsets,verbs=create;update,versions=v1,name=mstatefulset.kb.io,admissionReviewVersions=v1
//+kubebuilder:webhook:path=/mutate-apps-k8s-appscode-com-v1-petset,mutating=true,failurePolicy=fail,sideEffects=None,groups=apps.k8s.appscode.com,resources=petsets,verbs=create;update,versions=v1,name=mpetset.kb.io,admissionReviewVersions=v1

var _ webhook.Defaulter = &StatefulSet{}
var _ webhook.Defaulter = &PetSet{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
func (obj *StatefulSet) Default() {
func (obj *PetSet) Default() {
if len(obj.Spec.PodManagementPolicy) == 0 {
obj.Spec.PodManagementPolicy = appsv1.OrderedReadyPodManagement
}
Expand All @@ -67,14 +67,14 @@ func (obj *StatefulSet) Default() {
if obj.Spec.UpdateStrategy.RollingUpdate.Partition == nil {
obj.Spec.UpdateStrategy.RollingUpdate.Partition = ptr.To[int32](0)
}
if utilfeature.DefaultFeatureGate.Enabled(features.MaxUnavailableStatefulSet) {
if utilfeature.DefaultFeatureGate.Enabled(features.MaxUnavailablePetSet) {
if obj.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable == nil {
obj.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable = ptr.To(intstr.FromInt32(1))
}
}
}

if utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetAutoDeletePVC) {
if utilfeature.DefaultFeatureGate.Enabled(features.PetSetAutoDeletePVC) {
if obj.Spec.PersistentVolumeClaimRetentionPolicy == nil {
obj.Spec.PersistentVolumeClaimRetentionPolicy = &appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy{}
}
Expand All @@ -97,29 +97,29 @@ func (obj *StatefulSet) Default() {
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-apps-k8s-appscode-com-v1-statefulset,mutating=false,failurePolicy=fail,sideEffects=None,groups=apps.k8s.appscode.com,resources=statefulsets,verbs=create;update,versions=v1,name=vstatefulset.kb.io,admissionReviewVersions=v1
//+kubebuilder:webhook:path=/validate-apps-k8s-appscode-com-v1-petset,mutating=false,failurePolicy=fail,sideEffects=None,groups=apps.k8s.appscode.com,resources=petsets,verbs=create;update,versions=v1,name=vpetset.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &StatefulSet{}
var _ webhook.Validator = &PetSet{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *StatefulSet) ValidateCreate() (admission.Warnings, error) {
statefulsetlog.Info("validate create", "name", r.Name)
func (r *PetSet) ValidateCreate() (admission.Warnings, error) {
petsetlog.Info("validate create", "name", r.Name)

// TODO(user): fill in your validation logic upon object creation.
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *StatefulSet) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
statefulsetlog.Info("validate update", "name", r.Name)
func (r *PetSet) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
petsetlog.Info("validate update", "name", r.Name)

// TODO(user): fill in your validation logic upon object update.
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *StatefulSet) ValidateDelete() (admission.Warnings, error) {
statefulsetlog.Info("validate delete", "name", r.Name)
func (r *PetSet) ValidateDelete() (admission.Warnings, error) {
petsetlog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
return nil, nil
Expand Down
Loading

0 comments on commit 5f10296

Please sign in to comment.