This script lists all images that are present on any of the cluster's nodes and determines the platforms supported by the image.
It uses the crane tool for detecting supported platforms.
Example usage:
| #!/usr/bin/env python3 | |
| # SPDX-FileCopyrightText: SAP SE or an SAP affiliate company and Gardener contributors | |
| # | |
| # SPDX-License-Identifier: Apache-2.0 | |
| """Analyze execution times of Ginkgo Ordered containers from Prow e2e junit reports. | |
| The script fetches junit.xml artifacts from the latest N successful runs of a | |
| Prow job, sums the durations of the individual [It] specs that belong to each | |
| Ordered container, and writes aggregated statistics per container to a CSV file. |
This script lists all images that are present on any of the cluster's nodes and determines the platforms supported by the image.
It uses the crane tool for detecting supported platforms.
Example usage:
| #!/bin/bash | |
| set -o errexit | |
| set -o nounset | |
| set -o pipefail | |
| extension="$(basename "$PWD")" | |
| platform=$(echo "${extension#gardener-extension-provider-}" | sed 's/packet/equinix-metal/') | |
| echo ">>> Revendoring $extension" |
| // json merge patch + optimistic locking | |
| patch := client.MergeFromWithOptions(shoot.DeepCopy(), client.MergeFromWithOptimisticLock{}) | |
| // ... | |
| // strategic merge patch + optimistic locking | |
| patch = client.StrategicMergeFrom(shoot.DeepCopy(), client.MergeFromWithOptimisticLock{}) | |
| // ... |
| var ( | |
| ctx context.Context | |
| c client.Client | |
| shoot *gardencorev1beta1.Shoot | |
| ) | |
| // update | |
| shoot.Spec.Kubernetes.Version = "1.22" | |
| err := c.Update(ctx, shoot) |
| { | |
| "kind": "Status", | |
| "apiVersion": "v1", | |
| "metadata": {}, | |
| "status": "Failure", | |
| "message": "Operation cannot be fulfilled on configmaps \"foo\": the object has been modified; please apply your changes to the latest version and try again", | |
| "reason": "Conflict", | |
| "details": { | |
| "name": "foo", | |
| "kind": "configmaps" |
| var ( | |
| ctx context.Context | |
| c client.Client // "sigs.k8s.io/controller-runtime/pkg/client" | |
| podList = &metav1.PartialObjectMetadataList{} // "k8s.io/apimachinery/pkg/apis/meta/v1" | |
| ) | |
| podList.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind("PodList")) // "k8s.io/api/core/v1" | |
| if err := c.List(ctx, podList, client.InNamespace("my-namespace"), client.Limit(1)); err != nil { | |
| return err | |
| } |
| var ( | |
| ctx context.Context | |
| c client.Client // "sigs.k8s.io/controller-runtime/pkg/client" | |
| deployment *appsv1.Deployment // "k8s.io/api/apps/v1" | |
| shoot *gardencorev1beta1.Shoot // "github.com/gardener/gardener/pkg/apis/core/v1beta1" | |
| ) | |
| err := c.Update(ctx, deployment) | |
| // or | |
| err = c.Update(ctx, shoot) |
| var ( | |
| ctx context.Context | |
| c gardencoreclientset.Interface // "github.com/gardener/gardener/pkg/client/core/clientset/versioned" | |
| shoot *gardencorev1beta1.Shoot // "github.com/gardener/gardener/pkg/apis/core/v1beta1" | |
| ) | |
| updatedShoot, err := c.CoreV1beta1().Shoots("garden-eden").Update(ctx, shoot, metav1.UpdateOptions{}) |
| var ( | |
| ctx context.Context | |
| c kubernetes.Interface // "k8s.io/client-go/kubernetes" | |
| deployment *appsv1.Deployment // "k8s.io/api/apps/v1" | |
| ) | |
| updatedDeployment, err := c.AppsV1().Deployments("default").Update(ctx, deployment, metav1.UpdateOptions{}) |