Skip to content

Commit

Permalink
MGMT-12837: Add Shielded VMs configuration to gcp provider types
Browse files Browse the repository at this point in the history
  • Loading branch information
eranco74 committed Dec 6, 2022
1 parent f2fbb1d commit 0f5c063
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 21 deletions.
48 changes: 48 additions & 0 deletions machine/v1beta1/types_gcpprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ const (
RestartPolicyNever GCPRestartPolicyType = "Never"
)

type SecureBootPolicy string

const (
SecureBootPolicyEnable SecureBootPolicy = "Enabled"
SecureBootPolicyDisable SecureBootPolicy = "Disable"
)

type VTPMPolicy string

const (
VTPMPolicyEnable VTPMPolicy = "Enabled"
VTPMPolicyDisable VTPMPolicy = "Disable"
)

type IntegrityMonitoringPolicy string

const (
IntegrityMonitoringPolicyEnable IntegrityMonitoringPolicy = "Enabled"
IntegrityMonitoringPolicyDisable IntegrityMonitoringPolicy = "Disable"
)

// GCPMachineProviderSpec is the type that will be embedded in a Machine.Spec.ProviderSpec field
// for an GCP virtual machine. It is used by the GCP machine actuator to create a single Machine.
// Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
Expand Down Expand Up @@ -95,6 +116,10 @@ type GCPMachineProviderSpec struct {
// +kubebuilder:validation:Enum=Always;Never;
// +optional
RestartPolicy GCPRestartPolicyType `json:"restartPolicy,omitempty"`

// ShieldedInstanceConfig is the Shielded VM configuration for the VM
// +optional
ShieldedInstanceConfig GCPShieldedInstanceConfig `json:"shieldedInstanceConfig,omitempty"`
}

// GCPDisk describes disks for GCP.
Expand Down Expand Up @@ -201,3 +226,26 @@ type GCPMachineProviderStatus struct {
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// GCPShieldedInstanceConfig describes the shielded VM configuration of the instance on GCP.
// Shielded VM configuration allow users to enable and disable Secure Boot, vTPM, and Integrity Monitoring
type GCPShieldedInstanceConfig struct {
// SecureBoot Defines whether the instance should have secure boot enabled.
// Secure Boot verify the digital signature of all boot components, and halting the boot process if signature verification fails.
// If omitted, the platform chooses a default, which is subject to change over time, currently that default is Disabled.
// +optional
SecureBoot SecureBootPolicy `json:"secureBoot,omitempty"`

// VTPM enable virtualized trusted platform module measurements to create a known good boot integrity policy baseline.
// The integrity policy baseline is used for comparison with measurements from subsequent VM boots to determine if anything has changed.
// If omitted, the platform chooses a default, which is subject to change over time, currently that default is Enabled.
// +optional
VTPM VTPMPolicy `json:"vTPM,omitempty"`

// IntegrityMonitoring determines whether the instance should have integrity monitoring that verify the runtime boot integrity.
// Compares the most recent boot measurements to the integrity policy baseline and return
// a pair of pass/fail results depending on whether they match or not.
// If omitted, the platform chooses a default, which is subject to change over time, currently that default is Enabled.
// +optional
IntegrityMonitoring IntegrityMonitoringPolicy `json:"integrityMonitoring,omitempty"`
}
17 changes: 17 additions & 0 deletions machine/v1beta1/zz_generated.deepcopy.go

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

52 changes: 32 additions & 20 deletions machine/v1beta1/zz_generated.swagger_doc_generated.go

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

44 changes: 43 additions & 1 deletion openapi/generated_openapi/zz_generated.openapi.go

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

23 changes: 23 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -18349,6 +18349,11 @@
"$ref": "#/definitions/com.github.openshift.api.machine.v1beta1.GCPServiceAccount"
}
},
"shieldedInstanceConfig": {
"description": "ShieldedInstanceConfig is the Shielded VM configuration for the VM",
"default": {},
"$ref": "#/definitions/com.github.openshift.api.machine.v1beta1.GCPShieldedInstanceConfig"
},
"tags": {
"description": "Tags list of tags to apply to the VM.",
"type": "array",
Expand Down Expand Up @@ -18474,6 +18479,24 @@
}
}
},
"com.github.openshift.api.machine.v1beta1.GCPShieldedInstanceConfig": {
"description": "GCPShieldedInstanceConfig describes the shielded VM configuration of the instance on GCP. Shielded VM configuration allow users to enable and disable Secure Boot, vTPM, and Integrity Monitoring",
"type": "object",
"properties": {
"integrityMonitoring": {
"description": "IntegrityMonitoring determines whether the instance should have integrity monitoring that verify the runtime boot integrity. Compares the most recent boot measurements to the integrity policy baseline and return a pair of pass/fail results depending on whether they match or not. If omitted, the platform chooses a default, which is subject to change over time, currently that default is Enabled.",
"type": "string"
},
"secureBoot": {
"description": "SecureBoot Defines whether the instance should have secure boot enabled. Secure Boot verify the digital signature of all boot components, and halting the boot process if signature verification fails. If omitted, the platform chooses a default, which is subject to change over time, currently that default is Disabled.",
"type": "string"
},
"vTPM": {
"description": "VTPM enable virtualized trusted platform module measurements to create a known good boot integrity policy baseline. The integrity policy baseline is used for comparison with measurements from subsequent VM boots to determine if anything has changed. If omitted, the platform chooses a default, which is subject to change over time, currently that default is Enabled.",
"type": "string"
}
}
},
"com.github.openshift.api.machine.v1beta1.Image": {
"description": "Image is a mirror of azure sdk compute.ImageReference",
"type": "object",
Expand Down

0 comments on commit 0f5c063

Please sign in to comment.