This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oc/kubectl create -f deploy/crds/hello_v1alpha1_hello_crd.yaml | |
#change lordofthejars to your docker hub account | |
operator-sdk build lordofthejars/hello-operator:v0.0.1 | |
docker push lordofthejars/hello-operator:v0.0.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (r *ReconcileHello) Reconcile(request reconcile.Request) (reconcile.Result, error) { | |
reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name) | |
reqLogger.Info("Reconciling Hello") | |
// Fetch the Hello instance | |
instance := &hellov1alpha1.Hello{} | |
err := r.client.Get(context.TODO(), request.NamespacedName, instance) | |
... | |
// Define a new Pod object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HelloSpec defines the desired state of Hello | |
type HelloSpec struct { | |
Message string `json:"message"` | |
} | |
// HelloStatus defines the observed state of Hello | |
type HelloStatus struct { | |
Nodes []string `json:"nodes"` | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
operator-sdk add api --api-version=hello.lordofthejars.com/v1alpha1 --kind=Hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p $GOPATH/src/github.com/lordofthejars/ | |
cd $GOPATH/src/github.com/lordofthejars/ | |
operator-sdk new hello-operator | |
cd hello-operator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minishift config set memory 8GB | |
minishift config set cpus 2 | |
minishift config set image-caching true | |
minishift config set openshift-version v3.11.0 | |
minishift addon enable admin-user | |
minishift addon enable anyuid | |
minishift start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: whalesay | |
spec: | |
containers: | |
- name: whalesay | |
image: docker/whalesay | |
imagePullPolicy: "IfNotPresent" | |
command: ["cowsay","Hello Alex"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo: required | |
services: | |
- docker | |
addons: | |
apt: | |
sources: | |
- git-core | |
packages: | |
- git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(Arquillian.class) | |
@Function(value = "file:src/test/resources/echo.jar", name = "echo", main = "org.projectodd.Echo") | |
public class EchoTest { | |
@ArquillianResource | |
OWskClient client; | |
@Test | |
public void should_invoke_echo() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ok, I understand your problem, in fact we found it several times, and this is how we tackle: | |
We have A->B->C and we want to validate contract between A and B, so we do not have to worry about B->C | |
So Consumer side (A) uses an stub to validate that it can communicate with B | |
Provider B part we just replay the contract (generated by A) to validate that is able to produce correct output. But then what's happening with C? | |
Do we need to boot up C in B? The answer is no, it is not necessary. You can use Service virtualization (or contract generated by C) to simulate interactions between B and C. | |
So when validating the provider side in contract testing of B you virtualize C so you do not need to worry about how to boot up C. |