diff --git a/go.mod b/go.mod index 70938a280e..1aa7cd290f 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index dd1ad0351b..f57083df86 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/openapi_generated.go b/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/openapi_generated.go index 928162ea2e..d9ba867f3b 100644 --- a/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/openapi_generated.go +++ b/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/openapi_generated.go @@ -358,6 +358,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kmodules.xyz/client-go/api/v1.CAPIClusterInfo": schema_kmodulesxyz_client_go_api_v1_CAPIClusterInfo(ref), "kmodules.xyz/client-go/api/v1.CertificatePrivateKey": schema_kmodulesxyz_client_go_api_v1_CertificatePrivateKey(ref), "kmodules.xyz/client-go/api/v1.CertificateSpec": schema_kmodulesxyz_client_go_api_v1_CertificateSpec(ref), + "kmodules.xyz/client-go/api/v1.ClusterInfo": schema_kmodulesxyz_client_go_api_v1_ClusterInfo(ref), "kmodules.xyz/client-go/api/v1.ClusterMetadata": schema_kmodulesxyz_client_go_api_v1_ClusterMetadata(ref), "kmodules.xyz/client-go/api/v1.Condition": schema_kmodulesxyz_client_go_api_v1_Condition(ref), "kmodules.xyz/client-go/api/v1.HealthCheckSpec": schema_kmodulesxyz_client_go_api_v1_HealthCheckSpec(ref), @@ -18401,23 +18402,27 @@ func schema_kmodulesxyz_client_go_api_v1_CAPIClusterInfo(ref common.ReferenceCal Properties: map[string]spec.Schema{ "provider": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, "namespace": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, "clusterName": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, }, + Required: []string{"provider", "namespace", "clusterName"}, }, }, } @@ -18563,6 +18568,56 @@ func schema_kmodulesxyz_client_go_api_v1_CertificateSpec(ref common.ReferenceCal } } +func schema_kmodulesxyz_client_go_api_v1_ClusterInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterInfo used in ace-installer", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "clusterManagers": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "capi": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/client-go/api/v1.CAPIClusterInfo"), + }, + }, + }, + Required: []string{"uid", "name", "clusterManagers"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/client-go/api/v1.CAPIClusterInfo"}, + } +} + func schema_kmodulesxyz_client_go_api_v1_ClusterMetadata(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -19537,13 +19592,11 @@ func schema_sidekick_apis_apps_v1alpha1_LeaderStatus(ref common.ReferenceCallbac Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, - Required: []string{"name"}, }, }, } @@ -19720,12 +19773,19 @@ func schema_sidekick_apis_apps_v1alpha1_SidekickSpec(ref common.ReferenceCallbac }, "restartPolicy": { SchemaProps: spec.SchemaProps{ - 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\n\nPossible enum values:\n - `\"Always\"`\n - `\"Never\"`\n - `\"OnFailure\"`", + 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 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.\n\nPossible enum values:\n - `\"Always\"`\n - `\"Never\"`\n - `\"OnFailure\"`", Type: []string{"string"}, Format: "", Enum: []interface{}{"Always", "Never", "OnFailure"}, }, }, + "backoffLimit": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the number of retries before marking this job failed.", + Type: []string{"integer"}, + Format: "int32", + }, + }, "terminationGracePeriodSeconds": { SchemaProps: spec.SchemaProps{ Description: "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). If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.", @@ -20072,7 +20132,6 @@ func schema_sidekick_apis_apps_v1alpha1_SidekickStatus(ref common.ReferenceCallb "pod": { SchemaProps: spec.SchemaProps{ Description: "Possible enum values:\n - `\"Failed\"` means that all containers in the pod have terminated, and at least one container has terminated in a failure (exited with a non-zero exit code or was stopped by the system).\n - `\"Pending\"` means the pod has been accepted by the system, but one or more of the containers has not been started. This includes time before being bound to a node, as well as time spent pulling images onto the host.\n - `\"Running\"` means the pod has been bound to a node and all of the containers have been started. At least one container is still running or is in the process of being restarted.\n - `\"Succeeded\"` means that all containers in the pod have voluntarily terminated with a container exit code of 0, and the system is not going to restart any of these containers.\n - `\"Unknown\"` means that for some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod. Deprecated: It isn't being set since 2015 (74da3b14b0c0f658b3bb8d2def5094686d0e9095)", - Default: "", Type: []string{"string"}, Format: "", Enum: []interface{}{"Failed", "Pending", "Running", "Succeeded", "Unknown"}, @@ -20106,8 +20165,39 @@ func schema_sidekick_apis_apps_v1alpha1_SidekickStatus(ref common.ReferenceCallb }, }, }, + "containerRestartCountsPerPod": { + SchemaProps: spec.SchemaProps{ + Description: "ContainerRestartCountsPerPod stores the sum of all container restart counts of a pod", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + "failureCount": { + SchemaProps: spec.SchemaProps{ + Description: "FailuerCount tracks the total number of failed pods", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, }, - Required: []string{"leader", "pod"}, }, }, Dependencies: []string{ diff --git a/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/sidekick_types.go b/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/sidekick_types.go index 6889632b00..d090424d1e 100644 --- a/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/sidekick_types.go +++ b/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/sidekick_types.go @@ -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"` @@ -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). @@ -519,17 +538,17 @@ 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 @@ -537,6 +556,10 @@ type SidekickStatus struct { // 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 diff --git a/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/zz_generated.deepcopy.go b/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/zz_generated.deepcopy.go index 2cb902a63f..afb9b4e8b7 100644 --- a/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/kubeops.dev/sidekick/apis/apps/v1alpha1/zz_generated.deepcopy.go @@ -234,6 +234,11 @@ func (in *SidekickSpec) DeepCopyInto(out *SidekickSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.BackoffLimit != nil { + in, out := &in.BackoffLimit, &out.BackoffLimit + *out = new(int32) + **out = **in + } if in.TerminationGracePeriodSeconds != nil { in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds *out = new(int64) @@ -380,6 +385,20 @@ func (in *SidekickStatus) DeepCopyInto(out *SidekickStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.ContainerRestartCountsPerPod != nil { + in, out := &in.ContainerRestartCountsPerPod, &out.ContainerRestartCountsPerPod + *out = make(map[string]int32, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.FailureCount != nil { + in, out := &in.FailureCount, &out.FailureCount + *out = make(map[string]bool, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } return } diff --git a/vendor/kubeops.dev/sidekick/crds/apps.k8s.appscode.com_sidekicks.yaml b/vendor/kubeops.dev/sidekick/crds/apps.k8s.appscode.com_sidekicks.yaml index 2e9cf7e595..6af79c9e4f 100644 --- a/vendor/kubeops.dev/sidekick/crds/apps.k8s.appscode.com_sidekicks.yaml +++ b/vendor/kubeops.dev/sidekick/crds/apps.k8s.appscode.com_sidekicks.yaml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/vendor/modules.txt b/vendor/modules.txt index 6699e8d561..1a9ec22392 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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