-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix agentshift array case #33
Merged
Merged
Conversation
This file contains 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
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
ok, this now produces the following diff with before: @@ -1,5 +1,6 @@
use kube::CustomResource;
use serde::{Serialize, Deserialize};
+use std::collections::BTreeMap;
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug)]
#[kube(group = "agent-install.openshift.io", version = "v1beta1", kind = "Agent", plural = "agents")]
@@ -40,8 +41,8 @@
pub ntpSources: Vec<AgentStatusNtpSources>,
pub progress: Option<AgentStatusProgress>,
pub role: Option<String>,
- #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
- pub validationsInfo: BTreeMap<String, Array>,
+ #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
+ pub validationsInfo: BTreeMap<String, AgentStatusValidationsInfo>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
@@ -172,4 +173,11 @@
pub stageUpdateTime: Option<String>,
}
+#[derive(Serialize, Deserialize, Clone, Debug)]
+pub struct AgentStatusValidationsInfo {
+ pub id: String,
+ pub message: String,
+ pub status: String,
+}
+ |
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
I tested this PR and here's what it produces: use kube::CustomResource;
use serde::{Serialize, Deserialize};
use std::collections::BTreeMap;
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug)]
#[kube(group = "agent-install.openshift.io", version = "v1beta1", kind = "Agent", plural = "agents")]
#[kube(namespaced)]
#[kube(schema = "disabled")]
pub struct AgentSpec {
pub approved: bool,
pub clusterDeploymentName: Option<AgentClusterDeploymentName>,
pub hostname: Option<String>,
pub ignitionConfigOverrides: Option<String>,
pub installation_disk_id: Option<String>,
pub installerArgs: Option<String>,
pub machineConfigPool: Option<String>,
pub role: String,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentClusterDeploymentName {
pub name: Option<String>,
pub namespace: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatus {
pub bootstrap: Option<bool>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub conditions: Vec<AgentStatusConditions>,
pub debugInfo: Option<AgentStatusDebugInfo>,
pub hostname: Option<String>,
pub inventory: Option<AgentStatusInventory>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub ntpSources: Vec<AgentStatusNtpSources>,
pub progress: Option<AgentStatusProgress>,
pub role: Option<String>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub validationsInfo: BTreeMap<String, AgentStatusValidationsInfo>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusConditions {
pub lastHeartbeatTime: Option<String>,
pub lastTransitionTime: Option<String>,
pub message: Option<String>,
pub reason: Option<String>,
pub status: String,
pub r#type: String,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusDebugInfo {
pub eventsURL: Option<String>,
pub state: Option<String>,
pub stateInfo: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusInventory {
pub bmcAddress: Option<String>,
pub bmcV6Address: Option<String>,
pub boot: Option<AgentStatusInventoryBoot>,
pub cpu: Option<AgentStatusInventoryCpu>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub disks: Vec<AgentStatusInventoryDisks>,
pub hostname: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub interfaces: Vec<AgentStatusInventoryInterfaces>,
pub memory: Option<AgentStatusInventoryMemory>,
pub reportTime: Option<String>,
pub systemVendor: Option<AgentStatusInventorySystemVendor>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusInventoryBoot {
pub currentBootMode: Option<String>,
pub pxeInterface: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusInventoryCpu {
pub architecture: Option<String>,
pub clockMegahertz: Option<i64>,
pub count: Option<i64>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub flags: Vec<String>,
pub modelName: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusInventoryDisks {
pub bootable: Option<bool>,
pub byID: Option<String>,
pub byPath: Option<String>,
pub driveType: Option<String>,
pub hctl: Option<String>,
pub id: String,
pub installationEligibility: Option<AgentStatusInventoryDisksInstallationEligibility>,
pub ioPerf: Option<AgentStatusInventoryDisksIoPerf>,
pub model: Option<String>,
pub name: Option<String>,
pub path: Option<String>,
pub serial: Option<String>,
pub sizeBytes: Option<i64>,
pub smart: Option<String>,
pub vendor: Option<String>,
pub wwn: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusInventoryDisksInstallationEligibility {
pub eligible: Option<bool>,
pub notEligibleReasons: Vec<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusInventoryDisksIoPerf {
pub syncDurationMilliseconds: Option<i64>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusInventoryInterfaces {
pub biosDevName: Option<String>,
pub clientID: Option<String>,
pub flags: Vec<String>,
pub hasCarrier: Option<bool>,
pub ipV4Addresses: Vec<String>,
pub ipV6Addresses: Vec<String>,
pub macAddress: Option<String>,
pub mtu: Option<i64>,
pub name: Option<String>,
pub product: Option<String>,
pub speedMbps: Option<i64>,
pub vendor: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusInventoryMemory {
pub physicalBytes: Option<i64>,
pub usableBytes: Option<i64>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusInventorySystemVendor {
pub manufacturer: Option<String>,
pub productName: Option<String>,
pub serialNumber: Option<String>,
pub r#virtual: Option<bool>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusNtpSources {
pub sourceName: Option<String>,
pub sourceState: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusProgress {
pub currentStage: Option<String>,
pub progressInfo: Option<String>,
pub stageStartTime: Option<String>,
pub stageUpdateTime: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AgentStatusValidationsInfo {
pub id: String,
pub message: String,
pub status: String,
} Looks correct 👍 |
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
ultimately still not sure if this is truly the right way to deal with this type of schema substructures - the crd does not actually use these objects in its status. but at the very least we have a new test case and have improved up a bunch of things. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
it's a bit hairy, but it might work now. i don't have an agent instance with that struct filled so can't know for sure. see linked issue.