Skip to content

Instantly share code, notes, and snippets.

func AddProxyToDeployment(dep *appsv1.Deployment) {
// Get variables from Env
httpproxy := os.Getenv("HTTP_PROXY")
// Add env to deployment containers
for _, container := range dep.Spec.Template.Spec.Containers {
container.Env = append(container.Env,
[]corev1.EnvVar{
{
Name: httpProxyEnvVar,
Value: httpproxy,

Note: If a CSV's spec omits an entry of InstallModeType, that type is considered unsupported unless support can be inferred by an existing entry that implicitly supports it.

Note: If a CSV's spec omits an entry of InstallModeType, that type is considered unsupported unless support can be inferred by an existing entry that implicitly supports it.

@jmrodri
jmrodri / removing-mercurial-go-mod-tidy.txt
Created February 22, 2021 23:18
removing mercurial from sdk documentation
$ go mod tidy -v
get "helm.sh/helm/v3": found meta tag get.metaImport{Prefix:"helm.sh/helm/v3", VCS:"git", RepoRoot:"https://github.com/helm/helm"} at //helm.sh/helm/v3?go-get=1
get "sigs.k8s.io/controller-tools": found meta tag get.metaImport{Prefix:"sigs.k8s.io/controller-tools", VCS:"git", RepoRoot:"https://github.com/kubernetes-sigs/controller-tools"} at //sigs.k8s.io/controller-tools?go-get=1
get "k8s.io/client-go": found meta tag get.metaImport{Prefix:"k8s.io/client-go", VCS:"git", RepoRoot:"https://github.com/kubernetes/client-go"} at //k8s.io/client-go?go-get=1
get "gomodules.xyz/jsonpatch/v3": found meta tag get.metaImport{Prefix:"gomodules.xyz/jsonpatch", VCS:"git", RepoRoot:"https://github.com/gomodules/jsonpatch"} at //gomodules.xyz/jsonpatch/v3?go-get=1
get "gomodules.xyz/jsonpatch/v3": verifying non-authoritative meta tag
get "k8s.io/apiextensions-apiserver": found meta tag get.metaImport{Prefix:"k8s.io/apiextensions-apiserver", VCS:"git", RepoRoot:"https://github.com/kubernetes/apiextensions-ap
size := memcached.Spec.Size
if *found.Spec.Replicas != size {
found.Spec.Replicas = &size
err = r.Update(ctx, found)
if err != nil {
log.Error(err, "Failed to update Deployment", "Deployment.Namespace", found.Namespace, "Deployment.Name", found.Name)
return ctrl.Result{}, err
}
// Spec updated - return and requeue
return ctrl.Result{Requeue: true}, nil
size := memcached.Spec.Size
if *found.Spec.Replicas != size {
found.Spec.Replicas = &size
err = r.Update(ctx, found)
if err != nil {
log.Error(err, "Failed to update Deployment", "Deployment.Namespace", found.Namespace, "Deployment.Name", found.Name)
return ctrl.Result{Requeue: true}, err
}
// Spec updated - return and requeue
return ctrl.Result{}, nil
--- good-pod.yaml 2021-02-01 21:12:00.924808013 -0500
+++ bad-pod.yaml 2021-02-01 21:13:34.065354226 -0500
@@ -1,48 +1,13 @@
apiVersion: v1
kind: Pod
metadata:
- creationTimestamp: 2021-02-02T02:11:11Z
+ creationTimestamp: 2021-02-02T02:12:26Z
labels:
app: test-pod-1
Can't create a new project if there's already a .git directory.
```
[jesusr@transam demo-zeus-operator]$ operator-sdk init --domain=zeusville.com --repo=github.com/jmrodri/demo-zeus-operator
Error: failed to initialize project with "go.kubebuilder.io/v3": only the go.mod and files with the prefix "(.)" are allowed before the init
Usage:
operator-sdk init [flags]
Examples:
# Scaffold a project using the apache2 license with "The Kubernetes authors" as owners
#!/usr/bin/env bash
source hack/lib/test_lib.sh
set -eux
ROOTDIR="$(pwd)"
mkdir -p /ansible
# cd /ansible
Test Panicked
runtime error: invalid memory address or nil pointer dereference
/usr/lib/golang/src/runtime/panic.go:212
Full Stack Trace
@jmrodri
jmrodri / gist:75defacd689126fab340386468e33541
Created October 29, 2020 13:48
kustomize-ghost-controller-gen-0_3_0-golang-113.diff
diff --git a/testdata/go/memcached-operator/config/crd/bases/cache.example.com_memcacheds.yaml b/testdata/go/memcached-operator/config/crd/bases/cache.example.com_memcacheds.yaml
index 666a403d..228816ff 100644
--- a/testdata/go/memcached-operator/config/crd/bases/cache.example.com_memcacheds.yaml
+++ b/testdata/go/memcached-operator/config/crd/bases/cache.example.com_memcacheds.yaml
@@ -22,14 +22,10 @@ spec:
description: Memcached is the Schema for the memcacheds API
properties:
apiVersion:
- description: 'APIVersion defines the versioned schema of this representation
- of an object. Servers should convert recognized schemas to the latest