Skip to content

Instantly share code, notes, and snippets.

View alpeb's full-sized avatar
😙

Alejandro Pedraza alpeb

😙
View GitHub Profile
@alpeb
alpeb / main.rs
Created November 27, 2023 14:15
linkerd-reinitialize-pods
use anyhow::{bail, Result};
use clap::Parser;
use futures_util::StreamExt;
use kube::runtime::watcher;
use k8s_openapi::api::core::v1::Pod;
#[derive(Parser)]
#[command(version)]
struct Args {
#[arg(
@alpeb
alpeb / flat-network.sh
Last active May 9, 2024 11:26
2 k3d clusters with 3 nodes each, using the same flat network
#!/usr/bin/env bash
zones=(a b c)
cluster_cidr() {
echo "apiVersion: networking.k8s.io/v1alpha1
kind: ClusterCIDR
metadata:
name: new-cidr
spec:
[package]
name = "ext-ns-metadata"
version = "0.1.0"
authors = ["Linkerd Authors <cncf-linkerd-dev@lists.cncf.io>"]
edition = "2021"
license = "Apache-2.0"
publish = false
[dependencies]
anyhow = "1"
#!/bin/bash
set -euxo pipefail
# Set the linkerd binary to use.
LINKERD_CLI=linkerd
# create the local k8s cluster. Either k3d or kind can be used.
k3d cluster create --k3s-server-arg "--disable=traefik"
# kind create cluster
time="2020-05-20T17:30:30Z" level=info msg="caches synced"
time="2020-05-20T17:30:30Z" level=debug msg="Received: OprhanedServicesGcTriggered: {}" apiAddress="https://192.168.0.227:6443" cluster=macbook
time="2020-05-20T17:30:30Z" level=debug msg="Received: OnAddCalled: {svc: Service: {name: linkerd-controller-api, namespace: linkerd, annotations: [[linkerd.io/created-by=linkerd/cli edge-20.5.3]], labels [[linkerd.io/control-plane-ns=linkerd,linkerd.io/control-plane-compon
ent=controller]]}}" apiAddress="https://192.168.0.227:6443" cluster=macbook
time="2020-05-20T16:36:03Z" level=debug msg="Gateway is healthy" probe-key=linkerd-multicluster-linkerd-gateway-macbook
I0520 16:36:05.363727 1 reflector.go:268] pkg/mod/k8s.io/client-go@v0.17.4/tools/cache/reflector.go:105: forcing resync
time="2020-05-20T16:36:05Z" level=debug msg="Received: OnUpdateCalled: {svc: Service: {name: linkerd-prometheus, namespace: linkerd, annotations: [[linkerd.io/created-by=linkerd/cli edge-20.5.3]], labels [[linkerd.io/control-plane-component=prometheus,linkerd.io/control-pla
ne-ns=linkerd]]}}" apiAddress="https://192.168.0.227:6443" cluster=macbook
diff --git a/controller/api/destination/watcher/endpoints_watcher.go b/controller/api/destination/watcher/endpoints_watcher.go
index 1d04a747..afaa98af 100644
--- a/controller/api/destination/watcher/endpoints_watcher.go
+++ b/controller/api/destination/watcher/endpoints_watcher.go
@@ -46,8 +46,7 @@ type (
// RemoteGatewayAddress is a an address points to a remote gateway
RemoteGatewayAddress struct {
- IP string
- Port Port
{
"global": {
"clusterDomain": .ClusterDomain,
"imagePullPolicy": .ImagePullPolicy,
"linkerdVersion": .LinkerdVersion,
"namespace": .Namespace,
"identityTrustAnchorsPEM": .Identity.TrustAnchorsPEM,
"identityTrustDomain": .Identity.TrustDomain,
"proxy": {
"enableExternalProfiles": .Proxy.EnableExternalProfiles,
@alpeb
alpeb / Helm.md
Last active August 13, 2019 21:14
Linkerd Helm docs

Helm chart

The main Linkerd2 chart is located under charts/linkerd2. It depends on the chart under charts/partials. The chart under charts/patch is only used internally for the sidecar proxy injection.

Helm CLI

The charts are installed and managed with the Helm CLI, but we encourage you to use bin/helm which is a wrapper around it; it will download and use a specific version of the CLI with which the official chart has already been tested.

Certificates creation

diff --git a/controller/proxy-injector/webhook.go b/controller/proxy-injector/webhook.go
index 66683126..85c1756b 100644
--- a/controller/proxy-injector/webhook.go
+++ b/controller/proxy-injector/webhook.go
@@ -153,6 +153,10 @@ func (w *Webhook) inject(request *admissionv1beta1.AdmissionRequest) (*admission
patch.addInitContainer(proxyInit)
}
+ if deployment.Spec.Template.Annotations == nil {
+ deployment.Spec.Template.Annotations = map[string]string{}