Skip to content

Commit

Permalink
Update sidekick
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Nov 22, 2024
1 parent 1e6df97 commit 0748210
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 27 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ require (
kmodules.xyz/webhook-runtime v0.29.1
kubeops.dev/csi-driver-cacerts v0.1.0
kubeops.dev/petset v0.0.7
kubeops.dev/sidekick v0.0.8
kubeops.dev/sidekick v0.0.9
kubestash.dev/apimachinery v0.13.0
sigs.k8s.io/controller-runtime v0.18.4
sigs.k8s.io/yaml v1.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,8 @@ kubeops.dev/csi-driver-cacerts v0.1.0 h1:WDgKNo5QAiMoVy4c/4ARWeCXJbqdcXdcn8VLImV
kubeops.dev/csi-driver-cacerts v0.1.0/go.mod h1:5a/ZOn5LFw26PPBpTKvsivBjcvVArOrJX24C+k+przk=
kubeops.dev/petset v0.0.7 h1:F77BTRfUqRVO7kNc8q2oFSSviDmYBqni/osXqu0kgJ4=
kubeops.dev/petset v0.0.7/go.mod h1:lt0SZV4ohRy7RiwLNUnMoauG4lCbcRbSqhMg20rdUQg=
kubeops.dev/sidekick v0.0.8 h1:A9OEsy4qmc2sfR1DDHvkfF/LOl/oBUtqSpgBIjvzlRs=
kubeops.dev/sidekick v0.0.8/go.mod h1:p8CBMYxliVa/TpHW3ZNkqJurx0xqd6YCAQksgwAhj3g=
kubeops.dev/sidekick v0.0.9 h1:nd6hcctswmUammKW50x8S+KSSIBTmQIqJuTp+eyRT70=
kubeops.dev/sidekick v0.0.9/go.mod h1:SksBYafOpe8cHeHw9GahNmrkNGsPTxnSUHf7oTXLEVY=
kubestash.dev/apimachinery v0.13.0 h1:c1K5QzUR/x1Og56+oUufPq7cDX3QljPw9CQrEpVnPrI=
kubestash.dev/apimachinery v0.13.0/go.mod h1:OuO8kh4EcAerSpllIXM7JaPQfKDGsQoAm3jAt4m0a1E=
moul.io/http2curl/v2 v2.3.1-0.20221024080105-10c404f653f7 h1:NykkTlRB+X40z86cLHdEmuoTxhNKhQebLT379b1EumA=
Expand Down
116 changes: 103 additions & 13 deletions vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 27 additions & 4 deletions vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/sidekick_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ const (
PodSelectionPolicyLast LeaderSelectionPolicy = "Last"
)

// +kubebuilder:validation:Enum=Pending;Current;Failed;Succeeded
type SideKickPhase string

const (
SideKickPhaseCurrent SideKickPhase = "Current"
SideKickPhaseFailed SideKickPhase = "Failed"
SidekickPhaseSucceeded SideKickPhase = "Succeeded"
SideKickPhasePending SideKickPhase = "Pending"
)

type LeaderSpec struct {
Name string `json:"name,omitempty"`

Expand Down Expand Up @@ -100,8 +110,17 @@ type SidekickSpec struct {
// One of Always, OnFailure, Never.
// Default to Always.
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
// If your sidekick has restartPolicy = "OnFailure", keep in mind that your Pod running the Job will be
// terminated once the job backoff limit has been reached. This can make debugging the Job's executable
// more difficult. We suggest setting restartPolicy = "Never" when debugging the Job or using a logging
// system to ensure output from failed Jobs is not lost inadvertently.
// +kubebuilder:validation:Enum=Never;Always;OnFailure
// +optional
RestartPolicy core.RestartPolicy `json:"restartPolicy,omitempty"`
// Specifies the number of retries before marking this job failed.
// +optional
BackoffLimit *int32 `json:"backoffLimit,omitempty"`

// Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
// Value must be non-negative integer. The value zero indicates stop immediately via
// the kill signal (no opportunity to shut down).
Expand Down Expand Up @@ -519,24 +538,28 @@ type VolumeMount struct {
}

type LeaderStatus struct {
Name string `json:"name"`
Name string `json:"name,omitempty"`
}

// SidekickStatus defines the observed state of Sidekick
type SidekickStatus struct {
Leader LeaderStatus `json:"leader"`
Pod core.PodPhase `json:"pod"`
Leader LeaderStatus `json:"leader,omitempty"`
Pod core.PodPhase `json:"pod,omitempty"`

// Specifies the current phase of the sidekick CR
// +optional
Phase string `json:"phase,omitempty"`
Phase SideKickPhase `json:"phase,omitempty"`
// observedGeneration is the most recent generation observed for this resource. It corresponds to the
// resource's generation, which is updated on mutation by the API Server.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Conditions applied to the database, such as approval or denial.
// +optional
Conditions []kmapi.Condition `json:"conditions,omitempty"`
// ContainerRestartCountsPerPod stores the sum of all container restart counts of a pod
ContainerRestartCountsPerPod map[string]int32 `json:"containerRestartCountsPerPod,omitempty"`
// FailuerCount tracks the total number of failed pods
FailureCount map[string]bool `json:"failureCount,omitempty"`
}

// +genclient
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,11 @@ spec:
description: AutomountServiceAccountToken indicates whether a service
account token should be automatically mounted.
type: boolean
backoffLimit:
description: Specifies the number of retries before marking this job
failed.
format: int32
type: integer
containers:
description: List of containers belonging to the pod. Containers cannot
currently be added or removed. There must be at least one container
Expand Down Expand Up @@ -5399,7 +5404,17 @@ spec:
type: array
restartPolicy:
description: 'Restart policy for all containers within the pod. One
of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy'
of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
If your sidekick has restartPolicy = "OnFailure", keep in mind that
your Pod running the Job will be terminated once the job backoff
limit has been reached. This can make debugging the Job''s executable
more difficult. We suggest setting restartPolicy = "Never" when
debugging the Job or using a logging system to ensure output from
failed Jobs is not lost inadvertently.'
enum:
- Never
- Always
- OnFailure
type: string
runtimeClassName:
description: 'RuntimeClassName refers to a RuntimeClass object in
Expand Down Expand Up @@ -7659,12 +7674,22 @@ spec:
- type
type: object
type: array
containerRestartCountsPerPod:
additionalProperties:
format: int32
type: integer
description: ContainerRestartCountsPerPod stores the sum of all container
restart counts of a pod
type: object
failureCount:
additionalProperties:
type: boolean
description: FailuerCount tracks the total number of failed pods
type: object
leader:
properties:
name:
type: string
required:
- name
type: object
observedGeneration:
description: observedGeneration is the most recent generation observed
Expand All @@ -7674,14 +7699,16 @@ spec:
type: integer
phase:
description: Specifies the current phase of the sidekick CR
enum:
- Pending
- Current
- Failed
- Succeeded
type: string
pod:
description: PodPhase is a label for the condition of a pod at the
current time.
type: string
required:
- leader
- pod
type: object
type: object
served: true
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ kubeops.dev/petset/client/informers/externalversions/internalinterfaces
kubeops.dev/petset/client/listers/apps/v1
kubeops.dev/petset/crds
kubeops.dev/petset/pkg/features
# kubeops.dev/sidekick v0.0.8
# kubeops.dev/sidekick v0.0.9
## explicit; go 1.22.1
kubeops.dev/sidekick/apis/apps
kubeops.dev/sidekick/apis/apps/v1alpha1
Expand Down

0 comments on commit 0748210

Please sign in to comment.