Skip to content

Instantly share code, notes, and snippets.

@jmrodri
jmrodri / upstream-merge.log
Created October 28, 2020 01:12
Output from running UPSTREAM-MERGE.sh
[jesusr@transam ocp-release-operator-sdk{master}]$ git remote -v
openshift https://github.com/openshift/ocp-release-operator-sdk.git (fetch)
openshift no_push (push)
origin [email protected]:jmrodri/ocp-release-operator-sdk.git (fetch)
origin [email protected]:jmrodri/ocp-release-operator-sdk.git (push)
upstream https://github.com/operator-framework/operator-sdk.git (fetch)
upstream no_push (push)
[jesusr@transam ocp-release-operator-sdk{master}]$ ./UPSTREAM-MERGE.sh v1.1.0
Already on 'master'
Your branch is up to date with 'origin/master'.
diff --git a/ansible/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml b/ansible/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml
index fb08714..bd4f5a8 100644
--- a/ansible/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml
+++ b/ansible/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml
@@ -107,6 +107,16 @@ spec:
control-plane: controller-manager
spec:
containers:
+ - args:
+ - --metrics-addr=127.0.0.1:8080
@jmrodri
jmrodri / os.sh
Last active October 26, 2020 23:08
# get the arch and version information
ARCH=`uname -m`
VERSION='1.1.0'
OS=${OSTYPE//[0-9.]/}
if [[ "$OS" == "darwin" ]]; then
OS="apple-darwin"
fi
BINARY="operator-sdk-v$VERSION-$ARCH-$OS"
# DEBUG
@jmrodri
jmrodri / memcached.go
Created October 6, 2020 21:46
Your ansible memcached Generate would turn into this
// GenerateMemcachedAnsibleSample will call all actions to create the directory and generate the sample
// The Context to run the samples are not the same in the e2e test. In this way, note that it should NOT
// be called in the e2e tests since it will call the Prepare() to set the sample context and generate the files
// in the testdata directory. The e2e tests only ought to use the Run() method with the TestContext.
func GenerateMemcachedAnsibleSample(samplesPath string) {
ctx, err := pkg.NewSampleContext(testutils.BinaryName,
pkg.WithPath(filepath.Join(samplesPath, "ansible/memcached-operator")),
pkg.WithEnvironment("GO111MODULE=on"),
)
@jmrodri
jmrodri / context.go
Last active October 6, 2020 21:51
SampleContext using Opts pattern
// Copyright 2020 The Operator-SDK Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@jmrodri
jmrodri / run-bundle.md
Last active October 7, 2020 16:32
deploy bundle with run bundle

operator-sdk run bundle demo

create a simple operator

mkdir demo-zeus-operator
cd demo-zeus-operator
operator-sdk version
operator-sdk init --domain=zeusville.com --repo=github.com/YOURGITHUBREPO/demo-zeus-operator
operator-sdk create api --group test --version v1 --kind Test --controller --resource
[jesusr@transam operator-registry{debug}]$ bin/opm registry add -d database/index.db -b quay.io/vnarsing/memcached-operator:v1 --mode=semver
INFO[0000] adding to the registry bundles="[quay.io/vnarsing/memcached-operator:v1]"
INFO[0000] resolved name: quay.io/vnarsing/memcached-operator:v1
INFO[0000] fetched digest="sha256:af6d5164bc7f2d6cbaffa6512e6f75c2a8f006023abae3a99464e2cac72dc79f"
INFO[0000] fetched digest="sha256:9e28e44ee9e02f864a5979bb1352a9f2cde5988b19d90d8291f792947d6473be"
INFO[0000] fetched digest="sha256:cb0f79f77243fc0308b0f392dc8a3cf04b2f1efda4ca6047c1a56c7f3d741d34"
INFO[0000] fetched digest="sha256:df87481a09e9bb57fb7aff5143fde82f2141e69c8f0de4843696da047bc15d98"
INFO[0000] fetched digest="sha256:bed2176ad0d92c8a90c3faade1df343420bb7de1dc57add2b3d6ed60883563e1"
INFO[0000] unpackin
[jesusr@transam operator-registry{debug}]$ bin/opm registry add -d database/index.db -b quay.io/joelanford/example-operator-bundle:0.1.0 --mode=semver
INFO[0000] adding to the registry bundles="[quay.io/joelanford/example-operator-bundle:0.1.0]"
INFO[0000] resolved name: quay.io/joelanford/example-operator-bundle:0.1.0
INFO[0000] fetched digest="sha256:19666955b8400a6faaab9a1bc15510ce4d1681e33ec034b78831e890e9bdd510"
INFO[0000] fetched digest="sha256:1eb69b507afc07bc4fcf5ddc264a1b66511a9c96fef52a79afc3b69d29d8ffb6"
INFO[0000] fetched digest="sha256:4a34196d00c2f6e00f8501b6da547575bda513061954b32dfea511478d1cdcfc"
INFO[0000] fetched digest="sha256:2d74147b6c4419b30c32fda6b9a30395098308e903190dc2e9fdf39818dbcd36"
INFO[0000] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:2d74147b6c4419b30c32fda6b9a30395098308e90
docker build -f release/ansible/upstream.Dockerfile -t docker.io/jmrodri/osdk-ansible .
docker build -f ci/dockerfiles/builder.Dockerfile . -t docker.io/jmrodri/osdk-builder:latest
# edit ci/dockerfiles/ansible-e2e.Dockerfile to use the above
docker build -f ci/dockerfiles/ansible-e2e.Dockerfile . -t docker.io/jmrodri/ansible-e2e:latest
# create operator
mkdir fix-downstream
cd fix-downstream
/tmp/operator-sdk new memcached-operator --api-version=ansible.example.com/v1alpha1 --kind=Memcached --type=ansible
cd memcached-operator
title weight
Release Guide
30

Making an Operator SDK release involves:

  • Updating CHANGELOG.md and migration guide.
  • Tagging and signing a git commit and pushing the tag to GitHub.
  • Building a release binary and signing the binary