kubernetes

package
v0.7.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func GetClientFromContext added in v0.6.0

func GetClientFromContext(c *gin.Context) (*Client, error)

GetClientFromContext gets a Kubernetes client from the Gin context If an OIDC token is present in the context, it uses that token for authentication Otherwise, it falls back to the default client (service account credentials)

func GetClientFromGoContext added in v0.6.0

func GetClientFromGoContext(ctx context.Context) (*Client, error)

GetClientFromGoContext is a helper for non-Gin contexts (e.g., background operations) It always uses the default client

func GetDefaultClient added in v0.6.0

func GetDefaultClient() (*Client, error)

GetDefaultClient returns the default Kubernetes client (using service account credentials) This is lazily initialized on first use

func NewClient

func NewClient() (*Client, error)

NewClient creates a Kubernetes client using service account credentials (in-cluster) or kubeconfig

func NewClientWithToken added in v0.6.0

func NewClientWithToken(token string) (*Client, error)

NewClientWithToken creates a Kubernetes client using the provided OIDC token If token is empty, falls back to service account credentials (in-cluster) or kubeconfig

func (*Client) AddBypassGatesAnnotation

func (c *Client) AddBypassGatesAnnotation(ctx context.Context, namespace, name string, version string) (*rolloutv1alpha1.Rollout, error)

AddBypassGatesAnnotation adds the rollout.kuberik.com/bypass-gates annotation to a rollout This allows the rollout to bypass gate checks for a specific version

func (*Client) AddForceDeployAnnotation added in v0.4.0

func (c *Client) AddForceDeployAnnotation(ctx context.Context, namespace, name string, version string, message string) (*rolloutv1alpha1.Rollout, error)

AddForceDeployAnnotation adds the rollout.kuberik.com/force-deploy annotation to a rollout This allows the rollout to force deploy a specific version Optionally includes a message explaining why the force deploy was triggered

func (*Client) AddUnblockFailedAnnotation

func (c *Client) AddUnblockFailedAnnotation(ctx context.Context, namespace, name string) (*rolloutv1alpha1.Rollout, error)

AddUnblockFailedAnnotation adds the rollout.kuberik.com/unblock-failed annotation to a rollout This allows the rollout to resume after a failed bake

func (*Client) ChangeVersion added in v0.5.0

func (c *Client) ChangeVersion(ctx context.Context, namespace, name string, version string, pin bool, message string) (*rolloutv1alpha1.Rollout, error)

ChangeVersion updates the rollout version with an option to pin or unpin atomically. When pin is true, it sets spec.wantedVersion to the version and optionally sets a deploy message. When pin is false, it adds the force-deploy annotation for the version and clears spec.wantedVersion in the same server-side apply operation, optionally setting a deploy message.

func (*Client) CheckPermission added in v0.6.0

func (c *Client) CheckPermission(ctx context.Context, apiGroup, resource, verb, namespace, name string) (bool, error)

CheckPermission checks if the current user has permission to perform an action using SelfSubjectAccessReview API Uses the stored REST config which includes the user's OIDC token

func (*Client) CheckRolloutPermission added in v0.6.0

func (c *Client) CheckRolloutPermission(ctx context.Context, verb, namespace, name string) (bool, error)

CheckRolloutPermission checks if the current user has permission to perform an action on a Rollout

func (*Client) ContinueKruiseRollout added in v0.4.0

func (c *Client) ContinueKruiseRollout(ctx context.Context, namespace, name string) (*kruiserolloutv1beta1.Rollout, error)

ContinueKruiseRollout updates the currentStepState of an OpenKruise rollout to continue the rollout

func (*Client) FormatUserInfo added in v0.6.0

func (c *Client) FormatUserInfo(ctx context.Context) (string, error)

FormatUserInfo formats user information for appending to deploy messages Returns empty string if user is a service account

func (*Client) GetAllPods added in v0.6.0

func (c *Client) GetAllPods(ctx context.Context, namespace string) (*corev1.PodList, error)

GetAllPods lists all pods in a namespace

func (*Client) GetAllRolloutTests added in v0.6.0

func (c *Client) GetAllRolloutTests(ctx context.Context, namespace string) (*openkruisev1alpha1.RolloutTestList, error)

GetAllRolloutTests fetches all RolloutTests in a namespace

func (*Client) GetClientset added in v0.6.0

func (c *Client) GetClientset() *kubernetes.Clientset

GetClientset returns the Kubernetes clientset for direct API access

func (*Client) GetClusterRolloutSchedule added in v0.7.0

func (c *Client) GetClusterRolloutSchedule(ctx context.Context, name string) (*rolloutv1alpha1.ClusterRolloutSchedule, error)

GetClusterRolloutSchedule gets a single ClusterRolloutSchedule

func (*Client) GetClusterRolloutSchedules added in v0.7.0

func (c *Client) GetClusterRolloutSchedules(ctx context.Context) (*rolloutv1alpha1.ClusterRolloutScheduleList, error)

GetClusterRolloutSchedules gets all ClusterRolloutSchedules

func (*Client) GetClusterRolloutSchedulesByRollout added in v0.7.0

func (c *Client) GetClusterRolloutSchedulesByRollout(ctx context.Context, namespace, rolloutName string, rolloutLabels, namespaceLabels map[string]string) (*rolloutv1alpha1.ClusterRolloutScheduleList, error)

GetClusterRolloutSchedulesByRollout gets ClusterRolloutSchedules that match a specific rollout

func (*Client) GetCurrentUserIdentity added in v0.6.0

func (c *Client) GetCurrentUserIdentity(ctx context.Context) (string, bool, error)

GetCurrentUserIdentity gets the current user's identity using SelfSubjectReview API This is the same API that kubectl auth whoami uses Returns the username and a boolean indicating if it's a service account Returns empty string and false if unable to determine identity

func (*Client) GetEnvironmentByRolloutReference added in v0.6.0

func (c *Client) GetEnvironmentByRolloutReference(ctx context.Context, namespace, rolloutName string) (*envv1alpha1.Environment, error)

GetEnvironmentByRolloutReference fetches Environment that references a specific rollout

func (*Client) GetEnvironments added in v0.6.0

func (c *Client) GetEnvironments(ctx context.Context, namespace string) (*envv1alpha1.EnvironmentList, error)

GetEnvironments fetches all Environments in a namespace

func (*Client) GetHealthChecksBySelector

func (c *Client) GetHealthChecksBySelector(ctx context.Context, namespace string, selector *rolloutv1alpha1.HealthCheckSelectorConfig) ([]rolloutv1alpha1.HealthCheck, error)

GetHealthChecksBySelector returns health checks that match the given selector

func (*Client) GetImagePolicies

func (c *Client) GetImagePolicies(ctx context.Context, namespace string) (*imagereflectorv1beta2.ImagePolicyList, error)

func (*Client) GetImagePoliciesAllNamespaces

func (c *Client) GetImagePoliciesAllNamespaces(ctx context.Context) (*imagereflectorv1beta2.ImagePolicyList, error)

New: list image policies across all namespaces

func (*Client) GetImagePolicy

func (c *Client) GetImagePolicy(ctx context.Context, namespace, name string) (*imagereflectorv1beta2.ImagePolicy, error)

func (*Client) GetImageRepositories

func (c *Client) GetImageRepositories(ctx context.Context, namespace string) (*imagereflectorv1beta2.ImageRepositoryList, error)

func (*Client) GetImageRepositoriesAllNamespaces

func (c *Client) GetImageRepositoriesAllNamespaces(ctx context.Context) (*imagereflectorv1beta2.ImageRepositoryList, error)

New: list image repositories across all namespaces

func (*Client) GetImageRepository

func (c *Client) GetImageRepository(ctx context.Context, namespace, name string) (*imagereflectorv1beta2.ImageRepository, error)

func (*Client) GetKruiseRollout added in v0.6.0

func (c *Client) GetKruiseRollout(ctx context.Context, namespace, name string) (*kruiserolloutv1beta1.Rollout, error)

GetKruiseRollout fetches a KruiseRollout by name and namespace

func (*Client) GetKustomization

func (c *Client) GetKustomization(ctx context.Context, namespace, name string) (*kustomizev1.Kustomization, error)

func (*Client) GetKustomizationManagedResources

func (c *Client) GetKustomizationManagedResources(ctx context.Context, namespace, name string) ([]ManagedResourceStatus, error)

func (*Client) GetKustomizations

func (c *Client) GetKustomizations(ctx context.Context, namespace string) (*kustomizev1.KustomizationList, error)

func (*Client) GetKustomizationsAllNamespaces

func (c *Client) GetKustomizationsAllNamespaces(ctx context.Context) (*kustomizev1.KustomizationList, error)

New: list kustomizations across all namespaces

func (*Client) GetKustomizationsByRolloutAnnotation

func (c *Client) GetKustomizationsByRolloutAnnotation(ctx context.Context, namespace, rolloutName string) (*kustomizev1.KustomizationList, error)

func (*Client) GetOCIRepositories

func (c *Client) GetOCIRepositories(ctx context.Context, namespace string) (*sourcev1.OCIRepositoryList, error)

func (*Client) GetOCIRepositoriesAllNamespaces

func (c *Client) GetOCIRepositoriesAllNamespaces(ctx context.Context) (*sourcev1.OCIRepositoryList, error)

New: list OCI repositories across all namespaces

func (*Client) GetOCIRepositoriesByRolloutAnnotation

func (c *Client) GetOCIRepositoriesByRolloutAnnotation(ctx context.Context, namespace, rolloutName string) (*sourcev1.OCIRepositoryList, error)

func (*Client) GetPodLogs added in v0.6.0

func (c *Client) GetPodLogs(ctx context.Context, namespace, podName, containerName string, tailLines *int64, follow bool) (string, error)

GetPodLogs retrieves logs from a pod

func (*Client) GetPodsByJobName added in v0.6.0

func (c *Client) GetPodsByJobName(ctx context.Context, namespace, jobName string) (*corev1.PodList, error)

GetPodsByJobName lists pods owned by a job

func (*Client) GetPodsByOwnerReference added in v0.6.0

func (c *Client) GetPodsByOwnerReference(ctx context.Context, namespace string, ownerUID string) (*corev1.PodList, error)

GetPodsByOwnerReference lists pods owned by a specific resource (by UID)

func (*Client) GetPodsBySelector added in v0.6.0

func (c *Client) GetPodsBySelector(ctx context.Context, namespace string, selector labels.Selector) (*corev1.PodList, error)

GetPodsBySelector lists pods matching the given label selector

func (*Client) GetReplicaSets added in v0.6.0

func (c *Client) GetReplicaSets(ctx context.Context, namespace string) (*appsv1.ReplicaSetList, error)

GetReplicaSets lists replica sets in a namespace

func (*Client) GetRollout

func (c *Client) GetRollout(ctx context.Context, namespace, name string) (*rolloutv1alpha1.Rollout, error)

func (*Client) GetRolloutGatesByRolloutReference

func (c *Client) GetRolloutGatesByRolloutReference(ctx context.Context, namespace, rolloutName string) (*rolloutv1alpha1.RolloutGateList, error)

GetRolloutGatesByRolloutReference fetches RolloutGates that reference a specific rollout

func (*Client) GetRolloutSchedule added in v0.7.0

func (c *Client) GetRolloutSchedule(ctx context.Context, namespace, name string) (*rolloutv1alpha1.RolloutSchedule, error)

GetRolloutSchedule gets a single RolloutSchedule

func (*Client) GetRolloutSchedules added in v0.7.0

func (c *Client) GetRolloutSchedules(ctx context.Context, namespace string) (*rolloutv1alpha1.RolloutScheduleList, error)

GetRolloutSchedules gets all RolloutSchedules in a namespace

func (*Client) GetRolloutSchedulesAllNamespaces added in v0.7.0

func (c *Client) GetRolloutSchedulesAllNamespaces(ctx context.Context) (*rolloutv1alpha1.RolloutScheduleList, error)

GetRolloutSchedulesAllNamespaces gets all RolloutSchedules across all namespaces

func (*Client) GetRolloutSchedulesByRollout added in v0.7.0

func (c *Client) GetRolloutSchedulesByRollout(ctx context.Context, namespace, rolloutName string, rolloutLabels map[string]string) (*rolloutv1alpha1.RolloutScheduleList, error)

GetRolloutSchedulesByRollout gets RolloutSchedules that match a specific rollout

func (*Client) GetRolloutTests added in v0.6.0

func (c *Client) GetRolloutTests(ctx context.Context, namespace string) (*openkruisev1alpha1.RolloutTestList, error)

func (*Client) GetRolloutTestsByRolloutName added in v0.6.0

func (c *Client) GetRolloutTestsByRolloutName(ctx context.Context, namespace, rolloutName string) (*openkruisev1alpha1.RolloutTestList, error)

GetRolloutTestsByRolloutName fetches RolloutTests that reference a specific KruiseRollout by name

func (*Client) GetRollouts

func (c *Client) GetRollouts(ctx context.Context, namespace string) (*rolloutv1alpha1.RolloutList, error)

func (*Client) GetRolloutsAllNamespaces

func (c *Client) GetRolloutsAllNamespaces(ctx context.Context) (*rolloutv1alpha1.RolloutList, error)

New: list rollouts across all namespaces

func (*Client) GetSecret

func (c *Client) GetSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error)

func (*Client) MarkDeploymentSuccessful added in v0.4.0

func (c *Client) MarkDeploymentSuccessful(ctx context.Context, namespace, name string, message string) (*rolloutv1alpha1.Rollout, error)

MarkDeploymentSuccessful marks the latest deployment as successful by updating the rollout status

func (*Client) ReconcileAllFluxResources

func (c *Client) ReconcileAllFluxResources(ctx context.Context, namespace, rolloutName string) (previousScanTime string, err error)

ReconcileAllFluxResources reconciles all associated Flux resources for a rollout Returns the previous scanTime of the ImageRepository (if found) so the caller can detect completion

func (*Client) ReconcileImageRepository added in v0.7.0

func (c *Client) ReconcileImageRepository(ctx context.Context, namespace, name string) error

ReconcileImageRepository adds the reconcile annotation to trigger a reconciliation

func (*Client) ReconcileKustomization

func (c *Client) ReconcileKustomization(ctx context.Context, namespace, name string) error

ReconcileKustomization adds the reconcile annotation to trigger a reconciliation

func (*Client) ReconcileOCIRepository

func (c *Client) ReconcileOCIRepository(ctx context.Context, namespace, name string) error

ReconcileOCIRepository adds the reconcile annotation to trigger a reconciliation

func (*Client) ResetBakeStatusToDeploying added in v0.7.4

func (c *Client) ResetBakeStatusToDeploying(ctx context.Context, namespace, name string) (*rolloutv1alpha1.Rollout, error)

ResetBakeStatusToDeploying resets the rollout's bake status to "Deploying" This should be called when continuing a rollout to indicate a new deployment phase

func (*Client) ResetHealthChecksToPending added in v0.7.4

func (c *Client) ResetHealthChecksToPending(ctx context.Context, namespace, name string) error

ResetHealthChecksToPending resets all health checks matching the rollout's selector to "Pending" This should be called when continuing a rollout to reset health monitoring

func (*Client) UpdateRolloutVersion

func (c *Client) UpdateRolloutVersion(ctx context.Context, namespace, name string, version *string, explanation string) (*rolloutv1alpha1.Rollout, error)

type ManagedResourceStatus

type ManagedResourceStatus struct {
	GroupVersionKind string                     `json:"groupVersionKind"`
	Name             string                     `json:"name"`
	Namespace        string                     `json:"namespace"`
	Status           string                     `json:"status"`
	Message          string                     `json:"message"`
	LastModified     time.Time                  `json:"lastModified"`
	Object           *unstructured.Unstructured `json:"object"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL