Skip to content

Commit

Permalink
Merge pull request #169 from abays/detect_checksum_name
Browse files Browse the repository at this point in the history
[OSPRH-6951] Auto-detect OSImage checksum name and type
  • Loading branch information
openshift-merge-bot[bot] authored Aug 21, 2024
2 parents 8a0f365 + 659c030 commit b67f782
Show file tree
Hide file tree
Showing 19 changed files with 546 additions and 76 deletions.
26 changes: 26 additions & 0 deletions api/bases/baremetal.openstack.org_openstackprovisionservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,20 @@ spec:
osImage:
description: OSImage - OS qcow2 image (compressed as gz, or uncompressed)
type: string
osImageDir:
default: /usr/local/apache2/htdocs
description: OSImageDir - Directory on the container which holds the
OS qcow2 image and checksum
type: string
port:
description: Port - The port on which the Apache server should listen
format: int32
type: integer
preserveJobs:
default: false
description: PreserveJobs - do not delete jobs after they finished
e.g. to check logs
type: boolean
resources:
description: Resources - Compute Resources required by this provision
server (Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down Expand Up @@ -132,6 +142,7 @@ spec:
- apacheImageUrl
- osContainerImageUrl
- osImage
- osImageDir
- port
type: object
status:
Expand Down Expand Up @@ -186,9 +197,24 @@ spec:
type: string
description: Map of hashes to track e.g. job status
type: object
localImageChecksumUrl:
description: URL of provisioning image checksum on underlying Apache
web server
type: string
localImageUrl:
description: URL of provisioning image on underlying Apache web server
type: string
osImageChecksumFilename:
description: Filename of OSImage checksum
type: string
osImageChecksumType:
description: OSImage checksum type
enum:
- md5
- sha256
- sha512
- auto
type: string
provisionIp:
description: IP of the provisioning interface on the node running
the ProvisionServer pod
Expand Down
18 changes: 18 additions & 0 deletions api/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const (
// OpenStackProvisionServerLocalImageURLReadyCondition Status=True condition which indicates if the OpenStackProvisionServer's LocalImageURL has been successfully acquired from the provisioning agent
OpenStackProvisionServerLocalImageURLReadyCondition condition.Type = "OpenStackProvisionServerLocalImageURLReady"

// OpenStackProvisionServerChecksumReadyCondition Status=True condition which indicates if the OpenStackProvisionServer's OSImage Checksum has been successfully acquired from the provisioning agent
OpenStackProvisionServerChecksumReadyCondition condition.Type = "OpenStackProvisionServerChecksumReady"

//
// OpenStackBaremetalSet conditions
//
Expand Down Expand Up @@ -87,6 +90,21 @@ const (
// OpenStackProvisionServerLocalImageURLReadyMessage
OpenStackProvisionServerLocalImageURLReadyMessage = "OpenStackProvisionServerLocalImageURL generated"

//
// OpenStackProvisionServerChecksumReady condition messages
//
// OpenStackProvisionServerChecksumReadyInitMessage
OpenStackProvisionServerChecksumReadyInitMessage = "OpenStackProvisionServerChecksum not started"

// OpenStackProvisionServerChecksumReadyErrorMessage
OpenStackProvisionServerChecksumReadyErrorMessage = "OpenStackProvisionServerChecksum error occured %s"

// OpenStackProvisionServerChecksumReadyRunningMessage
OpenStackProvisionServerChecksumReadyRunningMessage = "OpenStackProvisionServerChecksum acquisition in progress"

// OpenStackProvisionServerChecksumReadyMessage
OpenStackProvisionServerChecksumReadyMessage = "OpenStackProvisionServerChecksum acquired"

//
// OpenStackBaremetalSetReady condition messages
//
Expand Down
19 changes: 18 additions & 1 deletion api/v1beta1/openstackprovisionserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1beta1

import (
metal3v1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
corev1 "k8s.io/api/core/v1"
Expand All @@ -27,11 +28,13 @@ import (
// +kubebuilder:validation:Enum=Managed;Unmanaged;Disabled
type ProvisioningNetwork string

// ProvisioningNetwork modes
const (
// ProvisioningNetwork modes
ProvisioningNetworkManaged ProvisioningNetwork = "Managed"
ProvisioningNetworkUnmanaged ProvisioningNetwork = "Unmanaged"
ProvisioningNetworkDisabled ProvisioningNetwork = "Disabled"
// Checksum job hash
ChecksumHash = "checksum"
)

const (
Expand All @@ -54,6 +57,10 @@ type OpenStackProvisionServerSpec struct {
Interface string `json:"interface,omitempty"`
// OSImage - OS qcow2 image (compressed as gz, or uncompressed)
OSImage string `json:"osImage"`
// +kubebuilder:validation:Required
// +kubebuilder:default=/usr/local/apache2/htdocs
// OSImageDir - Directory on the container which holds the OS qcow2 image and checksum
OSImageDir *string `json:"osImageDir"`
// OSContainerImageURL - Container image URL for init with the OS qcow2 image (osImage)
OSContainerImageURL string `json:"osContainerImageUrl"`
// ApacheImageURL - Container image URL for the main container that serves the downloaded OS qcow2 image (osImage)
Expand All @@ -67,6 +74,10 @@ type OpenStackProvisionServerSpec struct {
// Resources - Compute Resources required by this provision server (Limits/Requests).
// https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// PreserveJobs - do not delete jobs after they finished e.g. to check logs
PreserveJobs bool `json:"preserveJobs"`
}

// OpenStackProvisionServerStatus defines the observed state of OpenStackProvisionServer
Expand All @@ -81,6 +92,12 @@ type OpenStackProvisionServerStatus struct {
ProvisionIP string `json:"provisionIp,omitempty"`
// URL of provisioning image on underlying Apache web server
LocalImageURL string `json:"localImageUrl,omitempty"`
// Filename of OSImage checksum
OSImageChecksumFilename string `json:"osImageChecksumFilename,omitempty"`
// OSImage checksum type
OSImageChecksumType metal3v1.ChecksumType `json:"osImageChecksumType,omitempty"`
// URL of provisioning image checksum on underlying Apache web server
LocalImageChecksumURL string `json:"localImageChecksumUrl,omitempty"`
}

// IsReady - returns true if OpenStackProvisionServer is reconciled successfully
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,20 @@ spec:
osImage:
description: OSImage - OS qcow2 image (compressed as gz, or uncompressed)
type: string
osImageDir:
default: /usr/local/apache2/htdocs
description: OSImageDir - Directory on the container which holds the
OS qcow2 image and checksum
type: string
port:
description: Port - The port on which the Apache server should listen
format: int32
type: integer
preserveJobs:
default: false
description: PreserveJobs - do not delete jobs after they finished
e.g. to check logs
type: boolean
resources:
description: Resources - Compute Resources required by this provision
server (Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down Expand Up @@ -132,6 +142,7 @@ spec:
- apacheImageUrl
- osContainerImageUrl
- osImage
- osImageDir
- port
type: object
status:
Expand Down Expand Up @@ -186,9 +197,24 @@ spec:
type: string
description: Map of hashes to track e.g. job status
type: object
localImageChecksumUrl:
description: URL of provisioning image checksum on underlying Apache
web server
type: string
localImageUrl:
description: URL of provisioning image on underlying Apache web server
type: string
osImageChecksumFilename:
description: Filename of OSImage checksum
type: string
osImageChecksumType:
description: OSImage checksum type
enum:
- md5
- sha256
- sha512
- auto
type: string
provisionIp:
description: IP of the provisioning interface on the node running
the ProvisionServer pod
Expand Down
3 changes: 2 additions & 1 deletion config/default/manager_default_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ spec:
- name: RELATED_IMAGE_OS_CONTAINER_IMAGE_URL_DEFAULT
value: quay.io/podified-antelope-centos9/edpm-hardened-uefi:current-podified
- name: RELATED_IMAGE_AGENT_IMAGE_URL_DEFAULT
value: quay.io/openstack-k8s-operators/openstack-baremetal-operator-agent:latest
# FIXME: REMOVE before merging
value: quay.io/andrewbays/openstack-baremetal-operator-agent:v0.0.1
- name: RELATED_IMAGE_APACHE_IMAGE_URL_DEFAULT
value: registry.redhat.io/ubi9/httpd-24:latest
- name: OS_IMAGE_DEFAULT
Expand Down
12 changes: 12 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ rules:
- list
- patch
- update
- apiGroups:
- batch
resources:
- jobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand Down
Loading

0 comments on commit b67f782

Please sign in to comment.