From 0b7b4ac8e79b1cbacf47bcc7f16d1eb393cb1caa Mon Sep 17 00:00:00 2001 From: Jun Chen Date: Fri, 6 Sep 2024 12:06:37 -0400 Subject: [PATCH 1/2] build env update for linux on arm --- Dockerfile | 4 +- Makefile | 10 +- .../lca.openshift.io_imagebasedupgrades.yaml | 107 ++++++++++-------- .../lca.openshift.io_seedgenerators.yaml | 78 +++++++------ .../lca.openshift.io_imagebasedupgrades.yaml | 107 ++++++++++-------- .../lca.openshift.io_seedgenerators.yaml | 78 +++++++------ 6 files changed, 207 insertions(+), 177 deletions(-) diff --git a/Dockerfile b/Dockerfile index 427dc7c2e..b3c9c0c62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,8 +25,8 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod=vendor -a ##################################################################################################### # Build the operator image -# note: update origin-cli-artifacts from `latest` to an appropriate OCP verison during release e.g `4.18` -FROM quay.io/openshift/origin-cli-artifacts:latest AS origincli +# note: update origin-cli-artifacts from `latest` to an appropriate OCP verison during release e.g `4.17` +FROM --platform=linux/amd64 quay.io/openshift/origin-cli-artifacts:latest AS origincli FROM registry.access.redhat.com/ubi9/ubi-minimal:latest RUN if [[ ! -f /bin/nsenter ]]; then \ diff --git a/Makefile b/Makefile index 7c3c95a59..061290928 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:$(VERSION) IMG ?= $(IMAGE_TAG_BASE):$(VERSION) CONTROLLER_GEN = $(shell pwd)/bin/controller-gen -OPERATOR_SDK = $(shell pwd)/bin/x86_64/operator-sdk +OPERATOR_SDK = $(shell pwd)/bin/operator-sdk KUSTOMIZE = $(shell pwd)/bin/kustomize GOTESTSUM = $(shell pwd)/bin/gotestsum MOCK_GEN = $(shell pwd)/bin/mockgen @@ -80,7 +80,7 @@ generate-code: ## Generate code containing Clientset, Informers, Listers hack/update-codegen.sh controller-gen: ## Download controller-gen locally if necessary. - $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0) + $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0) mock-gen: ## Download mockgen locally if necessary. $(call go-get-tool,$(MOCK_GEN),go.uber.org/mock/mockgen@v0.3.0) @@ -147,7 +147,11 @@ OPERATOR_SDK_VERSION = $(shell $(OPERATOR_SDK) version 2>/dev/null | sed 's/^ope OPERATOR_SDK_VERSION_REQ = v1.28.0-ocp operator-sdk: ## Download operator-sdk locally if necessary. ifneq ($(OPERATOR_SDK_VERSION_REQ),$(OPERATOR_SDK_VERSION)) - curl -L https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/operator-sdk/4.13.11/operator-sdk-v1.28.0-ocp-linux-x86_64.tar.gz | tar -xz -C bin/ + @{ \ + set -e ;\ + OS=$(shell go env GOOS) && ARCH=$(shell arch) && if [ $${ARCH} == "arm64" ]; then ARCH=aarch64; fi; \ + curl -Lv https://mirror.openshift.com/pub/openshift-v4/$${ARCH}/clients/operator-sdk/4.13.11/operator-sdk-v1.28.0-ocp-$${OS}-$${ARCH}.tar.gz | tar --strip-components 2 -xz -C bin/ ;\ + } endif # go-get-tool will 'go get' any package $2 and install it to $1. diff --git a/bundle/manifests/lca.openshift.io_imagebasedupgrades.yaml b/bundle/manifests/lca.openshift.io_imagebasedupgrades.yaml index 355934b77..bc9bbfc6c 100644 --- a/bundle/manifests/lca.openshift.io_imagebasedupgrades.yaml +++ b/bundle/manifests/lca.openshift.io_imagebasedupgrades.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 creationTimestamp: null name: imagebasedupgrades.lca.openshift.io spec: @@ -35,14 +35,19 @@ spec: description: ImageBasedUpgrade is the Schema for the ImageBasedUpgrades API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -50,22 +55,22 @@ spec: description: ImageBasedUpgradeSpec defines the desired state of ImageBasedUpgrade properties: autoRollbackOnFailure: - description: AutoRollbackOnFailure defines automatic rollback settings - if the upgrade fails or if the upgrade does not complete within - the specified time limit. + description: |- + AutoRollbackOnFailure defines automatic rollback settings if the upgrade fails or if the upgrade does not + complete within the specified time limit. properties: initMonitorTimeoutSeconds: - description: InitMonitorTimeoutSeconds defines the time frame - in seconds. If not defined or set to 0, the default value of + description: |- + InitMonitorTimeoutSeconds defines the time frame in seconds. If not defined or set to 0, the default value of 1800 seconds (30 minutes) is used. minimum: 0 type: integer type: object extraManifests: - description: ExtraManifests defines the list of ConfigMap resources - that contain the user-specific extra manifests to be applied during - the upgrade post-pivot stage. Users can also add their custom catalog - sources that may want to retain after the upgrade. + description: |- + ExtraManifests defines the list of ConfigMap resources that contain the user-specific extra manifests to be + applied during the upgrade post-pivot stage. + Users can also add their custom catalog sources that may want to retain after the upgrade. items: description: ConfigMapRef defines a reference to a config map properties: @@ -133,42 +138,42 @@ spec: conditions: items: description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge - // +listType=map // +listMapKey=type Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -182,11 +187,12 @@ spec: - Unknown type: string type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -204,8 +210,9 @@ spec: items: properties: completionTime: - description: CompletionTime A timestamp indicating the Stage - completed. This is only available when a Stage completes successfully + description: |- + CompletionTime A timestamp indicating the Stage completed. + This is only available when a Stage completes successfully format: date-time type: string phases: @@ -214,9 +221,9 @@ spec: items: properties: completionTime: - description: CompletionTime A timestamp indicating the - phase completed. This is only available when a Phase - completes successfully + description: |- + CompletionTime A timestamp indicating the phase completed. + This is only available when a Phase completes successfully format: date-time type: string phase: diff --git a/bundle/manifests/lca.openshift.io_seedgenerators.yaml b/bundle/manifests/lca.openshift.io_seedgenerators.yaml index a0b14d006..2a74c8897 100644 --- a/bundle/manifests/lca.openshift.io_seedgenerators.yaml +++ b/bundle/manifests/lca.openshift.io_seedgenerators.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 creationTimestamp: null name: seedgenerators.lca.openshift.io spec: @@ -32,14 +32,19 @@ spec: description: SeedGenerator is the Schema for the seedgenerators API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -71,42 +76,42 @@ spec: conditions: items: description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge - // +listType=map // +listMapKey=type Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -120,11 +125,12 @@ spec: - Unknown type: string type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string diff --git a/config/crd/bases/lca.openshift.io_imagebasedupgrades.yaml b/config/crd/bases/lca.openshift.io_imagebasedupgrades.yaml index 161401193..57c3da763 100644 --- a/config/crd/bases/lca.openshift.io_imagebasedupgrades.yaml +++ b/config/crd/bases/lca.openshift.io_imagebasedupgrades.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: imagebasedupgrades.lca.openshift.io spec: group: lca.openshift.io @@ -35,14 +35,19 @@ spec: description: ImageBasedUpgrade is the Schema for the ImageBasedUpgrades API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -50,22 +55,22 @@ spec: description: ImageBasedUpgradeSpec defines the desired state of ImageBasedUpgrade properties: autoRollbackOnFailure: - description: AutoRollbackOnFailure defines automatic rollback settings - if the upgrade fails or if the upgrade does not complete within - the specified time limit. + description: |- + AutoRollbackOnFailure defines automatic rollback settings if the upgrade fails or if the upgrade does not + complete within the specified time limit. properties: initMonitorTimeoutSeconds: - description: InitMonitorTimeoutSeconds defines the time frame - in seconds. If not defined or set to 0, the default value of + description: |- + InitMonitorTimeoutSeconds defines the time frame in seconds. If not defined or set to 0, the default value of 1800 seconds (30 minutes) is used. minimum: 0 type: integer type: object extraManifests: - description: ExtraManifests defines the list of ConfigMap resources - that contain the user-specific extra manifests to be applied during - the upgrade post-pivot stage. Users can also add their custom catalog - sources that may want to retain after the upgrade. + description: |- + ExtraManifests defines the list of ConfigMap resources that contain the user-specific extra manifests to be + applied during the upgrade post-pivot stage. + Users can also add their custom catalog sources that may want to retain after the upgrade. items: description: ConfigMapRef defines a reference to a config map properties: @@ -133,42 +138,42 @@ spec: conditions: items: description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge - // +listType=map // +listMapKey=type Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -182,11 +187,12 @@ spec: - Unknown type: string type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -204,8 +210,9 @@ spec: items: properties: completionTime: - description: CompletionTime A timestamp indicating the Stage - completed. This is only available when a Stage completes successfully + description: |- + CompletionTime A timestamp indicating the Stage completed. + This is only available when a Stage completes successfully format: date-time type: string phases: @@ -214,9 +221,9 @@ spec: items: properties: completionTime: - description: CompletionTime A timestamp indicating the - phase completed. This is only available when a Phase - completes successfully + description: |- + CompletionTime A timestamp indicating the phase completed. + This is only available when a Phase completes successfully format: date-time type: string phase: diff --git a/config/crd/bases/lca.openshift.io_seedgenerators.yaml b/config/crd/bases/lca.openshift.io_seedgenerators.yaml index 2202b899c..578c4b662 100644 --- a/config/crd/bases/lca.openshift.io_seedgenerators.yaml +++ b/config/crd/bases/lca.openshift.io_seedgenerators.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: seedgenerators.lca.openshift.io spec: group: lca.openshift.io @@ -32,14 +32,19 @@ spec: description: SeedGenerator is the Schema for the seedgenerators API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -71,42 +76,42 @@ spec: conditions: items: description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge - // +listType=map // +listMapKey=type Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -120,11 +125,12 @@ spec: - Unknown type: string type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string From f3f16bd1c05499cf9dedecb7bc639cbae850caf9 Mon Sep 17 00:00:00 2001 From: Jun Chen Date: Tue, 1 Oct 2024 12:40:23 -0400 Subject: [PATCH 2/2] Skip precaching pull retry on unknown manifest and detect digests made up by CRIO image service --- internal/precache/workload/pullImages.go | 27 ++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/internal/precache/workload/pullImages.go b/internal/precache/workload/pullImages.go index b4db5cf45..8fcb0294f 100644 --- a/internal/precache/workload/pullImages.go +++ b/internal/precache/workload/pullImages.go @@ -20,6 +20,7 @@ import ( "fmt" "os" "strconv" + "strings" "sync" log "github.com/sirupsen/logrus" @@ -64,6 +65,15 @@ func podmanImgPull(image, authFile string) error { return nil } +func podmanImgExists(image string) bool { + args := []string{"image exists", image} + _, err := Executor.Execute("podman", args...) + if err != nil { + log.Errorf("failed podman image check with args %s: %v", args, err) + } + return err == nil +} + // pullImage attempts to pull an image via podman CLI func pullImage(image, authFile string, progress *precache.Progress) error { @@ -74,7 +84,11 @@ func pullImage(image, authFile string, progress *precache.Progress) error { log.Infof("Successfully pulled image: %s", image) break } else { - log.Infof("Attempt %d/%d: Failed to pull %s: %v", i+1, MaxRetries, image, err) + message := fmt.Sprintf("%v", err) + log.Infof("Attempt %d/%d: Failed to pull %s: %s", i+1, MaxRetries, image, message) + if strings.Contains(message, "manifest unknown") { + break + } } } // update precache progress tracker @@ -158,9 +172,18 @@ func PullImages(precacheSpec []string, authFile string) *precache.Progress { func ValidatePrecache(status *precache.Progress, bestEffort bool) error { // Check pre-caching execution status if status.Failed != 0 { + var imagesFound []string log.Info("Failed to pre-cache the following images:") for _, image := range status.FailedPullList { - log.Info(image) + if strings.Contains(image, "@sha:") && podmanImgExists(image) { + log.Infof("%s, but found locally after downloading other images", image) + imagesFound = append(imagesFound, image) + } else { + log.Info(image) + } + } + if len(imagesFound) == status.Failed { + return nil } if bestEffort { log.Info("Failed to precache, running in best-effort mode, skip error")