Skip to content

Instantly share code, notes, and snippets.

View bryanl's full-sized avatar
🚩
Out in the streets

Bryan Liles bryanl

🚩
Out in the streets
View GitHub Profile
/*
Copyright (c) 2019 VMware, Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package main
import (
"context"
"fmt"
func (dc *DynamicCache) Update(ctx context.Context, key store.Key, mutator func(*unstructured.Unstructured) error) error {
if mutator == nil {
return errors.New("can't update object")
}
err := kretry.RetryOnConflict(kretry.DefaultRetry, func() error {
object, err := dc.Get(ctx, key)
if err != nil {
return err
}
{
"title": [
{
"metadata": {
"type": "text"
},
"config": {
"value": "Deployment"
}
},
import * as kdux from 'kdux';
kdux.Configure(config => {
config.commonLabels = {
project: "project-1"
};
config.commonAnnotations = {
onCallEmail: "email@example.com"
};
local params = std.extVar('__ksonnet/params').components['site-ingress'];
local svcParams = std.extVar('__ksonnet/params').components['site-service'];
local deployParams = std.extVar('__ksonnet/params').components['site-deployment'];
{
apiVersion: 'extensions/v1beta1',
kind: 'Ingress',
metadata: {
annotations: {
'kubernetes.io/ingress.class': 'contour',

CD on Kubernetes

#talks

Abstract

Kubernetes has become a hot topic in the computing space. There's been lots of talk about spinning up clusters, developer tooling, and monitoring. Applications from large to small are now taking advantage of the ecosystem.

One thing that hasn't changed is how we deliver software to production. Development and operations teams hold their continuous delivery (CD) software close to their chest. It's hard to find good software, harder to get it dialed in for one project, and sometimes an epic effort to get it working across an organization.

With Kubernetes, a platform for platforms, you get all the raw building blocks for creating a delivery platform right out of the box. This talk will walk through the steps for designing a delivery system out of Kubernetes components. We'll start with extracting the problem, and move to identifying the components of the build system. Next, the audience members will be introduced to all the parts of this hypothetical delivery system, and

Parsing incomplete jsonnet

#Heptio/ksonnet/vscode

To create completion items for a jsonnet source file, you might have to work with an incomplete or malformed source file. JSL should be able to handle this and still offer completion items.

Use Cases

First use case

local a = "a";
@bryanl
bryanl / ksonnet-helm-parameters.md
Created June 29, 2018 00:30
ksonnet helm parameters

ksonnet and param values with Helm.

Initializing the ksonnet application and Helm

  1. ks init app
  2. cd ksapp
  3. ks registry add helm-stable https://kubernetes-charts.storage.googleapis.com
  4. ks pkg add helm-stable/redis
  5. ks generate helm-stable-redis redis
factory.NewBuilder().
Unstructured().
NamespaceParam("default").
ExportParam(true).
ResourceTypeOrNameArgs(true, "all").
LabelSelectorParam("app=my-app").
ContinueOnError().
Latest().
Flatten().
IncludeUninitialized(false).

What is ksonnet?

How can the current concepts in ksonnet be demonstrated in their simplest form?

We have a Deployment object that needs to be in the cluster. If you create the object, you can apply it to the cluster with kubectl apply -f deployment.yaml. In many cases, you’ll have multiple objects. For example, to make a Deployment object useful, it is often paired with a Service and Ingress objects. These additional objects can be applied to the cluster with kubectl apply -f service.yaml and kubectl apply -f ingress.yaml.

Applications aren’t only deployed to product environments. Teams often use development and staging environments as well. How do you manage the components of your application in multiple locations? In these different environments, configuration parameters might be different. e.g. the host name for the an application will be different depending of the environment, or the amount of replicas of pods might change due to the amount of traffic the application will receive. To suc