NOTE - this is a raw export of a google doc, and is really badly formatted, and has info scattered all over TODO - Clean this up and modularize it properly in markdown, and move action items into issues/projects here.
PowerShell.Next (PoSh 2.0) Project
Owner: Jon Kohler ([email protected])
**Dev Lead: **Alex Guo
**PM: **Tarak Parekh
GitHub: https://github.com/nutanix/PowerShell
JIRA: https://jira.nutanix.com/browse/FEAT-6441
- Deprecate existing cmdlets
-
User using PowerShell against Prism Central OR Prism Element
-
Prism Element will naturally have less functionality over time, as advanced features move into Prism Central
-
Maintaining PE compatibility will help with smaller environments, such as single cluster deployments
-
- Enhancements to existing cmdlets
PowerShell.Next @ Nutanix: https://jira.nutanix.com/browse/FEAT-6441
Requirements here also include the 'intent' of the requirement from a user’s perspective in italics.
-
Open source day 1
-
GitHub (private for now): https://github.com/nutanix/PowerShell
-
Rubrik and VMware have both open sourced / hosted their PowerShell cmdlet code on GitHub.
-
This does a lot of good things, including giving people access to submit engineering issues against this code right in GitHub, as well as contribute to the base via pull requests.
-
We should follow suit. Leveraging the power of the community could be huge here, and really help us step up our game against the competition.
-
-
We need to do this in PowerShell 6.0, which is written in .net core.
-
This will get us cross platform from day 1
-
GitHub Site is here - https://github.com/PowerShell/PowerShell
-
Covers: PM-1008 Make PowerShell cmdlets work on OSX / Linux
-
-
Need to be easy to develop against, i.e work within editors like Visual Studio code
- From Darren Woolard about existing cmdlets: I've installed the Nutanix cmdlets into my Win7 VM. All work and I can run commands. If I try an use an editor (to assist with debug, syntax highlighting, etc…) the cmdlets don’t appear to be registered. I’ve tried Powershell ISE (native) and a 3rd party tool called Powershell Plus (by Idera). I can see other 3rd party cmdlets shown in the editors but not ours.
-
PowerShell gallery installable
-
This would be similar to how others (like VMW) have done things, so that someone could do Install-Module -Name Nutanix.CLI
-
During development, we'll likely have to have an installable before we publish to the PowerShell gallery
-
Need to update Prism Element and Prism Central to point at gallery OR package a "mainline/stable" distro with the cluster for dark sites
-
Should be installable with "PowerShellGet"
-
-
Everything is a powershell module
-
Meaning, no snapins, no DLLs, no objects that need to be side loaded with a batch file.
-
We may be factoring different code trains into different modules where it makes sense, like Nutanix.CLI.Core, Nutanix.CLI.AFS, Nutanix.CLI.Calm, etc
-
-
Workflow support, such that cmdlets can be executed in parallel
-
PsCredential support, such that
- A service account running a script could authenticate without storing password in script
-
Publishing should be done under corporate gallery account
-
Figure out documentation push to portal
-
Documentation should be living within source code, and then should be scraped over to Portal, such that it appears as a traditional product doc
-
Think about "get-help for updates" - this in 2016? Would this get overridden by gallery updates? Or how would that interop
-
-
Template output support
- set-NTNXVMDisk -template | format-custom
-
Unit testing
-
Need PESTER support
-
Think about testing against virtual clusters
-
-
PowerShell winSSH support
- Wouldn't it be nice to wrapper NCLI/ACLI, such that you can just plumb stuff in that doesn’t have an API set yet
-
Comply with powershell publishing best practices
-
Use PSScriptAnalyzer
-
Include documentation and examples
-
Be responsive to feedback
-
Provide modules rather than scripts
-
Provide links to a project site
-
Include tests with your modules
-
Include and/or link to license terms
-
Sign your code
-
Follow SemVer guidelines for versioning
-
Use common tags, as documented in Common PowerShell Gallery tags
-
Test publishing using a local repository
-
-
Every cmdlet has a full get-help for all variables, flags, and commands
-
This needs to include one or more examples for every single cmdlet
-
Just a few points on functions vs cmdlets if you haven't seen it already: http://www.leeholmes.com/blog/2007/07/24/cmdlets-vs-functions/
-
-
Cmdlets are **extremely **easy to use.
-
For example, I should be able to make a VM with two cmdlets, with a "connect" statement, then a “new-vm” statement, that's it.
-
There may be other supporting things I need to do here, in general, like "get" network to plumb into net-vm.
-
All Powershell modules should report user friendly and actionable error messages (and not just "error occurred"). We can also consider adding -debug switch to all cmdlets which will show what API calls are used in background and API responses - that should simplify troubleshooting.
-
let's leverage Verbose and Debug information as appropriate
-
Need to have "WhatIf" flag - Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified (VMW definition)
-
Need to have RunAsync flag - Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object
- For some methods, this may require API changes, especially if we're going to have this be "Ergon centric"
-
-
Testability
-
We need full unit test / automated test coverage, which should be tested nightly or with new builds.
-
Build/test status should be surfaced in GitHub, so users know when code is solid
-
-
Cmdlets need to support pipelining and object references
-
Meaning I should be able, for example, to "get" a VLAN and then create a VM with that network referenced in the same pipeline.
-
Conversely, for example, I should be able to create a new network and then create a VM with that network referenced as an object
-
-
All cmdlets need to use approved verbs, with zero exceptions
-
Need to think through "collision" strategy for other providers.
-
For example, if we created "new-vm" that would colide/clobber with other vendors.
-
I'm not a huge fan of what we’re doing today with things like new-ntnxvm, as it just doesn’t feel right, so there has to be a middle ground. Perhaps there is a graceful way in powershell 6 to mediate this.
-
-
Need to leverage SDK, so that client side code is easy to extend and follows a repeatable pattern
-
Follow well accepted build and push standards
-
Need coverage for everything that has an API endpoint, within reason
-
Primary target should be prism central
-
as soon as any rest API Is out of tech preview we should have a powershell module for it
-
That means both VM/entity CRUD as well as "cluster" level CRUD for administrative options
-
Cmdlet mapping doc: https://docs.google.com/spreadsheets/d/1LUnXF7CApiaqjKMSYinDPWr2ycEaA9WOu83WJ4vwCfo/edit#gid=0
-
Should include typical things like DNS, NTP, SNMP, SMTP
- This ideally should be PC down, but likely we'll have to deal with PE directly too
-
Should also include things like role mapping / access control and local user management
-
Should also include private key management, such that a user could GET a certificate from their PKI, and push it to Nutanix with our cmdlets
-
Should be able to push upgrades via PoSh (for AOS, LCM, etc)
- NOTE: This may require API tweaks if our GUI is doing something sneaky
-
-
We should also be able to get statistics, for users who want to "poll" their clusters for reporting purposes.
-
Northern Trust already does something similar, but in reality, they'd want a more similar type of reporting like the vCheck report for VMW: http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/
-
Our PoSh needs to be able to enable this type of workflow
-
-
Cloud-init/sysprep scripts should be able to be passed through, for the cloud-init/sysprep workflow
- Calling this out, as historically this is tricky, given the are a big text file object
-
Within reason means that some API endpoints would naturally be wrapped up into a "workflow", so rather than a direct cmdlet for every single API cal, the API endpoint would be called as a byproduct of “meta” cmdlets.
-
Also we need to think through "mapping" of ACLI/NCLI/NuClei/etc cmds to PowerShell cmds. People are going to DEMAND full coverage. We may not be able to deliver that day 1, but note that any gaps WILL produce CFD's, guaranteed. We see that with our PoSh support today
-
Naturally, these need to support anything the API supports across the hypervisors we support.
-
NEED A generic REST API cmdlet
-
add a generic REST API cmdlet for anything that hans't been turned into a cmdlet yet
-
it would handle credentials and error codes from the API
-
you would give it a URL and a JSON as input
-
it would return the usual JSON as output
-
that way, we could easily access anything available in the REST API with minimal effort
-
ideally, it would handle multi page responses as well
-
also, thought of the generic REST method cmdlet
-
we could have a Get-PrismHelp command that would retrieve the same stuff the REST API Explorer shows
-
it could be used to get available endpoints, methods and required forms
-
then an Invoke-PrismRESTMethod (with -method, -json and -url) to use REST when a specific cmdlet isn't available yet
-
-
It would be also nice to have integration with creation of support cases (afaik this will be/was added to PC). Ideally it would require to pipe failing cmdlet to Create-NutanixCase, which will open new case and attach at least error message, API request/resonse and version info.
-
It would be good to have possibility to run NCC health checks and generate log bundles (same what we have in PE now) and upload them to FTP (or attach to case).
-
-
Need to think through how API mapping works
- It would be nice to have this translate through an SDK, but I know our SDK strategy is currently evolving
-
Need to think through debuggability and logging
-
Need to think through upgrades
-
Upgrades to PoSh code
-
Upgrades to AOS code
-
Handling "current level" PoSh with down level AOS - need to try hard to make sure this work, as this will be how enterprises deploy
-
-
Need to think how API traceability works
-
Quick and dirty thought would be to make the SDK's have a submission header against the Rest API, which then we could track as a click stream
-
This might require changes to the rest API
-
-
Need to think through how authentication will work
-
From a customer case:
-
"When connecting to PRISM (4.1.4) using PowerShell, we always have to specify the username and password. Even though we have AD Integration setup, we still need to specify the username and password. it would be nice if we could just SSO when connecting to Prism (like with VMware/PowerCLI, ...)"
-
Currently customer uses as, workaround, a text file with login/password (encrypted format) and use that to feed to the powershell script used to connect to the Prism.
-
-
-
Need to deprecate support for the in-build cmdlet code generation
-
(ideally) eventually scrub out all of those legacy references to clean up the gateway code.
-
This also means modifying "the button" in Prism that points to the cmdlet download, likely to just be a reference to download from the PoSh gallery
-
-
Barriers to Entry and Exit
-
Need to think through barriers in AND out of this module
-
Possible to align with other module schema, to make existing code portable in and out?
-
Need to map existing module cmdlets to make sure that general workflow gaps don't naturally occur
-
-
Documentation
-
Readme: See guidance below, and separate section with outline
-
MVP should be level three on the feed me read me maturity model or better
-
Level Three: Basic README
-
Some detailed information about the project's functionality, usefulness and purpose.
-
Basic installation, configuration, running details for users, tested and complete.
-
Basic documentation for potential contributors.
-
A vision statement or project roadmap for onboarding new contributors.
-
A Contributing.md/.rst file with basic information.
-
A line about the project's build status, but minimal: "under development" or "stable."
-
A line about the average response time to issues and/or pull requests.
-
At least one badge showing code coverage or other quality metrics.
-
Text updated at monthly or quarterly intervals, so inaccuracies may exist.
-
-
Documentation should be reviewed by documentation team, but should be in-line and self documenting wherever possible
-
If possible, pull syntax/documentation from API framework. This may drive us to improve/update documentation within framework; HOWEVER, we should not depend on this, especially in the context of the get-help workflows
-
Changelog:
-
How do we maintain changelog/release notes outside of existing RN cadence for production product
-
Likely should not be based on git commit log, as that will generate too much noise
-
-
Contributing guidelines:
- Need to get from Victor
-
License:
- MIT per victor
-
Issues
-
Need to provide template
-
Segue into supportability/support model
-
Likely need to look at portal.nutanix.com/GitHub integration
-
-
Samples (see separate section)
-
TOI (see separate section
-
-
TOI - Transfer of Information
-
Need to change up the way we do TOI's for Open Source products
-
My initial thought would be a similar TOI format to what we do internally, but instead, pre-record it and put it on YouTube, and just send out the link for people to watch OR do a "live session" like we do today, but instead record it and put it up on YouTube
-
-
Samples
-
Along the lines of the TOI, each TOI/module should be accompanied by functional samples.
-
We should have a samples directory right within the repo, that can be actively maintained by the community.
-
We should work with PowerShell SMEs internally to pre-populate this, with existing scripts that are refactored to support the new modules. This has the added benefit of really proving out functionality.
-
-
Supportability and Support Model
-
Will it be supported as AOS/PC? Or will it be community only support via forums (like CE)?
-
Users with support contracts on the equipment being interacted with can file portal tickets like usual
-
Alternatively, both paid users and community users are encouraged to submit github issues; however, github issues are best effort basis. For critical and time bound responses, please leverage portal.nutanix.com support models
-
development mainly on Community, also contributed to by a our developers, and integrate latest stable Community versions in AOS with major releases.
-
-
GitHub / Portal.nutanix.com integration?
-
Public facing JIRA project with GitHub integration?
-
Outward bound alias: [email protected]
-
Public slack channel:
-
-
Readme
-
Name and description
-
Make it immediately obvious what your project does at a high level.
-
Put a meaningful, short, plain-language description of what this project is trying to accomplish and why it matters. Describe the problem(s) this project solves. Describe how this software can improve the lives of its audience.
-
Other things to include:
-
Technology stack: Indicate the technological nature of the software, including primary programming language(s) and whether the software is intended as standalone or as a module in a framework or other ecosystem.
-
Status: Alpha, Beta, 1.1, etc. It's OK to write a sentence, too. The goal is to let interested people know where this project is at. This is also a good place to link to the CHANGELOG.
-
Links to production or demo instances
-
Describe what sets this apart from related-projects. Linking to another doc or page is OK if this can't be expressed in a sentence or two.
-
-
-
Badges
- On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
-
Features
- Let people know what your project can do specifically. If there is an alternative to your project, this is a good place to list differentiating factors.
-
Visuals
- Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
-
Requirements
- If your project only works in a certain context, it's important to be upfront about its requirements. Otherwise, someone may try to use your project, only to discover that it requires a certain version of a language or a particular operating system.
-
Installation
- Within a particular ecosystem, there may be a comman way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible.
-
Usage
55. Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providng links to more sophisticated examples if they are too long to reasonably include in the README.- Support
56. Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.- Development
57. For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. 58. You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.- Roadmap
59. If you have ideas for releases in the future, it is a good idea to list them in the README.- Contributing back
60. If you are open to contributions from others, let them know what your requirements are for accepting contributions.- Authors and acknowledgment
61. Show your appreciation to those who have contributed to the project, by listing them perhaps.- License
62. For open source projects, say how it is licensed.- Project status
63. If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.- STANDARD README
64. What do you want to name your module? 65. What is the description of this module? 66. Do have a banner image? 67. Where is the banner image? Ex: 'img/banner.png' 68. Do you want a TODO dropped where your badges should be? 69. Do you want a TODO dropped where your long description should be? 70. Do you need a prioritized security section? 71. Do you need a background section? 72. Do you need an API section? 73. What is the GitHub handle of the main maintainer? 74. Do you have a CONTRIBUTE.md file? 75. Are PRs accepted? 76. Is an MIT license OK? 77. What is your license? 78. Who is the License holder (probably your name)? 79. Use the current year? 80. What years would you like to specify?- Open Source readme
81. Dependencies 7. Describe any dependencies that must be installed for this software to work. This includes programming languages, databases or other storage mechanisms, build tools, frameworks, and so forth. If specific versions of other software are required, or known not to work, call that out. -
Zalando's README Template
-
https://github.com/zalando/zalando-howto-open-source/blob/master/READMEtemplate.md
-
Clear documentation is critical to the success of your project. This checklist is meant to help you cover all your bases. Not every section/subsection will be relevant to your project; pick and choose what is. Inspired by READMEs of very successful projects like etcd.
-
Please copy-paste this into a new document and save as you build your READMEs. For alternative formats, you might create a Structured README, which offers a thorough breakdown of optional README ingredients for you to consider. You might also take a look at this similar checklist; or check out art-of-readme.
-
Project Name/Intro
82. Describe very briefly but clearly what the project does. 83. State if it is out-of-the-box user-friendly, so it's clear to the user. 84. List its most useful/innovative/noteworthy features. 85. State its goals/what problem(s) it solves. 86. Note and briefly describe any key concepts (technical, philosophical, or both) important to the user's understanding. 87. Link to any supplementary blog posts or project main pages. 88. Note its development status. 89. Include badges. 90. If possible, include screenshots and demo videos.- Core Technical Concepts/Inspiration
91. Why does it exist? 92. Frame your project for the potential user. 93. Compare/contrast your project with other, similar projects so the user knows how it is different from those projects. 94. Highlight the technical concepts that your project demonstrates or supports. Keep it very brief. 95. Keep it useful.- Getting Started/Requirements/Prerequisites/Dependencies
96. Include any essential instructions for: 8. Getting it 9. Installing It 10. Configuring It 11. Running it- More Specific Topics (+ sample sub-categories)
97. Versioning: Services, APIs, Systems 98. Common Error Messages/related details 99. Tests- Contributing
100. Contributor Guidelines 101. Code Style/Requirements 102. Format for commit messages 103. Thank you (name contributors)- TODO
104. Next steps 105. Features planned 106. Known bugs (shortlist)- Contact
107. Email address 108. Google Group/mailing list (if applicable) 109. IRC or Slack (if applicable)- License
-
Beta Users
BKD - Brett, David, David
Marty @ Dell
JJ @ BBY
Comments to integrate from IVAN
Dear Nutanix Team, I've looked through the document and find it to be a very good start. I have a few comments and hope that you'll find them useful. I'll send them as separate messages as otherwise they look more like a blog post
In Section 7 you may want to also consider the future structure of the module, i.e.:
- Include everything into a single PSM1 file (one file to sign, however this may cause more merge conflicts going forward)
- Keep all the cmdlets in separate ps1 files (in sub-folder) and have some code in PSM1 to dot-source them all on load (less likely to get git merge conflicts, more files to sign)
- Keep all the cmdlets in separate ps1 files (in sub-folder) and combine them all into one huge PSM1 file at build time (less likely to get git merge conflicts, one file to sign, harder to match faulty lines of code based on error messages)
An ability to run cmdlets in asynchronously (section 9.f) is great. It would be really nice if there would also be a cmdlet (i.e. Wait-Task) that would allow waiting for one or all of the supplied tasks and Get-Task that would allow querying for additional details (i.e. Task Name, task details if there are any, task state, etc.) of the async tasks. That would allow making scripts that depend on long running async tasks be more responsive.
Are there any plans on the release cycle? i.e. release a new version of the module every time a new version of AOS/PS is out, or more frequently (i.e. once a month, etc.)?
As for Cmdlet name collisions (Section 13), generally there are two ways to avoid them:
• Prefix all the nouns with something, i.e. NTNX and not bother about collisions
• Pick common/familiar cmdlet names, and have users either rely on module-qualified names (https://www.sapien.com/blog/2015/10/23/using-module-qualified-cmdlet-names/) when there's a need to use several modules with identical cmdlet names or use -Prefix parameter of the Import-Module cmdlet to avoid collisions.
There doesn't seem to be any best practice established on this, as there are many good examples for both approaches:
With Prefix: Cisco PowerTool Module, MS System Center, Azure
Without Prefix: VMWare, Hyper-V
I personally like cmdlet names with prefix, since they require less typing and worrying less about collisions. Another argument for prefixing nouns is that when googling for New-NTNXVM you're more likely going to get Nutanix related results, as opposed to when searching for New-VM cmdlet.
NEED TO UPDATE FROM CAMS TEMPLATE
These should be considered standard P0 items for any new feature, how the feature integrates with the rest of the Nutanix ecosystem - where applicable.
-
Guardrails:
-
If a target cluster is less than AOS 5.0 then alert that the cluster cannot be used with LCM on PC
-
If a target cluster has an old LCM Framework (eg. LCM v1.0), do we need to ensure they are running the latest prior to any LCM on PC functions?
-
-
Logs: (what should be collected)
- LCM on PC should have unique logs separate from LCM on PE logs to differentiate between the two frameworks
-
PulseHD:
- Collect items from LCM on PC results such as: Last Run Status (ok/fail), Cumulative Run Counts, Pass/Fail counts, What scheduling interval used, time to complete inventory and updates (LCM run duration) per cluster
-
Panacea
- LCM logs needs to be in a format that Panacea can consume
-
_Upgrading and/or LCM integration: _
-
LCM in PC framework also needs the ability to upgrade itself
-
Ensure that any future upgrades of LCM on PC keeps the current scheduling and other settings as per the user's wishes
-
-
_Foundation: _
- LCM in PC to support upgrading CVM Foundation on PE
-
_NCC: _
- LCM team to write NCC checks for LCM in PC (what health aspects of LCM need to be monitored according to LCM Engg)
-
Serviceability:* *
-
LCM in PC must be self-updatable
-
Procedure for repairing/replacing corrupted or deleted LCM on PC files (re-install force option?) for SREs etc
-
-
Alerts:* *
-
LCM on PC is operational or not
-
LCM on PC unable to reach a PE cluster (eg state change) after a usable set time
-
Monitor Prism Central storage usage, eg alert when 75% full etc if PC hosts repo files
-
-
_QA Tests to be added : _
-
Failure Mode Effects and Analysis (FMEA)
- If LCM in PC fails, what are the effects on conducting upgrades on PE ? (Are the requirements that LCM in PC must be restored functional prior to PE upgrades?)
-
_Field Enablement / TOI training : _