Go-for-DevOps

module
v0.0.0-...-3736fb9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2023 License: MIT

README

Go for DevOps

Go for DevOps

This is the code repository for Go for DevOps, published by Packt.

Learn how to use the Go language to automate servers, the cloud, Kubernetes, GitHub, Packer, and Terraform

What is this book about?

Go is the go-to language for DevOps libraries and services, and without it, achieving fast and safe automation is a challenge. With the help of Go for DevOps, you'll learn how to deliver services with ease and safety, becoming a better DevOps engineer in the process.

This book covers the following exciting features:

  • Understand the basic structure of the Go language to begin your DevOps journey
  • Interact with filesystems to read or stream data
  • Communicate with remote services via REST and gRPC
  • Explore writing tools that can be used in the DevOps environment
  • Develop command-line operational software in Go
  • Work with popular frameworks to deploy production software
  • Create GitHub actions that streamline your CI/CD process
  • Write a ChatOps application with Slack to simplify production visibility

If you feel this book is for you, get your copy today!

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

packer {
 required_plugins {
 amazon = {
 version = ">= 0.0.1"

Following is what you need for this book: This book is for Ops and DevOps engineers who would like to use Go to develop their own DevOps tooling or integrate custom features with DevOps tools such as Kubernetes, GitHub Actions, HashiCorp Packer, and Terraform. Experience with some type of programming language, but not necessarily Go, is necessary to get started with this book.

With the following software and hardware list you can run all code files present in the book (Chapter 1-16).

Software and Hardware List
Chapter Software required OS required
1-16 Go 1.18 Windows, Mac OS X, and Linux (Any)
1-16 Packer Windows, Mac OS X, and Linux (Any)
1-16 Terraform Windows, Mac OS X, and Linux (Any)
1-16 Kubernetes Windows, Mac OS X, and Linux (Any)
1-16 Docker Windows, Mac OS X, and Linux (Any)
1-16 Tilt Windows, Mac OS X, and Linux (Any)
1-16 Protocol Buffers Windows, Mac OS X, and Linux (Any)
1-16 gPRC,ctlptl Windows, Mac OS X, and Linux (Any)
1-16 But CLI Windows, Mac OS X, and Linux (Any)
1-16 Operator SDK Windows, Mac OS X, and Linux (Any)
1-16 Azure CLI, KinD Windows, Mac OS X, and Linux (Any)

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Errata

  • Page xxi (Under to get the most out of this book): gPRC(https://grpc.io) should be gRPC(https://grpc.io)
  • Page 29 (Under Returning multiple values and named results): func divide(num, div int) (res, rem int) { result = num / div remainder = num % div return res, rem } should be func divide(num, div int) (res, rem int) {res = num / div rem = num % div return res, rem }

Get to Know the Authors

John Doak is the principal manager of Layer 1 Reliability Engineering at Microsoft. John led the development of the Azure Data Explorer and Microsoft Authentication Library Go SDKs. Previously, he was a Staff Site Reliability Engineer at Google. As part of network engineering, he created many of their first network automation systems. John led the migration of that group from Python to Go, developing Go training classes that have been taught around the world. He was a pivotal figure in transforming the network team to a network/systems group that integrated with SRE. Prior to that, he worked for Lucasfilm in video games and film. You can find his musings on Go/SRE topics and his Go classes on the web.

David Justice is the principal software engineer lead for the Azure K8s infrastructure and Steel Thread teams, which maintain a variety of CNCF and Bytecode Alliance projects. He is a maintainer of the Cluster API Provider Azure and a contributor to the Cluster API. Prior to that, David was the technical assistant to the Azure CTO, where he was responsible for Azure cross-group technical strategy and architecture. Early on at Microsoft, he was a program manager leading Azure SDKs and CLIs, where he transitioned all Azure services to describe them using OpenAPI specifications in GitHub and established automations to generate Azure reference docs, SDKs, and CLIs. Prior to working at Microsoft, David was the CTO of a mobile CI/CD SaaS called CISimple.

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781801818896

Directories

Path Synopsis
chapter
11/chatbot/bot
Package bot defines a basic slack bot that can listen for app mention events for our bot and send the message to a handler to handle the interaction.
Package bot defines a basic slack bot that can listen for app mention events for our bot and send the message to a handler to handle the interaction.
11/chatbot/internal/handlers
Package handlers provides an Ops type that has methods that implement bot.HandleFunc for various commands that could be sent to a bot.
Package handlers provides an Ops type that has methods that implement bot.HandleFunc for various commands that could be sent to a bot.
11/ops/internal/jaeger/client
Package client provides a Jaegar client for grabbing traces from the Jaegar service.
Package client provides a Jaegar client for grabbing traces from the Jaegar service.
11/ops/internal/server
Package server contains our gRPC server implementation for the ops server.
Package server contains our gRPC server implementation for the ops server.
16/workflow/client
Package client provides access to the workflow service.
Package client provides access to the workflow service.
16/workflow/data/packages/sites
Package sites contains types, functions and methods for reading and interpreting data about sites contained in data files sites.json and machines.json
Package sites contains types, functions and methods for reading and interpreting data about sites contained in data files sites.json and machines.json
16/workflow/internal/es
Package es contains an emergency stop implementation.
Package es contains an emergency stop implementation.
16/workflow/internal/policy
Package policy provides policy primatives, policy registration and functions to run policies against a WorkReq that is submitted to the system.
Package policy provides policy primatives, policy registration and functions to run policies against a WorkReq that is submitted to the system.
16/workflow/internal/policy/config
Package config stores the policy configuration Go representation, a global variable called Policies that is for reading the Config as it is updated on disk and configuration validation to make sure errors don't slip in to the Config.
Package config stores the policy configuration Go representation, a global variable called Policies that is for reading the Config as it is updated on disk and configuration validation to make sure errors don't slip in to the Config.
16/workflow/internal/policy/register/restrictjobtypes
Package restrictjobtypes provides a policy that can be invoked to ensure that a WorkReq only contains jobs of certain types.
Package restrictjobtypes provides a policy that can be invoked to ensure that a WorkReq only contains jobs of certain types.
16/workflow/internal/policy/register/sameargs
Package sameargs defines a generic policy that can be used to look at Jobs of certain types and validate that every Job of that type has certain arguments that are the same for every invocation.
Package sameargs defines a generic policy that can be used to look at Jobs of certain types and validate that every Job of that type has certain arguments that are the same for every invocation.
16/workflow/internal/policy/register/startorend
Package startorend implements a policy that can be used to check that a WorkReq has a particular Job in the first block or the last block with certain settings.
Package startorend implements a policy that can be used to check that a WorkReq has a particular Job in the first block or the last block with certain settings.
16/workflow/internal/service
Package service implements our gRPC service called Workflow.
Package service implements our gRPC service called Workflow.
16/workflow/internal/service/executor
Package executor provides the Work type which is used to execute a pb.WorkReq.
Package executor provides the Work type which is used to execute a pb.WorkReq.
16/workflow/internal/service/jobs
Package jobs defines our Job type, which executes work and a registration system for registering Jobs.
Package jobs defines our Job type, which executes work and a registration system for registering Jobs.
16/workflow/internal/service/jobs/register/diskerase
Package diskerase registers a job that can be used to erase a disk on a machine.
Package diskerase registers a job that can be used to erase a disk on a machine.
16/workflow/internal/service/jobs/register/sleep
Package validatedecom registers a job that is used to validate a site is set to state "decom".
Package validatedecom registers a job that is used to validate a site is set to state "decom".
16/workflow/internal/service/jobs/register/tokenbucket
Package tokenbucket registers a job that is used to fetch a token from a token bucket.
Package tokenbucket registers a job that is used to fetch a token from a token bucket.
16/workflow/internal/service/jobs/register/validatedecom
Package validatedecom registers a job that is used to validate a site is set to state "decom".
Package validatedecom registers a job that is used to validate a site is set to state "decom".
16/workflow/internal/token
Package token contains a standard token bucket implementation.
Package token contains a standard token bucket implementation.
8/agent
The agent application is run on a remote system under a user you will connect to via RPC and issue commands.
The agent application is run on a remote system under a user you will connect to via RPC and issue commands.
8/agent/client
Package client provides a client to the system agent that uses SSH and unix sockets to make the connection.
Package client provides a client to the system agent that uses SSH and unix sockets to make the connection.
8/agent/internal/service
Package service contains the Agent that provides control access to the system and system stats.
Package service contains the Agent that provides control access to the system and system stats.
8/rollout/lb/server/grpc
Package grpc implements a gRPC server for controlling our HTTP load balancer.
Package grpc implements a gRPC server for controlling our HTTP load balancer.
10 Module
11/petstore Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL