grpc-demo-operator

command module
v0.0.0-...-a7a127b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2020 License: MIT Imports: 12 Imported by: 0

README

grpc-demo-operator

This repo is part of the Istio gRPC Golang Demo, please refer to that project for documentation.

Build

Clone the repo:

$ git clone https://github.com/drhelius/grpc-demo-operator.git
$ cd grpc-demo-operator

Build the operator and the Docker image:

$ make docker-build

Run

Make sure you are working with the right namespace. The operator will run in the grpc-demo namespace by default:

$ oc project grpc-demo

Run this to build and deploy the operator, the CRDs and all required manifests like RBAC configuration:

$ make install
$ make deploy IMG=quay.io/isanchez/grpc-demo-operator:v0.0.1

Make sure the operator is running fine:

$ kubectl get deployment grpc-demo-operator-controller-manager
NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
grpc-demo-operator-controller-manager   1/1     1            1           2m56s

The operator is watching custom resources with kind demoservices.grpcdemo.example.com.

Write a sample custom resource:

apiVersion: grpcdemo.example.com/v1
kind: DemoServices
metadata:
  name: example-services
spec:
  services:
    - name: account
      image: quay.io/isanchez/grpc-demo-account
      version: v1.0.0
      replicas: 1
      limits:
        memory: 200Mi
        cpu: "0.5"
      requests:
        memory: 100Mi
        cpu: "0.1"
    - name: order
      image: quay.io/isanchez/grpc-demo-order
      version: v1.0.0
      replicas: 1
      limits:
        memory: 200Mi
        cpu: "0.5"
      requests:
        memory: 100Mi
        cpu: "0.1"
    - name: product
      image: quay.io/isanchez/grpc-demo-product
      version: v1.0.0
      replicas: 1
      limits:
        memory: 200Mi
        cpu: "0.5"
      requests:
        memory: 100Mi
        cpu: "0.1"
    - name: user
      image: quay.io/isanchez/grpc-demo-user
      version: v1.0.0
      replicas: 1
      limits:
        memory: 200Mi
        cpu: "0.5"
      requests:
        memory: 100Mi
        cpu: "0.1"

Create the custom resource in your cluster;

$ kubectl apply -f config/samples/grpcdemo_v1_demoservices.yaml
demoservices.grpcdemo.example.com/example-services created

After a few minutes the operator should have created all the required objects and the services should be up an running:

$ kubectl get deployment
NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
account                                 1/1     1            1           2m14s
grpc-demo-operator-controller-manager   1/1     1            1           14m
order                                   1/1     1            1           2m14s
product                                 1/1     1            1           2m13s
user                                    1/1     1            1           2m13s

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1
Package v1 contains API Schema definitions for the grpcdemo v1 API group +kubebuilder:object:generate=true +groupName=grpcdemo.example.com
Package v1 contains API Schema definitions for the grpcdemo v1 API group +kubebuilder:object:generate=true +groupName=grpcdemo.example.com

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL