Skip to content

Instantly share code, notes, and snippets.

@diestrin
Created May 12, 2021 14:22
Show Gist options
  • Save diestrin/24d0408e62eacd1990ecdfb455a01246 to your computer and use it in GitHub Desktop.
Save diestrin/24d0408e62eacd1990ecdfb455a01246 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'rivendel-agent',
context: {
},
initial: 'checkK8sState',
states: {
checkK8sState: {
on: {
FAIL: 'reinstallBaseComponents',
SUCCESS: 'checkPreviousRegistration'
}
},
reinstallBaseComponents: {
on: {
SUCCESS: 'restartPods'
}
},
restartPods: {
on: {
SUCCESS: 'checkPreviousRegistration'
}
},
restartPods: {
on: {
SUCCESS: 'getNucSerialNum'
}
},
checkPreviousRegistration: {
on: {
FAIL: 'getNucSerialNum',
SUCCESS: 'checkForPreviousActivation'
}
},
getNucSerialNum: {
on: {
SERIAL_NUMBER: 'listenForCode'
}
},
listenForCode: {
on: {
CODE: 'checkClientCreds'
}
},
checkClientCreds: {
on: {
FAIL: 'generateKeycloakCreds',
SUCCESS: 'checkCertificatesValidity'
}
},
generateKeycloakCreds: {
on: {
SUCCESS: 'checkCertificatesValidity'
}
},
checkCertificatesValidity: {
on: {
FAIL: 'requestNewCertificates',
SUCCESS: 'pairK8sCluster'
}
},
requestNewCertificates: {
on: {
SUCCESS: 'pairK8sCluster'
}
},
pairK8sCluster: {
on: {
SUCCESS: 'notifyAragornNucStatus'
}
},
notifyAragornNucStatus: {
type: 'final'
},
checkForPreviousActivation: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment