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
package main | |
import ( | |
"archive/tar" | |
"bytes" | |
"compress/gzip" | |
"fmt" | |
"io" | |
"os" | |
"path/filepath" |
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: mmontes.io/v1alpha1 | |
kind: Echo | |
metadata: | |
name: hello-world | |
namespace: default | |
spec: | |
message: "Hola, 世界!" |
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: ServiceAccount | |
metadata: | |
name: {{ include "echoperator.fullname" . }} | |
labels: | |
{{- include "echoperator.labels" . | nindent 4 }} | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: |
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
{{ $fullName := include "echoperator.fullname" . }} | |
{{ $selectorLabels := include "echoperator.selectorLabels" . }} | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: {{ $fullName }} | |
labels: | |
{{ include "echoperator.labels" . | nindent 4 }} | |
spec: | |
{{ if .Values.ha.enabled}} |
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
{{ $fullName := include "echoperator.fullname" . }} | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: {{ $fullName }} | |
labels: | |
{{ include "echoperator.labels" . | nindent 4 }} | |
data: | |
NAMESPACE: {{ .Release.Namespace }} | |
NUM_WORKERS: {{ .Values.numWorkers | quote }} |
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
nameOverride: "" | |
fullnameOverride: "" | |
image: | |
repository: mmontes11/echoperator | |
pullPolicy: IfNotPresent | |
tag: v0.0.1 | |
env: production |
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
type Runner struct { | |
ctrl *controller.Controller | |
clientset *kubernetes.Clientset | |
config config.Config | |
logger log.Logger | |
} | |
func (r *Runner) Start(ctx context.Context) { | |
if r.config.HA.Enabled { | |
r.logger.Info("starting HA controller") |
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
import ( | |
echo "github.com/mmontes11/echoperator/pkg/echo" | |
echov1alpha1 "github.com/mmontes11/echoperator/pkg/echo/v1alpha1" | |
batchv1 "k8s.io/api/batch/v1" | |
corev1 "k8s.io/api/core/v1" | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
) | |
func createJob(newEcho *echov1alpha1.Echo, namespace string) *batchv1.Job { | |
return &batchv1.Job{ |
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 (c *Controller) runWorker(ctx context.Context) { | |
for c.processNextItem(ctx) { | |
} | |
} | |
func (c *Controller) processNextItem(ctx context.Context) bool { | |
obj, shutdown := c.queue.Get() | |
if shutdown { | |
return false | |
} |
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
type Controller struct { | |
kubeClientSet kubernetes.Interface | |
echoInformer cache.SharedIndexInformer | |
jobInformer cache.SharedIndexInformer | |
scheduledEchoInformer cache.SharedIndexInformer | |
cronjobInformer cache.SharedIndexInformer | |
queue workqueue.RateLimitingInterface |
NewerOlder