-
Notifications
You must be signed in to change notification settings - Fork 573
[WIP] AGENT-1330: machineconfiguration/v1alpha1: add InternalReleaseImage #2510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
andfasano
wants to merge
2
commits into
openshift:master
Choose a base branch
from
andfasano:add-internalreleaseimage-resource
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
machineconfiguration/v1alpha1/types_internalreleaseimage.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
machineosconfig "github.com/openshift/api/machineconfiguration/v1" | ||
) | ||
|
||
// +genclient | ||
// +genclient:nonNamespaced | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=internalreleaseimages,scope=Cluster | ||
// +kubebuilder:subresource:status | ||
// +openshift:api-approved.openshift.io=https://github.com/openshift/api/pull/2510 | ||
// +openshift:file-pattern=cvoRunLevel=0000_80,operatorName=machine-config,operatorOrdering=01 | ||
// +openshift:enable:FeatureGate=NoRegistryClusterOperations | ||
// +kubebuilder:metadata:labels=openshift.io/operator-managed= | ||
|
||
// InternalReleaseImage is used to keep track and manage a set | ||
// of release bundles (OCP and OLM operators images) that are stored | ||
// into the control planes nodes. | ||
// | ||
// Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. | ||
// +openshift:compatibility-gen:level=4 | ||
type InternalReleaseImage struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// metadata is the standard object's metadata. | ||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata | ||
// +optional | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// spec describes the configuration of this internal release image. | ||
// +required | ||
Spec InternalReleaseImageSpec `json:"spec,omitzero"` | ||
|
||
// status describes the last observed state of this internal release image. | ||
// +optional | ||
Status *InternalReleaseImageStatus `json:"status,omitempty"` | ||
} | ||
|
||
// InternalReleaseImageStatus describes the current state of a InternalReleaseImage. | ||
type InternalReleaseImageStatus struct { | ||
// conditions represent the observations of an internal release image current state. | ||
// +listType=map | ||
// +listMapKey=type | ||
// +kubebuilder:validation:MinItems=1 | ||
// +kubebuilder:validation:MaxItems=256 | ||
// +optional | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
|
||
// availableReleases is a list of release bundle identifiers currently detected | ||
// from the attached ISO. | ||
// +listType=map | ||
// +listMapKey=name | ||
// +kubebuilder:validation:MinItems=1 | ||
// +kubebuilder:validation:MaxItems=64 | ||
// +optional | ||
AvailableReleases []InternalReleaseImageRef `json:"availableReleases,omitempty"` | ||
|
||
// releases is a list of the currently managed release bundles. | ||
// +listType=map | ||
// +listMapKey=name | ||
// +kubebuilder:validation:MinItems=1 | ||
// +kubebuilder:validation:MaxItems=64 | ||
// +optional | ||
Releases []InternalReleaseImageRef `json:"releases,omitempty"` | ||
} | ||
|
||
// InternalReleaseImageSpec defines the desired state of a InternalReleaseImage. | ||
type InternalReleaseImageSpec struct { | ||
// releases is a list of release bundle identifiers that the user wants to | ||
// add/remove to/from the control plane nodes. | ||
// +kubebuilder:validation:MinItems=1 | ||
// +kubebuilder:validation:MaxItems=20 | ||
// +listType=map | ||
// +listMapKey=name | ||
// +required | ||
Releases []InternalReleaseImageRef `json:"releases,omitempty"` | ||
} | ||
|
||
type InternalReleaseImageRef struct { | ||
// name indicates the desired release bundle identifier. | ||
// +required | ||
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=64 | ||
Name string `json:"name,omitempty"` | ||
|
||
// image is an OCP release imaged referenced by digest. | ||
// The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>, | ||
// where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
// The length of the whole spec must be between 1 to 447 characters. | ||
// +optional | ||
Image machineosconfig.ImageDigestFormat `json:"image,omitempty"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// InternalReleaseImageList is a list of InternalReleaseImage resources | ||
// | ||
// Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. | ||
// +openshift:compatibility-gen:level=4 | ||
type InternalReleaseImageList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// metadata is the standard list's metadata. | ||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata | ||
metav1.ListMeta `json:"metadata"` | ||
|
||
Items []InternalReleaseImage `json:"items"` | ||
} |
235 changes: 235 additions & 0 deletions
235
...ed.crd-manifests/0000_80_machine-config_01_internalreleaseimages-CustomNoUpgrade.crd.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
api.openshift.io/merged-by-featuregates: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
release.openshift.io/feature-set: CustomNoUpgrade | ||
labels: | ||
openshift.io/operator-managed: "" | ||
name: internalreleaseimages.machineconfiguration.openshift.io | ||
spec: | ||
group: machineconfiguration.openshift.io | ||
names: | ||
kind: InternalReleaseImage | ||
listKind: InternalReleaseImageList | ||
plural: internalreleaseimages | ||
singular: internalreleaseimage | ||
scope: Cluster | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: |- | ||
InternalReleaseImage is used to keep track and manage a set | ||
of release bundles (OCP and OLM operators images) that are stored | ||
into the control planes nodes. | ||
|
||
Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. | ||
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 | ||
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 | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: spec describes the configuration of this internal release | ||
image. | ||
properties: | ||
releases: | ||
description: |- | ||
releases is a list of release bundle identifiers that the user wants to | ||
add/remove to/from the control plane nodes. | ||
items: | ||
properties: | ||
image: | ||
description: |- | ||
image is an OCP release imaged referenced by digest. | ||
The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>, | ||
where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
The length of the whole spec must be between 1 to 447 characters. | ||
maxLength: 447 | ||
minLength: 1 | ||
type: string | ||
x-kubernetes-validations: | ||
- message: the OCI Image reference must end with a valid '@sha256:<digest>' | ||
suffix, where '<digest>' is 64 characters long | ||
rule: (self.split('@').size() == 2 && self.split('@')[1].matches('^sha256:[a-f0-9]{64}$')) | ||
- message: the OCI Image name should follow the host[:port][/namespace]/name | ||
format, resembling a valid URL without the scheme | ||
rule: (self.split('@')[0].matches('^([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$')) | ||
name: | ||
description: name indicates the desired release bundle identifier. | ||
maxLength: 64 | ||
minLength: 1 | ||
type: string | ||
required: | ||
- name | ||
type: object | ||
maxItems: 20 | ||
minItems: 1 | ||
type: array | ||
x-kubernetes-list-map-keys: | ||
- name | ||
x-kubernetes-list-type: map | ||
required: | ||
- releases | ||
type: object | ||
status: | ||
description: status describes the last observed state of this internal | ||
release image. | ||
properties: | ||
availableReleases: | ||
description: |- | ||
availableReleases is a list of release bundle identifiers currently detected | ||
from the attached ISO. | ||
items: | ||
properties: | ||
image: | ||
description: |- | ||
image is an OCP release imaged referenced by digest. | ||
The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>, | ||
where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
The length of the whole spec must be between 1 to 447 characters. | ||
maxLength: 447 | ||
minLength: 1 | ||
type: string | ||
x-kubernetes-validations: | ||
- message: the OCI Image reference must end with a valid '@sha256:<digest>' | ||
suffix, where '<digest>' is 64 characters long | ||
rule: (self.split('@').size() == 2 && self.split('@')[1].matches('^sha256:[a-f0-9]{64}$')) | ||
- message: the OCI Image name should follow the host[:port][/namespace]/name | ||
format, resembling a valid URL without the scheme | ||
rule: (self.split('@')[0].matches('^([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$')) | ||
name: | ||
description: name indicates the desired release bundle identifier. | ||
maxLength: 64 | ||
minLength: 1 | ||
type: string | ||
required: | ||
- name | ||
type: object | ||
maxItems: 64 | ||
minItems: 1 | ||
type: array | ||
x-kubernetes-list-map-keys: | ||
- name | ||
x-kubernetes-list-type: map | ||
conditions: | ||
description: conditions represent the observations of an internal | ||
release image current state. | ||
items: | ||
description: Condition contains details for one aspect of the current | ||
state of this API Resource. | ||
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. | ||
format: date-time | ||
type: string | ||
message: | ||
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. | ||
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. | ||
This field may not be empty. | ||
maxLength: 1024 | ||
minLength: 1 | ||
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ | ||
type: string | ||
status: | ||
description: status of the condition, one of True, False, Unknown. | ||
enum: | ||
- "True" | ||
- "False" | ||
- Unknown | ||
type: string | ||
type: | ||
description: type of condition in CamelCase or in foo.example.com/CamelCase. | ||
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 | ||
required: | ||
- lastTransitionTime | ||
- message | ||
- reason | ||
- status | ||
- type | ||
type: object | ||
maxItems: 256 | ||
minItems: 1 | ||
type: array | ||
x-kubernetes-list-map-keys: | ||
- type | ||
x-kubernetes-list-type: map | ||
releases: | ||
description: releases is a list of the currently managed release bundles. | ||
items: | ||
properties: | ||
image: | ||
description: |- | ||
image is an OCP release imaged referenced by digest. | ||
The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>, | ||
where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9. | ||
The length of the whole spec must be between 1 to 447 characters. | ||
maxLength: 447 | ||
minLength: 1 | ||
type: string | ||
x-kubernetes-validations: | ||
- message: the OCI Image reference must end with a valid '@sha256:<digest>' | ||
suffix, where '<digest>' is 64 characters long | ||
rule: (self.split('@').size() == 2 && self.split('@')[1].matches('^sha256:[a-f0-9]{64}$')) | ||
- message: the OCI Image name should follow the host[:port][/namespace]/name | ||
format, resembling a valid URL without the scheme | ||
rule: (self.split('@')[0].matches('^([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$')) | ||
name: | ||
description: name indicates the desired release bundle identifier. | ||
maxLength: 64 | ||
minLength: 1 | ||
type: string | ||
required: | ||
- name | ||
type: object | ||
maxItems: 64 | ||
minItems: 1 | ||
type: array | ||
x-kubernetes-list-map-keys: | ||
- name | ||
x-kubernetes-list-type: map | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhmm, I think I had a similar situation in the Irreconciable changes feature and I was told to set a MinItems to 1 as a nil/null value of this field should be allowed to be pushed to the API.