diff --git a/Makefile b/Makefile index 74e1325..c8cf8b6 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,11 @@ build: export CGO_ENABLED=0 && \ go build -o bin/${HELM_PLUGIN_NAME} -ldflags $(LDFLAGS) ./cmd/mapkubeapis +.PHONY: converter +converter: + export CGO_ENABLED=0 && \ + go build -o bin/converter ./cmd/converter + .PHONY: bootstrap bootstrap: export GO111MODULE=on && \ diff --git a/README.md b/README.md index 8ef1b8f..2501cb3 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ > Note: Charts need to be updated also to supported Kubernetes APIs to avoid failure during deployment in a Kubernetes version. This is a separate task to the plugin. +> Note: The mapfile format has changed from the previous release. The new format is more resilient to changes in spacing and ordering of the Helm release metadata. The new format is described in the [API Mapping](#api-mapping) section. A converter has been provided to convert the old format to the new format. The converter may be found in the `cmd/converter` directory, built via `make converter`, and ran via `./bin/converter`. + ## Prerequisite - Helm client with `mapkubeapis` plugin installed on the same system @@ -95,10 +97,14 @@ kind: ClusterRoleBinding The mapping information of deprecated or removed APIs to supported APIs is configured in the [Map.yaml](https://github.com/helm/helm-mapkubeapis/blob/master/config/Map.yaml) file. The file is a list of entries similar to the following: ```yaml - - deprecatedAPI: "apiVersion: extensions/v1beta1\nkind: Deployment" - newAPI: "apiVersion: apps/v1\nkind: Deployment" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" +- deprecatedAPI: + apiVersion: extensions/v1beta1 + kind: Deployment +newAPI: + apiVersion: apps/v1 + kind: Deployment +deprecatedInVersion: "v1.9" +removedInVersion: "v1.16" ``` The plugin when performing update of a Helm release metadata first loads the map file from the `config` directory where the plugin is run from. If the map file is a different name or in a different location, you can use the `--mapfile` flag to specify the different mapping file. diff --git a/cmd/converter/main.go b/cmd/converter/main.go new file mode 100644 index 0000000..8a6a748 --- /dev/null +++ b/cmd/converter/main.go @@ -0,0 +1,81 @@ +package main + +import ( + "fmt" + "os" + "strings" + + "github.com/helm/helm-mapkubeapis/pkg/common" + "github.com/helm/helm-mapkubeapis/pkg/mapping" + "sigs.k8s.io/yaml" +) + +func readConfig(f string) ([]common.GenericYAML, error) { + b, err := os.ReadFile(f) + if err != nil { + return nil, err + } + return common.ParseYAML(string(b)) +} + +func exitOnError(err error) { + if err != nil { + _, _ = os.Stderr.WriteString(err.Error() + "\n") + os.Exit(1) + } +} + +func main() { + var config string + if len(os.Args) == 1 || strings.HasPrefix(os.Args[1], "-h") || strings.HasPrefix(os.Args[1], "--h") { + _, _ = os.Stdout.WriteString("Usage: " + os.Args[0] + " [file]\n") + os.Exit(0) + } + config = os.Args[1] + input, err := readConfig(config) + exitOnError(err) + var mappings []any + if v, ok := input[0]["mappings"].([]any); ok { + mappings = v + } + if len(mappings) == 0 { + exitOnError(fmt.Errorf("failed to read mappings")) + } + var output mapping.Metadata + var m common.GenericYAML + var s string + var ok bool + for _, val := range mappings { + var om mapping.Mapping + if m, ok = val.(common.GenericYAML); !ok { + continue // skip invalid mappings + } + if s, ok = m["deprecatedAPI"].(string); ok { + apiVersion, kind := parseAPIString(s) + if apiVersion == "" || kind == "" { + continue // skip invalid mappings + } + om.DeprecatedAPI.APIVersion = apiVersion + om.DeprecatedAPI.Kind = kind + } + if s, ok = m["newAPI"].(string); ok { + apiVersion, kind := parseAPIString(s) + if apiVersion == "" || kind == "" { + continue // skip invalid mappings + } + om.NewAPI.APIVersion = apiVersion + om.NewAPI.Kind = kind + } + if s, ok = m["deprecatedInVersion"].(string); ok { + om.DeprecatedInVersion = s + } + if s, ok = m["removedInVersion"].(string); ok { + om.RemovedInVersion = s + } + output.Mappings = append(output.Mappings, &om) + } + var b []byte + b, err = yaml.Marshal(output) + exitOnError(err) + _, _ = os.Stdout.Write(b) +} diff --git a/cmd/converter/parse.go b/cmd/converter/parse.go new file mode 100644 index 0000000..1556370 --- /dev/null +++ b/cmd/converter/parse.go @@ -0,0 +1,33 @@ +package main + +import "strings" + +const ( + apiVersionLabel = "apiVersion:" + kindLabel = "kind:" + apiVersionLabelSize = len(apiVersionLabel) + kindLabelSize = len(kindLabel) +) + +// parseAPIString parses the API string into version and kind components +func parseAPIString(apiString string) (version, kind string) { + idx := strings.Index(apiString, apiVersionLabel) + if idx != -1 { + temps := apiString[idx+apiVersionLabelSize:] + idx = strings.Index(temps, "\n") + if idx != -1 { + temps = temps[:idx] + version = strings.TrimSpace(temps) + } + } + idx = strings.Index(apiString, kindLabel) + if idx != -1 { + temps := apiString[idx+kindLabelSize:] + idx = strings.Index(temps, "\n") + if idx != -1 { + temps = temps[:idx] + kind = strings.TrimSpace(temps) + } + } + return version, kind +} diff --git a/config/Map.yaml b/config/Map.yaml index 7379440..adae2a4 100644 --- a/config/Map.yaml +++ b/config/Map.yaml @@ -1,235 +1,472 @@ mappings: - - deprecatedAPI: "apiVersion: extensions/v1beta1\nkind: Deployment\n" - newAPI: "apiVersion: apps/v1\nkind: Deployment\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: apps/v1beta1\nkind: Deployment\n" - newAPI: "apiVersion: apps/v1\nkind: Deployment\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: apps/v1beta2\nkind: Deployment\n" - newAPI: "apiVersion: apps/v1\nkind: Deployment\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: apps/v1beta1\nkind: StatefulSet\n" - newAPI: "apiVersion: apps/v1\nkind: StatefulSet\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: apps/v1beta2\nkind: StatefulSet\n" - newAPI: "apiVersion: apps/v1\nkind: StatefulSet\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: extensions/v1beta1\nkind: DaemonSet\n" - newAPI: "apiVersion: apps/v1\nkind: DaemonSet\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: apps/v1beta2\nkind: DaemonSet\n" - newAPI: "apiVersion: apps/v1\nkind: DaemonSet\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: extensions/v1beta1\nkind: ReplicaSet\n" - newAPI: "apiVersion: apps/v1\nkind: ReplicaSet\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: apps/v1beta1\nkind: ReplicaSet\n" - newAPI: "apiVersion: apps/v1\nkind: ReplicaSet\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: apps/v1beta2\nkind: ReplicaSet\n" - newAPI: "apiVersion: apps/v1\nkind: ReplicaSet\n" - deprecatedInVersion: "v1.9" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: extensions/v1beta1\nkind: NetworkPolicy\n" - newAPI: "apiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\n" - deprecatedInVersion: "v1.8" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: extensions/v1beta1\nkind: PodSecurityPolicy\n" - newAPI: "apiVersion: policy/v1beta1\nkind: PodSecurityPolicy\n" - deprecatedInVersion: "v1.10" - removedInVersion: "v1.16" - - deprecatedAPI: "apiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingWebhookConfiguration\n" - newAPI: "apiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\n" - deprecatedInVersion: "v1.16" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: admissionregistration.k8s.io/v1beta1\nkind: ValidatingWebhookConfiguration\n" - newAPI: "apiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\n" - deprecatedInVersion: "v1.16" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n" - newAPI: "apiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n" - deprecatedInVersion: "v1.16" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: apiregistration.k8s.io/v1beta1\nkind: APIService\n" - newAPI: "apiVersion: apiregistration.k8s.io/v1\nkind: APIService\n" - deprecatedInVersion: "v1.19" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: apiregistration.k8s.io/v1beta1\nkind: APIServiceList\n" - newAPI: "apiVersion: apiregistration.k8s.io/v1\nkind: APIServiceList\n" - deprecatedInVersion: "v1.19" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: authentication.k8s.io/v1beta1\nkind: TokenReview\n" - newAPI: "apiVersion: authentication.k8s.io/v1\nkind: TokenReview\n" - deprecatedInVersion: "v1.16" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: authorization.k8s.io/v1beta1\nkind: LocalSubjectAccessReview\n" - newAPI: "apiVersion: authorization.k8s.io/v1\nkind: LocalSubjectAccessReview\n" - deprecatedInVersion: "v1.16" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: authorization.k8s.io/v1beta1\nkind: SelfSubjectAccessReview\n" - newAPI: "apiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\n" - deprecatedInVersion: "v1.16" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: authorization.k8s.io/v1beta1\nkind: SubjectAccessReview\n" - newAPI: "apiVersion: authorization.k8s.io/v1\nkind: SubjectAccessReview\n" - deprecatedInVersion: "v1.16" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: autoscaling/v2beta1\nkind: HorizontalPodAutoscaler\n" - newAPI: "apiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\n" - deprecatedInVersion: "v1.23" - removedInVersion: "v1.25" - - deprecatedAPI: "apiVersion: autoscaling/v2beta2\nkind: HorizontalPodAutoscaler\n" - newAPI: "apiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\n" - deprecatedInVersion: "v1.23" - removedInVersion: "v1.26" - - deprecatedAPI: "apiVersion: batch/v1beta1\nkind: CronJob\n" - newAPI: "apiVersion: batch/v1\nkind: CronJob\n" - deprecatedInVersion: "v1.21" - removedInVersion: "v1.25" - - deprecatedAPI: "apiVersion: certificates.k8s.io/v1beta1\nkind: CertificateSigningRequest\n" - newAPI: "apiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n" - deprecatedInVersion: "v1.19" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: coordination.k8s.io/v1beta1\nkind: Lease\n" - newAPI: "apiVersion: coordination.k8s.io/v1\nkind: Lease\n" - deprecatedInVersion: "v1.14" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: extensions/v1beta1\nkind: Ingress\n" - newAPI: "apiVersion: networking.k8s.io/v1beta1\nkind: Ingress\n" - deprecatedInVersion: "v1.14" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: networking.k8s.io/v1beta1\nkind: Ingress\n" - newAPI: "apiVersion: networking.k8s.io/v1\nkind: Ingress\n" - deprecatedInVersion: "v1.19" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: networking.k8s.io/v1beta1\nkind: IngressClass\n" - newAPI: "apiVersion: networking.k8s.io/v1\nkind: IngressClass\n" - deprecatedInVersion: "v1.19" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: policy/v1beta1\nkind: PodDisruptionBudget\n" - newAPI: "apiVersion: policy/v1\nkind: PodDisruptionBudget\n" - deprecatedInVersion: "v1.21" - removedInVersion: "v1.25" - - deprecatedAPI: "apiVersion: policy/v1beta1\nkind: PodSecurityPolicy\n" - removedInVersion: "v1.25" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1alpha1\nkind: ClusterRole\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1alpha1\nkind: ClusterRoleList\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleList\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1alpha1\nkind: ClusterRoleBinding\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1alpha1\nkind: ClusterRoleBindingList\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBindingList\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1alpha1\nkind: Role\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: Role\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1alpha1\nkind: RoleList\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: RoleList\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1alpha1\nkind: RoleBinding\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1alpha1\nkind: RoleBindingList\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBindingList\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1beta1\nkind: ClusterRole\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1beta1\nkind: ClusterRoleList\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleList\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1beta1\nkind: ClusterRoleBinding\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1beta1\nkind: ClusterRoleBindingList\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBindingList\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1beta1\nkind: Role\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: Role\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1beta1\nkind: RoleList\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: RoleList\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1beta1\nkind: RoleBinding\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: rbac.authorization.k8s.io/v1beta1\nkind: RoleBindingList\n" - newAPI: "apiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBindingList\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: scheduling.k8s.io/v1beta1\nkind: PriorityClass\n" - newAPI: "apiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\n" - deprecatedInVersion: "v1.14" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: storage.k8s.io/v1beta1\nkind: CSIDriver\n" - newAPI: "apiVersion: storage.k8s.io/v1\nkind: CSIDriver\n" - deprecatedInVersion: "v1.19" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: storage.k8s.io/v1beta1\nkind: CSINode\n" - newAPI: "apiVersion: storage.k8s.io/v1\nkind: CSINode\n" - deprecatedInVersion: "v1.17" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: storage.k8s.io/v1beta1\nkind: StorageClass\n" - newAPI: "apiVersion: storage.k8s.io/v1\nkind: StorageClass\n" - deprecatedInVersion: "v1.16" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: storage.k8s.io/v1beta1\nkind: VolumeAttachment\n" - newAPI: "apiVersion: storage.k8s.io/v1\nkind: VolumeAttachment\n" - deprecatedInVersion: "v1.13" - removedInVersion: "v1.22" - - deprecatedAPI: "apiVersion: storage.k8s.io/v1beta1\nkind: CSIStorageCapacity\n" - newAPI: "apiVersion: storage.k8s.io/v1\nkind: CSIStorageCapacity\n" - deprecatedInVersion: "v1.24" - removedInVersion: "v1.27" - - deprecatedAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta1\nkind: FlowSchema\n" - newAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta3\nkind: FlowSchema\n" - deprecatedInVersion: "v1.26" - removedInVersion: "v1.26" - - deprecatedAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta2\nkind: FlowSchema\n" - newAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta3\nkind: FlowSchema\n" - deprecatedInVersion: "v1.26" - removedInVersion: "v1.29" - - deprecatedAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta3\nkind: FlowSchema\n" - newAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\n" - deprecatedInVersion: "v1.29" - removedInVersion: "v1.32" - - deprecatedAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta1\nkind: PriorityLevelConfiguration\n" - newAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta3\nkind: PriorityLevelConfiguration\n" - deprecatedInVersion: "v1.26" - removedInVersion: "v1.26" - - deprecatedAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta2\nkind: PriorityLevelConfiguration\n" - newAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta3\nkind: PriorityLevelConfiguration\n" - deprecatedInVersion: "v1.26" - removedInVersion: "v1.29" - - deprecatedAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1beta3\nkind: PriorityLevelConfiguration\n" - newAPI: "apiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: PriorityLevelConfiguration\n" - deprecatedInVersion: "v1.29" - removedInVersion: "v1.32" \ No newline at end of file +- deprecatedAPI: + apiVersion: extensions/v1beta1 + kind: Deployment + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: Deployment + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: apps/v1beta1 + kind: Deployment + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: Deployment + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: apps/v1beta2 + kind: Deployment + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: Deployment + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: apps/v1beta1 + kind: StatefulSet + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: StatefulSet + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: apps/v1beta2 + kind: StatefulSet + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: StatefulSet + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: extensions/v1beta1 + kind: DaemonSet + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: DaemonSet + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: apps/v1beta2 + kind: DaemonSet + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: DaemonSet + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: extensions/v1beta1 + kind: ReplicaSet + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: ReplicaSet + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: apps/v1beta1 + kind: ReplicaSet + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: ReplicaSet + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: apps/v1beta2 + kind: ReplicaSet + deprecatedInVersion: v1.9 + newAPI: + apiVersion: apps/v1 + kind: ReplicaSet + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: extensions/v1beta1 + kind: NetworkPolicy + deprecatedInVersion: v1.8 + newAPI: + apiVersion: networking.k8s.io/v1 + kind: NetworkPolicy + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: extensions/v1beta1 + kind: PodSecurityPolicy + deprecatedInVersion: v1.10 + newAPI: + apiVersion: policy/v1beta1 + kind: PodSecurityPolicy + removedInVersion: v1.16 +- deprecatedAPI: + apiVersion: admissionregistration.k8s.io/v1beta1 + kind: MutatingWebhookConfiguration + deprecatedInVersion: v1.16 + newAPI: + apiVersion: admissionregistration.k8s.io/v1 + kind: MutatingWebhookConfiguration + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: admissionregistration.k8s.io/v1beta1 + kind: ValidatingWebhookConfiguration + deprecatedInVersion: v1.16 + newAPI: + apiVersion: admissionregistration.k8s.io/v1 + kind: ValidatingWebhookConfiguration + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: apiextensions.k8s.io/v1beta1 + kind: CustomResourceDefinition + deprecatedInVersion: v1.16 + newAPI: + apiVersion: apiextensions.k8s.io/v1 + kind: CustomResourceDefinition + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: apiregistration.k8s.io/v1beta1 + kind: APIService + deprecatedInVersion: v1.19 + newAPI: + apiVersion: apiregistration.k8s.io/v1 + kind: APIService + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: apiregistration.k8s.io/v1beta1 + kind: APIServiceList + deprecatedInVersion: v1.19 + newAPI: + apiVersion: apiregistration.k8s.io/v1 + kind: APIServiceList + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: authentication.k8s.io/v1beta1 + kind: TokenReview + deprecatedInVersion: v1.16 + newAPI: + apiVersion: authentication.k8s.io/v1 + kind: TokenReview + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: authorization.k8s.io/v1beta1 + kind: LocalSubjectAccessReview + deprecatedInVersion: v1.16 + newAPI: + apiVersion: authorization.k8s.io/v1 + kind: LocalSubjectAccessReview + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: authorization.k8s.io/v1beta1 + kind: SelfSubjectAccessReview + deprecatedInVersion: v1.16 + newAPI: + apiVersion: authorization.k8s.io/v1 + kind: SelfSubjectAccessReview + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: authorization.k8s.io/v1beta1 + kind: SubjectAccessReview + deprecatedInVersion: v1.16 + newAPI: + apiVersion: authorization.k8s.io/v1 + kind: SubjectAccessReview + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: autoscaling/v2beta1 + kind: HorizontalPodAutoscaler + deprecatedInVersion: v1.23 + newAPI: + apiVersion: autoscaling/v2 + kind: HorizontalPodAutoscaler + removedInVersion: v1.25 +- deprecatedAPI: + apiVersion: autoscaling/v2beta2 + kind: HorizontalPodAutoscaler + deprecatedInVersion: v1.23 + newAPI: + apiVersion: autoscaling/v2 + kind: HorizontalPodAutoscaler + removedInVersion: v1.26 +- deprecatedAPI: + apiVersion: batch/v1beta1 + kind: CronJob + deprecatedInVersion: v1.21 + newAPI: + apiVersion: batch/v1 + kind: CronJob + removedInVersion: v1.25 +- deprecatedAPI: + apiVersion: certificates.k8s.io/v1beta1 + kind: CertificateSigningRequest + deprecatedInVersion: v1.19 + newAPI: + apiVersion: certificates.k8s.io/v1 + kind: CertificateSigningRequest + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: coordination.k8s.io/v1beta1 + kind: Lease + deprecatedInVersion: v1.14 + newAPI: + apiVersion: coordination.k8s.io/v1 + kind: Lease + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: extensions/v1beta1 + kind: Ingress + deprecatedInVersion: v1.14 + newAPI: + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: networking.k8s.io/v1beta1 + kind: Ingress + deprecatedInVersion: v1.19 + newAPI: + apiVersion: networking.k8s.io/v1 + kind: Ingress + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: networking.k8s.io/v1beta1 + kind: IngressClass + deprecatedInVersion: v1.19 + newAPI: + apiVersion: networking.k8s.io/v1 + kind: IngressClass + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: policy/v1beta1 + kind: PodDisruptionBudget + deprecatedInVersion: v1.21 + newAPI: + apiVersion: policy/v1 + kind: PodDisruptionBudget + removedInVersion: v1.25 +- deprecatedAPI: + apiVersion: policy/v1beta1 + kind: PodSecurityPolicy + newAPI: + apiVersion: "" + kind: "" + removedInVersion: v1.25 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1alpha1 + kind: ClusterRole + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRole + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1alpha1 + kind: ClusterRoleList + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleList + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1alpha1 + kind: ClusterRoleBinding + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleBinding + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1alpha1 + kind: ClusterRoleBindingList + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleBindingList + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1alpha1 + kind: Role + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: Role + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1alpha1 + kind: RoleList + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleList + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1alpha1 + kind: RoleBinding + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleBinding + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1alpha1 + kind: RoleBindingList + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleBindingList + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1beta1 + kind: ClusterRole + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRole + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1beta1 + kind: ClusterRoleList + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleList + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1beta1 + kind: ClusterRoleBinding + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleBinding + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1beta1 + kind: ClusterRoleBindingList + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleBindingList + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1beta1 + kind: Role + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: Role + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1beta1 + kind: RoleList + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleList + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1beta1 + kind: RoleBinding + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleBinding + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: rbac.authorization.k8s.io/v1beta1 + kind: RoleBindingList + deprecatedInVersion: v1.17 + newAPI: + apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleBindingList + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: scheduling.k8s.io/v1beta1 + kind: PriorityClass + deprecatedInVersion: v1.14 + newAPI: + apiVersion: scheduling.k8s.io/v1 + kind: PriorityClass + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: storage.k8s.io/v1beta1 + kind: CSIDriver + deprecatedInVersion: v1.19 + newAPI: + apiVersion: storage.k8s.io/v1 + kind: CSIDriver + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: storage.k8s.io/v1beta1 + kind: CSINode + deprecatedInVersion: v1.17 + newAPI: + apiVersion: storage.k8s.io/v1 + kind: CSINode + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: storage.k8s.io/v1beta1 + kind: StorageClass + deprecatedInVersion: v1.16 + newAPI: + apiVersion: storage.k8s.io/v1 + kind: StorageClass + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: storage.k8s.io/v1beta1 + kind: VolumeAttachment + deprecatedInVersion: v1.13 + newAPI: + apiVersion: storage.k8s.io/v1 + kind: VolumeAttachment + removedInVersion: v1.22 +- deprecatedAPI: + apiVersion: storage.k8s.io/v1beta1 + kind: CSIStorageCapacity + deprecatedInVersion: v1.24 + newAPI: + apiVersion: storage.k8s.io/v1 + kind: CSIStorageCapacity + removedInVersion: v1.27 +- deprecatedAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta1 + kind: FlowSchema + deprecatedInVersion: v1.26 + newAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta3 + kind: FlowSchema + removedInVersion: v1.26 +- deprecatedAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta2 + kind: FlowSchema + deprecatedInVersion: v1.26 + newAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta3 + kind: FlowSchema + removedInVersion: v1.29 +- deprecatedAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta3 + kind: FlowSchema + deprecatedInVersion: v1.29 + newAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1 + kind: FlowSchema + removedInVersion: v1.32 +- deprecatedAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta1 + kind: PriorityLevelConfiguration + deprecatedInVersion: v1.26 + newAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta3 + kind: PriorityLevelConfiguration + removedInVersion: v1.26 +- deprecatedAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta2 + kind: PriorityLevelConfiguration + deprecatedInVersion: v1.26 + newAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta3 + kind: PriorityLevelConfiguration + removedInVersion: v1.29 +- deprecatedAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1beta3 + kind: PriorityLevelConfiguration + deprecatedInVersion: v1.29 + newAPI: + apiVersion: flowcontrol.apiserver.k8s.io/v1 + kind: PriorityLevelConfiguration + removedInVersion: v1.32 diff --git a/go.mod b/go.mod index 4e884d2..d911061 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( require ( github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect + github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/BurntSushi/toml v1.3.2 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect @@ -24,21 +25,31 @@ require ( github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/Masterminds/squirrel v1.5.4 // indirect - github.com/Microsoft/hcsshim v0.11.4 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/Microsoft/hcsshim v0.11.7 // indirect github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect - github.com/containerd/containerd v1.7.12 // indirect + github.com/containerd/cgroups v1.1.0 // indirect + github.com/containerd/containerd v1.7.27 // indirect + github.com/containerd/containerd/api v1.8.0 // indirect + github.com/containerd/continuity v0.4.4 // indirect + github.com/containerd/errdefs v0.3.0 // indirect + github.com/containerd/fifo v1.1.0 // indirect github.com/containerd/log v0.1.0 // indirect + github.com/containerd/platforms v0.2.1 // indirect + github.com/containerd/ttrpc v1.2.7 // indirect + github.com/containerd/typeurl/v2 v2.1.1 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/distribution/reference v0.5.0 // indirect + github.com/distribution/reference v0.6.0 // indirect github.com/docker/cli v25.0.1+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect github.com/docker/docker v25.0.6+incompatible // indirect github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/docker/go-connections v0.5.0 // indirect + github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v5.7.0+incompatible // indirect @@ -55,6 +66,7 @@ require ( github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/btree v1.0.1 // indirect github.com/google/gnostic-models v0.6.8 // indirect @@ -62,7 +74,7 @@ require ( github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/google/uuid v1.4.0 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/gosuri/uitable v0.0.4 // indirect @@ -75,7 +87,7 @@ require ( github.com/jmoiron/sqlx v1.3.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.16.0 // indirect + github.com/klauspost/compress v1.16.7 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -90,6 +102,11 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/locker v1.0.1 // indirect github.com/moby/spdystream v0.2.0 // indirect + github.com/moby/sys/mountinfo v0.6.2 // indirect + github.com/moby/sys/sequential v0.5.0 // indirect + github.com/moby/sys/signal v0.7.0 // indirect + github.com/moby/sys/user v0.3.0 // indirect + github.com/moby/sys/userns v0.1.0 // indirect github.com/moby/term v0.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -97,7 +114,9 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc6 // indirect + github.com/opencontainers/image-spec v1.1.0 // indirect + github.com/opencontainers/runtime-spec v1.1.0 // indirect + github.com/opencontainers/selinux v1.11.0 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.4.0 // indirect @@ -112,25 +131,27 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xlab/treeprint v1.2.0 // indirect + go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect - golang.org/x/crypto v0.26.0 // indirect + golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect - golang.org/x/term v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/net v0.33.0 // indirect + golang.org/x/oauth2 v0.11.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/term v0.27.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.24.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/grpc v1.58.3 // indirect - google.golang.org/protobuf v1.34.1 // indirect + google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect + google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/api v0.30.3 // indirect diff --git a/go.sum b/go.sum index 7653cff..140c11d 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= +github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 h1:59MxjQVfjXsBpLy+dbd2/ELV5ofnUkUZBvWSC85sheA= +github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0/go.mod h1:OahwfttHWG6eJ0clwcfBAHoDI6X/LV/15hx/wlMZSrU= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -21,8 +23,12 @@ github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8 github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= +github.com/Microsoft/hcsshim v0.11.7 h1:vl/nj3Bar/CvJSYo7gIQPyRWc9f3c6IeSNavBTSZNZQ= +github.com/Microsoft/hcsshim v0.11.7/go.mod h1:MV8xMfmECjl5HdO7U/3/hFVnkmSBjAjmA09d4bExKcU= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d h1:UrqY+r/OJnIp5u0s1SbQ8dVfLCZJsnvazdBP5hS4iRs= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -52,14 +58,32 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/containerd v1.7.12 h1:+KQsnv4VnzyxWcfO9mlxxELaoztsDEjOuCMPAuPqgU0= github.com/containerd/containerd v1.7.12/go.mod h1:/5OMpE1p0ylxtEUGY8kuCYkDRzJm9NO1TFMWjUpdevk= +github.com/containerd/containerd v1.7.27 h1:yFyEyojddO3MIGVER2xJLWoCIn+Up4GaHFquP7hsFII= +github.com/containerd/containerd v1.7.27/go.mod h1:xZmPnl75Vc+BLGt4MIfu6bp+fy03gdHAn9bz+FreFR0= +github.com/containerd/containerd/api v1.8.0 h1:hVTNJKR8fMc/2Tiw60ZRijntNMd1U+JVMyTRdsD2bS0= +github.com/containerd/containerd/api v1.8.0/go.mod h1:dFv4lt6S20wTu/hMcP4350RL87qPWLVa/OHOwmmdnYc= github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM= github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= +github.com/containerd/continuity v0.4.4 h1:/fNVfTJ7wIl/YPMHjf+5H32uFhl63JucB34PlCpMKII= +github.com/containerd/continuity v0.4.4/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= +github.com/containerd/errdefs v0.3.0 h1:FSZgGOeK4yuT/+DnF07/Olde/q4KBoMsaamhXxIMDp4= +github.com/containerd/errdefs v0.3.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= +github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY= +github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= +github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= +github.com/containerd/ttrpc v1.2.7 h1:qIrroQvuOL9HQ1X6KHe2ohc7p+HP/0VE6XPU7elJRqQ= +github.com/containerd/ttrpc v1.2.7/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o= +github.com/containerd/typeurl v1.0.2 h1:Chlt8zIieDbzQFzXzAeBEF92KhExuE4p9p92/QmY7aY= +github.com/containerd/typeurl/v2 v2.1.1 h1:3Q4Pt7i8nYwy2KmQWIw2+1hTvwTE/6w9FqcttATPO/4= +github.com/containerd/typeurl/v2 v2.1.1/go.mod h1:IDp2JFvbwZ31H8dQbEIY7sDl2L3o3HZj1hsSQlywkQ0= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= @@ -73,6 +97,8 @@ github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2 h1:aB github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2/go.mod h1:WHNsWjnIn2V1LYOrME7e8KxSeKunYHsxEm4am0BUtcI= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/cli v25.0.1+incompatible h1:mFpqnrS6Hsm3v1k7Wa/BO23oz0k121MTbTO1lpcGSkU= github.com/docker/cli v25.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= @@ -91,7 +117,9 @@ github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arX github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI= github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -140,6 +168,7 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -152,6 +181,8 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/gomodule/redigo v1.8.2 h1:H5XSIre1MB5NbPYFp+i1NBbb5qN1W8Y8YAQoAYbkm8k= @@ -166,6 +197,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -177,8 +210,11 @@ github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= @@ -220,6 +256,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4= github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -278,6 +316,14 @@ github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8 github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= +github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= +github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= +github.com/moby/sys/signal v0.7.0 h1:25RW3d5TnQEoKvRbEKUGay6DCQ46IxAVTT9CUMgmsSI= +github.com/moby/sys/signal v0.7.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg= +github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= +github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= +github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= +github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -302,6 +348,12 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU= github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= +github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU= +github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 h1:Ii+DKncOVM8Cu1Hc+ETb5K+23HdAMvESYE3ZJ5b5cMI= @@ -391,10 +443,16 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 h1:x8Z78aZ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0/go.mod h1:62CPTSry9QZtOaSsE3tOzhx6LzDhHnXJ6xHeMNNiM6Q= go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.starlark.net v0.0.0-20230525235612-a134d8f9ddca h1:VdD38733bfYv5tUZwEIskMM93VanwNIi5bIKnDrJdEY= go.starlark.net v0.0.0-20230525235612-a134d8f9ddca/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -405,6 +463,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= @@ -427,14 +487,19 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= +golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -444,6 +509,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -457,6 +524,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -464,12 +532,16 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -477,6 +549,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -501,23 +575,36 @@ google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 h1:1hfbdAfFbkmpg41000wDVqr7jUpK/Yo+LPnIxxGzmkg= +google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3/go.mod h1:5RBcpGRxr25RbDzY5w+dmaqpSEvl8Gwl1x2CICf60ic= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/pkg/common/common.go b/pkg/common/common.go index 9bbd148..8f66eac 100644 --- a/pkg/common/common.go +++ b/pkg/common/common.go @@ -17,16 +17,14 @@ limitations under the License. package common import ( - "log" - "strings" - + "fmt" + "github.com/helm/helm-mapkubeapis/pkg/mapping" "github.com/pkg/errors" "golang.org/x/mod/semver" - - "github.com/helm/helm-mapkubeapis/pkg/mapping" + "log" ) -// KubeConfig are the Kubernetes configurationĀ settings +// KubeConfig are the Kubernetes configuration settings type KubeConfig struct { Context string File string @@ -47,7 +45,7 @@ const UpgradeDescription = "Kubernetes deprecated API upgrade - DO NOT rollback // ReplaceManifestUnSupportedAPIs returns a release manifest with deprecated or removed // Kubernetes APIs updated to supported APIs func ReplaceManifestUnSupportedAPIs(origManifest, mapFile string, kubeConfig KubeConfig) (string, error) { - var modifiedManifest = origManifest + var modifiedManifest string var err error var mapMetadata *mapping.Metadata @@ -66,7 +64,7 @@ func ReplaceManifestUnSupportedAPIs(origManifest, mapFile string, kubeConfig Kub } // Check for deprecated or removed APIs and map accordingly to supported versions - modifiedManifest, err = ReplaceManifestData(mapMetadata, modifiedManifest, kubeVersionStr) + modifiedManifest, err = ReplaceManifestData(mapMetadata, origManifest, kubeVersionStr) if err != nil { return "", err } @@ -77,69 +75,59 @@ func ReplaceManifestUnSupportedAPIs(origManifest, mapFile string, kubeConfig Kub // ReplaceManifestData scans the release manifest string for deprecated APIs in a given Kubernetes version and replaces // their groups and versions if there is a successor, or fully removes the manifest for that specific resource if no // successors exist (such as the PodSecurityPolicy API). -func ReplaceManifestData(mapMetadata *mapping.Metadata, modifiedManifest string, kubeVersionStr string) (string, error) { - for _, mapping := range mapMetadata.Mappings { - deprecatedAPI := mapping.DeprecatedAPI - supportedAPI := mapping.NewAPI - var apiVersionStr string - if mapping.DeprecatedInVersion != "" { - apiVersionStr = mapping.DeprecatedInVersion - } else { - apiVersionStr = mapping.RemovedInVersion +func ReplaceManifestData(mapMetadata *mapping.Metadata, origManifest string, kubeVersionStr string) (string, error) { + yamlDocs, err := ParseYAML(origManifest) + if err != nil { + return "", err + } + for _, m := range mapMetadata.Mappings { + var apiVersionStr = m.RemovedInVersion + if m.DeprecatedInVersion != "" { + apiVersionStr = m.DeprecatedInVersion } if !semver.IsValid(apiVersionStr) { - return "", errors.Errorf("Failed to get the deprecated or removed Kubernetes version for API: %s", strings.ReplaceAll(deprecatedAPI, "\n", " ")) + return "", errors.Errorf("Failed to get the deprecated or removed Kubernetes version for apiVersion: %s kind: %s", + m.DeprecatedAPI.APIVersion, m.DeprecatedAPI.Kind) } - if count := strings.Count(modifiedManifest, deprecatedAPI); count > 0 { - if semver.Compare(apiVersionStr, kubeVersionStr) > 0 { - log.Printf("The following API:\n\"%s\" does not require mapping as the "+ - "API is not deprecated or removed in Kubernetes \"%s\"\n", deprecatedAPI, kubeVersionStr) - // skip to next mapping - continue + var count = 0 + docLoop: + for idx, doc := range yamlDocs { + version, _ := doc["apiVersion"].(string) + kind, _ := doc["kind"].(string) + if version == m.DeprecatedAPI.APIVersion && kind == m.DeprecatedAPI.Kind { + fmt.Printf("Found deprecated or removed Kubernetes version for API: %s %s\n", + m.DeprecatedAPI.APIVersion, m.DeprecatedAPI.Kind) + fmt.Println("original: ", doc) + if semver.Compare(apiVersionStr, kubeVersionStr) > 0 { + log.Printf("The following API:\n\"%s\" does not require mapping as the "+ + "API is not deprecated or removed in Kubernetes \"%s\"\n", m.DeprecatedAPI.APIVersion, kubeVersionStr) + // skip to next mapping + break docLoop + } + count++ + if m.NewAPI.APIVersion != "" { + doc["apiVersion"] = m.NewAPI.APIVersion + doc["kind"] = m.NewAPI.Kind + fmt.Println("modified: ", doc) + } else { + yamlDocs = append(yamlDocs[:idx], yamlDocs[idx+1:]...) + fmt.Println("deleted doc without replacement") + } } - if supportedAPI == "" { - log.Printf("Found %d instances of deprecated or removed Kubernetes API:\n\"%s\"\nNo supported API equivalent\n", count, deprecatedAPI) - modifiedManifest = removeDeprecatedAPIWithoutSuccessor(count, deprecatedAPI, modifiedManifest) + } + if count > 0 { + if m.NewAPI.APIVersion == "" { + log.Printf("Found %d instances of deprecated or removed Kubernetes API:\n\"%s\"\nNo supported API equivalent\n", + count, m.DeprecatedAPI.APIVersion) } else { - log.Printf("Found %d instances of deprecated or removed Kubernetes API:\n\"%s\"\nSupported API equivalent:\n\"%s\"\n", count, deprecatedAPI, supportedAPI) - modifiedManifest = strings.ReplaceAll(modifiedManifest, deprecatedAPI, supportedAPI) + log.Printf("Found %d instances of deprecated or removed Kubernetes API:\n\"%s\"\nSupported API equivalent:\n\"%s\"\n", + count, m.DeprecatedAPI.APIVersion, m.NewAPI.APIVersion) } } } - return modifiedManifest, nil -} - -// removeDeprecatedAPIWithoutSuccessor removes a deprecated API that has no successor specified in the mapping file. -func removeDeprecatedAPIWithoutSuccessor(count int, deprecatedAPI string, modifiedManifest string) string { - for repl := 0; repl < count; repl++ { - // find the position where the API header is - apiIndex := strings.Index(modifiedManifest, deprecatedAPI) - - // find the next separator index - separatorIndex := strings.Index(modifiedManifest[apiIndex:], "---\n") - - // find the previous separator index - previousSeparatorIndex := strings.LastIndex(modifiedManifest[:apiIndex], "---\n") - - /* - * if no previous separator index was found, it means the resource is at the beginning and not - * prefixed by --- - */ - if previousSeparatorIndex == -1 { - previousSeparatorIndex = 0 - } - - if separatorIndex == -1 { // this means we reached the end of input - modifiedManifest = modifiedManifest[:previousSeparatorIndex] - } else { - modifiedManifest = modifiedManifest[:previousSeparatorIndex] + modifiedManifest[separatorIndex+apiIndex:] - } - } - - modifiedManifest = strings.Trim(modifiedManifest, "\n") - return modifiedManifest + return EncodeYAML(yamlDocs) } func getKubernetesServerVersion(kubeConfig KubeConfig) (string, error) { diff --git a/pkg/common/common_test.go b/pkg/common/common_test.go index a5a7a9c..f5e2cf9 100644 --- a/pkg/common/common_test.go +++ b/pkg/common/common_test.go @@ -1,14 +1,10 @@ package common_test import ( - "bytes" - "github.com/helm/helm-mapkubeapis/pkg/common" - "github.com/helm/helm-mapkubeapis/pkg/mapping" - "github.com/pkg/errors" - "gopkg.in/yaml.v3" - "io" "testing" + "github.com/helm/helm-mapkubeapis/pkg/common" + "github.com/helm/helm-mapkubeapis/pkg/mapping" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" ) @@ -21,43 +17,49 @@ func TestCommon(t *testing.T) { // CheckDecode verifies that the passed YAML is parsing correctly // It doesn't check semantic correctness func CheckDecode(manifest string) error { - decoder := yaml.NewDecoder(bytes.NewBufferString(manifest)) - - for { - var value interface{} - - err := decoder.Decode(&value) - if errors.Is(err, io.EOF) { - break - } - - if err != nil { - return err - } - } - - return nil + _, err := common.ParseYAML(manifest) + return err } var _ = ginkgo.Describe("replacing deprecated APIs", ginkgo.Ordered, func() { var mapFile *mapping.Metadata - var deprecatedPodDisruptionBudget string - var newPodDisruptionBudget string + var deprecatedPodDisruptionBudget mapping.APIVersionKind + var newPodDisruptionBudget mapping.APIVersionKind - var deprecatedDeployment string - var newDeployment string + var deprecatedDeployment mapping.APIVersionKind + var newDeployment mapping.APIVersionKind - var deprecatedPodSecurityPolicy string + var deprecatedPodSecurityPolicy mapping.APIVersionKind ginkgo.BeforeAll(func() { - deprecatedPodDisruptionBudget = "apiVersion: policy/v1beta1\nkind: PodDisruptionBudget\n" - newPodDisruptionBudget = "apiVersion: policy/v1\nkind: PodDisruptionBudget\n" + // "apiVersion: policy/v1beta1\nkind: PodDisruptionBudget\n" + deprecatedPodDisruptionBudget = mapping.APIVersionKind{ + APIVersion: "policy/v1beta1", + Kind: "PodDisruptionBudget", + } + // "apiVersion: policy/v1\nkind: PodDisruptionBudget\n" + newPodDisruptionBudget = mapping.APIVersionKind{ + APIVersion: "policy/v1", + Kind: "PodDisruptionBudget", + } - deprecatedDeployment = "apiVersion: apps/v1beta2\nkind: Deployment\n" - newDeployment = "apiVersion: apps/v1\nkind: Deployment\n" + // "apiVersion: apps/v1beta2\nkind: Deployment\n" + deprecatedDeployment = mapping.APIVersionKind{ + APIVersion: "apps/v1beta2", + Kind: "Deployment", + } + // "apiVersion: apps/v1\nkind: Deployment\n" + newDeployment = mapping.APIVersionKind{ + APIVersion: "apps/v1", + Kind: "Deployment", + } - deprecatedPodSecurityPolicy = "apiVersion: policy/v1beta1\nkind: PodSecurityPolicy\n" + // "apiVersion: policy/v1beta1\nkind: PodSecurityPolicy\n" + deprecatedPodSecurityPolicy = mapping.APIVersionKind{ + APIVersion: "policy/v1beta1", + Kind: "PodSecurityPolicy", + } mapFile = &mapping.Metadata{ Mappings: []*mapping.Mapping{ @@ -111,8 +113,9 @@ metadata: spec: template: containers: - - name: test-container - image: test-image` + - image: test-image + name: test-container +` expectedResultingDeploymentManifest = `--- apiVersion: apps/v1 @@ -123,22 +126,25 @@ metadata: spec: template: containers: - - name: test-container - image: test-image` + - image: test-image + name: test-container +` podDisruptionBudgetManifest = `--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: name: pdb-test - namespace: test-ns` + namespace: test-ns +` expectedResultingPodDisruptionBudgetManifest = `--- apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: pdb-test - namespace: test-ns` + namespace: test-ns +` }) ginkgo.It("replaces deprecated resources with a new version in Kubernetes v1.25", func() { @@ -170,7 +176,8 @@ apiVersion: v1 kind: ServiceAccount metadata: name: test-sa - namespace: test-ns` + namespace: test-ns +` ginkgo.When("it is in the beginning of the manifest", func() { var podSecurityPolicyManifest = `--- @@ -189,13 +196,15 @@ apiVersion: v1 kind: ServiceAccount metadata: name: test-sa - namespace: test-ns` + namespace: test-ns +` ginkgo.It("removes the deprecated API manifest and leaves a valid YAML", func() { modifiedDeploymentManifest, err := common.ReplaceManifestData(mapFile, podSecurityPolicyManifest, kubeVersion125) gomega.Expect(err).ToNot(gomega.HaveOccurred()) - gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.APIVersion)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.Kind)) gomega.Expect(expectedResultManifest).To(gomega.Equal(expectedResultManifest)) err = CheckDecode(modifiedDeploymentManifest) @@ -220,13 +229,15 @@ metadata: apiVersion: policy/v1beta1 kind: PodSecurityPolicy metadata: - name: test-psp` + name: test-psp +` ginkgo.It("removes the deprecated API manifest and leaves a valid YAML", func() { modifiedDeploymentManifest, err := common.ReplaceManifestData(mapFile, podSecurityPolicyManifest, kubeVersion125) gomega.Expect(err).ToNot(gomega.HaveOccurred()) - gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.APIVersion)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.Kind)) gomega.Expect(modifiedDeploymentManifest).To(gomega.Equal(expectedResultManifest)) err = CheckDecode(modifiedDeploymentManifest) @@ -251,13 +262,15 @@ apiVersion: v1 kind: ServiceAccount metadata: name: test-sa - namespace: test-ns` + namespace: test-ns +` ginkgo.It("removes the deprecated API manifest and leaves a valid YAML", func() { modifiedDeploymentManifest, err := common.ReplaceManifestData(mapFile, podSecurityPolicyManifest, kubeVersion125) gomega.Expect(err).ToNot(gomega.HaveOccurred()) - gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.APIVersion)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.Kind)) gomega.Expect(modifiedDeploymentManifest).To(gomega.Equal(expectedResultManifest)) err = CheckDecode(modifiedDeploymentManifest) @@ -281,13 +294,15 @@ apiVersion: v1 kind: ServiceAccount metadata: name: test-sa - namespace: test-ns` + namespace: test-ns +` ginkgo.It("removes the deprecated API manifest and leaves a valid YAML", func() { modifiedDeploymentManifest, err := common.ReplaceManifestData(mapFile, podSecurityPolicyManifest, kubeVersion125) gomega.Expect(err).ToNot(gomega.HaveOccurred()) - gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.APIVersion)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.Kind)) gomega.Expect(modifiedDeploymentManifest).To(gomega.Equal(expectedResultManifest)) err = CheckDecode(modifiedDeploymentManifest) @@ -312,13 +327,15 @@ apiVersion: v1 kind: ServiceAccount metadata: name: test-sa - namespace: test-ns` + namespace: test-ns +` ginkgo.It("removes the deprecated API manifest and leaves a valid YAML", func() { modifiedDeploymentManifest, err := common.ReplaceManifestData(mapFile, podSecurityPolicyManifest, kubeVersion125) gomega.Expect(err).ToNot(gomega.HaveOccurred()) - gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.APIVersion)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.Kind)) gomega.Expect(modifiedDeploymentManifest).To(gomega.Equal(expectedResultManifest)) err = CheckDecode(modifiedDeploymentManifest) @@ -342,13 +359,15 @@ apiVersion: v1 kind: ServiceAccount metadata: name: test-sa - namespace: test-ns` + namespace: test-ns +` ginkgo.It("removes the deprecated API manifest and leaves a valid YAML", func() { modifiedDeploymentManifest, err := common.ReplaceManifestData(mapFile, podSecurityPolicyManifest, kubeVersion125) gomega.Expect(err).ToNot(gomega.HaveOccurred()) - gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.APIVersion)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.Kind)) gomega.Expect(modifiedDeploymentManifest).To(gomega.Equal(expectedResultManifest)) err = CheckDecode(modifiedDeploymentManifest) @@ -373,13 +392,15 @@ apiVersion: v1 kind: ServiceAccount metadata: name: test-sa - namespace: test-ns` + namespace: test-ns +` ginkgo.It("removes the deprecated API manifest and leaves a valid YAML", func() { modifiedDeploymentManifest, err := common.ReplaceManifestData(mapFile, podSecurityPolicyManifest, kubeVersion125) gomega.Expect(err).ToNot(gomega.HaveOccurred()) - gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.APIVersion)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.Kind)) gomega.Expect(modifiedDeploymentManifest).To(gomega.Equal(expectedResultManifest)) err = CheckDecode(modifiedDeploymentManifest) @@ -413,7 +434,8 @@ spec: modifiedDeploymentManifest, err := common.ReplaceManifestData(mapFile, podSecurityPolicyManifest, kubeVersion125) gomega.Expect(err).ToNot(gomega.HaveOccurred()) - gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.APIVersion)) + gomega.Expect(modifiedDeploymentManifest).ToNot(gomega.ContainSubstring(deprecatedPodSecurityPolicy.Kind)) gomega.Expect(modifiedDeploymentManifest).To(gomega.Equal(expectedResultManifest)) err = CheckDecode(modifiedDeploymentManifest) diff --git a/pkg/common/yaml.go b/pkg/common/yaml.go new file mode 100644 index 0000000..1b4e1a2 --- /dev/null +++ b/pkg/common/yaml.go @@ -0,0 +1,47 @@ +package common + +import ( + "io" + "strings" + + "github.com/pkg/errors" + "gopkg.in/yaml.v3" // for multi-doc support +) + +// GenericYAML represents generic YAML document +type GenericYAML map[string]any + +// ParseYAML parses a YAML string into a slice of GenericYAML documents +func ParseYAML(s string) ([]GenericYAML, error) { + decoder := yaml.NewDecoder(strings.NewReader(s)) + var docs []GenericYAML + for { + var y GenericYAML + err := decoder.Decode(&y) + if errors.Is(err, io.EOF) { + break + } + + if err != nil { + return nil, errors.Wrap(err, "Failed to decode YAML") + } + docs = append(docs, y) + } + return docs, nil +} + +// EncodeYAML encodes a slice of GenericYAML documents into a multi-doc YAML string +func EncodeYAML(docs []GenericYAML) (string, error) { + var sb strings.Builder + encoder := yaml.NewEncoder(&sb) + encoder.SetIndent(2) // match test cases + for _, doc := range docs { + if err := encoder.Encode(doc); err != nil { + return "", errors.Wrap(err, "Failed to encode document") + } + } + if err := encoder.Close(); err != nil { + return "", errors.Wrap(err, "Failed to close encoder") + } + return "---\n" + sb.String(), nil // always start with a document separator +} diff --git a/pkg/mapping/mapping.go b/pkg/mapping/mapping.go index 89a7f3a..3825d88 100644 --- a/pkg/mapping/mapping.go +++ b/pkg/mapping/mapping.go @@ -16,14 +16,21 @@ limitations under the License. package mapping +// APIVersionKind represents the common elements of a Kubernetes API resource. This is used +// for the Mapping.DeprecatedAPI and Mapping.NewAPI fields. +type APIVersionKind struct { + APIVersion string `json:"apiVersion"` + Kind string `json:"kind"` +} + // Mapping describes mappings which defines the Kubernetes // API deprecations and the new replacement API type Mapping struct { // From is the API looking to be mapped - DeprecatedAPI string `json:"deprecatedAPI"` + DeprecatedAPI APIVersionKind `json:"deprecatedAPI"` // To is the API to be mapped to - NewAPI string `json:"newAPI"` + NewAPI APIVersionKind `json:"newAPI"` // Kubernetes version API is deprecated in DeprecatedInVersion string `json:"deprecatedInVersion,omitempty"`