Package: hyper-kube-config
hyper-kube-confighyper-kube-config - Provides a secureServerlessAPI to store and retrieveKubernetes cluster config credentials. hyper-kube-config leveragesAWS Secrets Managerfor storing credential information. Included is akubectl pluginto interface with hyperkube API.You can also set cluster's status and retrieve this information. Useful in CI/CD pipelines when trying to pull access to particular cluters without needing to know their names, just their environments.It requires a configuration file. Seehyperkube-config.yaml.examplefor layout.Install hyperkube kubectl pluginpip3installhyper-kube-configSetup~/hyperkube-config.yamlfileThe default locations for the config file is~/hyperkube-config.yaml. You can also place the config file at a different location and pass the location as a command line option-c <hyper-kube-config-location>or--config <hyper-kube-config-location>Post cluster and creds to hyperkube storekubectlhyperkubeadd--k8s-config~/.kube/configRemove cluster and credskubectlhyperkuberemove--cluster-to-remove'k8s-cluster-example.cloud'Get user creds and merge it with existing~/.kube/config# for single clusterkubectlhyperkubeget--clustercloud-infra.cloud-mGet user creds multiple clusters and merge them with existing~/.kube/configkubectlhyperkubeget\--clustercloud-infra.cloud\--clusterbar-cluster.cloud\--clusterbaz-cluster.com-mGet creds for all clusters and merge it with existing~/.kube/configkubectlhyperkubeget-all-mList clusterskubectlhyperkubelistStore and Associate SSH PEM and CA private key with ClusterStore SSH Pemkubectlhyperkubeadd-pem--pem~/.ssh/my-cluster.pemGet Stored SSH Pemkubectlhyperkubeget-pem--clustermy-cluster.netStore Add CA Private Keykubectlhyperkubeadd-ca-key--ca-keyca-key-file.key--clusermy-cluster.netSet Cluster Status and/or Environment References# Set arbitrary status string and environment reference for given clusterkubectlhyperkubeset-cluster-status--clustermy-cluster.net--statusactive--environmentstageGet Cluster Status for Environment# Returns list of clusters that are active for prod environmentkubectlhyperkubeget-cluster-status--statusactive--environmentprodRequirementsServerless- Serverless Frameworkserverless-python-requirementsplugin. Uses Docker and Pip to package a newer vesion of Boto3 for AWS Lambda function use. AWS Lambda boto3 version by default doesn't have AWS Secrets Manager support for tags.click- for hyperkube kubectl pluginkubectl- version 1.12 or higher recommended for stable plugin support.Deploying Serverless APIChoose authentication methodAPI KeyExample Serverless Config for API Key AuthenticationThis config should work out of the box. Feel free to copy to serverless.yml and deployIAM AuthenticationExample Serverless Config for IAM AuthenticationThis configuration will require you to add IAM roles to the allowed principal section. These roles are managed outside the scope of this project.See the section that has:resourcePolicy:
    - Effect: Allow
      Principal:
        AWS:
          - arn:aws:iam::{{otherAWSAccountID}}:root
          - arn:aws:iam::{{otherAWSAccountID}}:user/{{otherAWSUserName}}
          - arn:aws:iam::{{otherAWSAccountID}}:role/{{otherAWSRoleName}}replace with your roles you would like to grant access.sls deploymentpipenvinstall
pipenvshell
slsdeploy\--stagedev\--productk8s\--ownermyteam@foo.cloud\--teammyteam\--environmentdevThis will launch your hyperkube API. Capture the API URL, api key and stage for your hyperkube.yaml configuration. Thekubectl hyperkubecommands will leverage the config to interact with your stored k8s configs.Serverless will launch anAWS API Gatewayto handle API requests forwardered toAWS Lambda functions. A Dynamodb table is configured to store non-senstative cluster config details, while sensative information in uploaded configs (passwords and certs) is stored inAWS Secrets Manager.Testing for lint errors on your local machineInstall Test Dependenciespip install -U -r tests/requirements.txtRun flake8 to check for lint errorsflake8 *.py tests cli/kubectl-hyperkubeRun unit testspython -m unittest discover -s tests/ -p "*.py"