diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..b672078d --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +CONTAINER_TOOL ?= docker + +.PHONY: help +help: + @echo "Available targets:" + @awk '/^[a-zA-Z0-9_-]+:.*?##/ { \ + nb = index($$0, "##"); \ + target = substr($$0, 1, nb - 2); \ + helpMsg = substr($$0, nb + 3); \ + printf " %-15s %s\n", target, helpMsg; \ + }' $(MAKEFILE_LIST) | column -s ':' -t + +.PHONY: helm-chart +helm-chart: ## Create Helm chart for the operator + kustomize build operator/config/default | helmify ../charts/elasti + +.PHONY: generate-manifest +generate-manifest: ## Generate deploy manifest + kustomize build operator/config/default > ./operator/install.yaml + kustomize build resolver/config/ > ./resolver/install.yaml + +.PHONY: deploy +deploy: ## Deploy the operator and resolver + kubectl apply -f ./resolver/install.yaml + kubectl apply -f ./operator/install.yaml + +.PHONY: undeploy +undeploy: ## Undeploy the operator and resolver + kubectl delete -f ./resolver/install.yaml + kubectl delete -f ./operator/install.yaml + diff --git a/README.md b/README.md index a6844a57..b84100f4 100644 --- a/README.md +++ b/README.md @@ -33,20 +33,20 @@ TBA # Installation / Deployment on K8s -You will be able to install the Elasti Tool by applying the `install.yaml` manifest. +You will be able to install the Elasti Tool by following command ```bash -kubectl install -f install.yaml +make deploy ``` -After this, you can start creating elastiService, you can find a sample at `./playground/config/watch-crd.yaml`. +After this, you can start creating elastiService, you can find a sample at `demo-elastiService.yaml` Please use the exact format. # Uninstallation -For this, you will need to remove all the CRDs first. +For this, **you will need to remove all the CRDs first. ** Post that, just delete the install file. ```bash -kubectl delete -f install.yaml +make undeploy ``` # Development @@ -74,7 +74,7 @@ We will build and publish our resolver changes. 1. Go into resolver directory. 2. Run build and publish command. ```bash -make docker-buildx-resolver IMG=ramantehlan/elasti-resolver:v1alpha1 +make docker-buildx IMG=ramantehlan/elasti-resolver:v1alpha1 ``` ### Build Operator diff --git a/demo-elastiService.yaml b/demo-elastiService.yaml index 9e888d82..faa272f6 100644 --- a/demo-elastiService.yaml +++ b/demo-elastiService.yaml @@ -4,20 +4,15 @@ metadata: labels: app.kubernetes.io/name: elasti-operator app.kubernetes.io/managed-by: kustomize - name: emotion-class + name: emotion-class-elasti-service namespace: raman-ws spec: queueTimeout: 4 idlePeriod: 20 - service: emotion-class-svc - deploymentName: emotion-class-svc minTargetReplicas: 1 - # scaleTargetRef: - # apiVersion: apps/v1 - # kind: Rollouts - # name: emotion-class-svc + service: emotion-class-svc scaleTargetRef: - apiVersion: apps/v1 - kind: Deployments + apiVersion: argoproj.io/v1alpha1 + kind: rollouts name: emotion-class-svc diff --git a/operator/api/v1alpha1/elastiservice_types.go b/operator/api/v1alpha1/elastiservice_types.go index 437a1b08..8cf64c8f 100644 --- a/operator/api/v1alpha1/elastiservice_types.go +++ b/operator/api/v1alpha1/elastiservice_types.go @@ -33,7 +33,6 @@ type ElastiServiceSpec struct { // Important: Run "make" to regenerate code after modifying this file ScaleTargetRef ScaleTargetRef `json:"scaleTargetRef,omitempty"` Service string `json:"service,omitempty"` - DeploymentName string `json:"deploymentName,omitempty"` QTimout int32 `json:"queueTimeout,omitempty"` IdlePeriod int32 `json:"idlePeriod,omitempty"` MinTargetReplicas int32 `json:"minTargetReplicas,omitempty"` diff --git a/operator/cmd/main.go b/operator/cmd/main.go index 78e6d645..0e7cf2c5 100644 --- a/operator/cmd/main.go +++ b/operator/cmd/main.go @@ -63,6 +63,10 @@ const ( ) func main() { + zapLogger, err := tfLogger.NewLogger("dev") + if err != nil { + setupLog.Error(err, "unable to create logger") + } var metricsAddr string var enableLeaderElection bool var probeAddr string @@ -133,11 +137,6 @@ func main() { os.Exit(1) } - zapLogger, err := tfLogger.NewLogger("dev") - if err != nil { - setupLog.Error(err, "unable to create logger") - } - // Start the shared CRD Directory crdDirectory.INITDirectory(zapLogger) // Initiate and start the shared Informer manager diff --git a/operator/config/crd/bases/elasti.truefoundry.com_elastiservices.yaml b/operator/config/crd/bases/elasti.truefoundry.com_elastiservices.yaml index c48a8968..4eba2d78 100644 --- a/operator/config/crd/bases/elasti.truefoundry.com_elastiservices.yaml +++ b/operator/config/crd/bases/elasti.truefoundry.com_elastiservices.yaml @@ -39,8 +39,6 @@ spec: spec: description: ElastiServiceSpec defines the desired state of ElastiService properties: - deploymentName: - type: string idlePeriod: format: int32 type: integer diff --git a/operator/config/manager/manager.yaml b/operator/config/manager/manager.yaml index 97f52b32..41318b6e 100644 --- a/operator/config/manager/manager.yaml +++ b/operator/config/manager/manager.yaml @@ -65,6 +65,7 @@ spec: - --health-probe-bind-address=:8081 - --metrics-bind-address=0 image: localhost:5001/elasti-operator:v1alpha1 + imagePullPolicy: Always name: manager ports: - containerPort: 8013 diff --git a/operator/config/rbac/role_additional.yaml b/operator/config/rbac/role_additional.yaml index da3fb51d..d17bd977 100644 --- a/operator/config/rbac/role_additional.yaml +++ b/operator/config/rbac/role_additional.yaml @@ -12,4 +12,8 @@ rules: verbs: ["get", "list", "watch", "update", "patch", "delete", "create"] - apiGroups: [""] resources: ["services"] - verbs: ["get", "list", "watch", "update", "patch", "delete", "create"] \ No newline at end of file + verbs: ["get", "list", "watch", "update", "patch", "delete", "create"] +- apiGroups: ["argoproj.io"] + resources: ["rollouts"] + verbs: ["get", "list", "watch", "update", "patch"] + \ No newline at end of file diff --git a/operator/config/rbac/role_additional_binding.yaml b/operator/config/rbac/role_additional_binding.yaml index 23382ad0..0833dcb8 100644 --- a/operator/config/rbac/role_additional_binding.yaml +++ b/operator/config/rbac/role_additional_binding.yaml @@ -4,7 +4,7 @@ metadata: labels: app.kubernetes.io/name: elasti-operator app.kubernetes.io/managed-by: kustomize - name: additional-access-binding + name: operator-additional-access-binding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole @@ -13,3 +13,19 @@ subjects: - kind: ServiceAccount name: elasti-operator-controller-manager namespace: elasti-operator-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/name: elasti-operator + app.kubernetes.io/managed-by: kustomize + name: resolver-additional-access-binding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: additional-access +subjects: +- kind: ServiceAccount + name: default + namespace: elasti diff --git a/install.yaml b/operator/install.yaml similarity index 88% rename from install.yaml rename to operator/install.yaml index c2937169..452b325e 100644 --- a/install.yaml +++ b/operator/install.yaml @@ -47,12 +47,10 @@ spec: spec: description: ElastiServiceSpec defines the desired state of ElastiService properties: - deploymentName: - type: string idlePeriod: format: int32 type: integer - minReplicas: + minTargetReplicas: format: int32 type: integer queueTimeout: @@ -100,15 +98,6 @@ metadata: name: elasti-operator-controller-manager namespace: elasti-operator-system --- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: elasti-resolver - name: elasti-resolver - namespace: elasti ---- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: @@ -166,19 +155,21 @@ rules: - update - patch - apiGroups: - - apps + - discovery.k8s.io resources: - - rollouts + - endpointslices verbs: - get - list - watch - update - patch + - delete + - create - apiGroups: - - discovery.k8s.io + - "" resources: - - endpointslices + - services verbs: - get - list @@ -188,17 +179,15 @@ rules: - delete - create - apiGroups: - - "" + - argoproj.io resources: - - services + - rollouts verbs: - get - list - watch - update - patch - - delete - - create --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole @@ -316,7 +305,7 @@ roleRef: name: elasti-operator-leader-election-role subjects: - kind: ServiceAccount - name: elasti-resolver + name: elasti-operator-controller-manager namespace: elasti-operator-system --- apiVersion: rbac.authorization.k8s.io/v1 @@ -325,15 +314,16 @@ metadata: labels: app.kubernetes.io/managed-by: kustomize app.kubernetes.io/name: elasti-operator - name: elasti-operator-additional-access-binding + name: elasti-operator-apiserver-node-access-binding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: elasti-operator-additional-access + name: elasti-operator-apiserver-node-access subjects: -- kind: ServiceAccount - name: elasti-operator-controller-manager - namespace: elasti-operator-system +- apiGroup: rbac.authorization.k8s.io + kind: User + name: kube-apiserver-kubelet-client + namespace: system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -341,15 +331,15 @@ metadata: labels: app.kubernetes.io/managed-by: kustomize app.kubernetes.io/name: elasti-operator - name: elasti-resolver-additional-access-binding + name: elasti-operator-manager-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: elasti-operator-additional-access + name: elasti-operator-manager-role subjects: - kind: ServiceAccount name: elasti-operator-controller-manager - namespace: elasti + namespace: elasti-operator-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -357,16 +347,15 @@ metadata: labels: app.kubernetes.io/managed-by: kustomize app.kubernetes.io/name: elasti-operator - name: elasti-operator-apiserver-node-access-binding + name: elasti-operator-operator-additional-access-binding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: elasti-operator-apiserver-node-access + name: elasti-operator-additional-access subjects: -- apiGroup: rbac.authorization.k8s.io - kind: User - name: kube-apiserver-kubelet-client - namespace: system +- kind: ServiceAccount + name: elasti-operator-controller-manager + namespace: elasti-operator-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -374,14 +363,14 @@ metadata: labels: app.kubernetes.io/managed-by: kustomize app.kubernetes.io/name: elasti-operator - name: elasti-operator-manager-rolebinding + name: elasti-operator-resolver-additional-access-binding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: elasti-operator-manager-role + name: elasti-operator-additional-access subjects: - kind: ServiceAccount - name: elasti-operator-controller-manager + name: default namespace: elasti-operator-system --- apiVersion: v1 @@ -449,6 +438,7 @@ spec: command: - /manager image: ramantehlan/elasti-operator:v1alpha1 + imagePullPolicy: Always livenessProbe: httpGet: path: /healthz @@ -482,56 +472,3 @@ spec: runAsNonRoot: true serviceAccountName: elasti-operator-controller-manager terminationGracePeriodSeconds: 10 ---- -apiVersion: v1 -kind: Namespace -metadata: - name: elasti ---- -apiVersion: v1 -kind: Service -metadata: - name: resolver-service - namespace: elasti -spec: - selector: - app: elasti-resolver - ports: - - name: http-playground - protocol: TCP - port: 8012 - type: LoadBalancer ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: elasti-resolver - namespace: elasti -spec: - replicas: 1 - selector: - matchLabels: - app: elasti-resolver - template: - metadata: - labels: - app: elasti-resolver - spec: - containers: - - name: playground - image: ramantehlan/elasti-resolver:v1alpha1 - env: - - name: SYSTEM_NAMESPACE - value: elasti - ports: - - containerPort: 8012 - resources: - requests: - memory: "500Mi" - cpu: "250m" - limits: - memory: "1Gi" - cpu: "750m" - - - diff --git a/operator/internal/controller/opsDeployment.go b/operator/internal/controller/opsDeployment.go index 3d61beb4..ed40e714 100644 --- a/operator/internal/controller/opsDeployment.go +++ b/operator/internal/controller/opsDeployment.go @@ -13,7 +13,7 @@ import ( "truefoundry.io/elasti/api/v1alpha1" ) -func (r *ElastiServiceReconciler) handleTargetDeploymentChanges(ctx context.Context, obj interface{}, es *v1alpha1.ElastiService, req ctrl.Request) { +func (r *ElastiServiceReconciler) handleTargetDeploymentChanges(ctx context.Context, obj interface{}, _ *v1alpha1.ElastiService, req ctrl.Request) { targetDeployment := &appsv1.Deployment{} err := k8sHelper.UnstructuredToResource(obj, targetDeployment) if err != nil { @@ -22,21 +22,21 @@ func (r *ElastiServiceReconciler) handleTargetDeploymentChanges(ctx context.Cont } condition := targetDeployment.Status.Conditions if targetDeployment.Status.Replicas == 0 { - r.Logger.Debug("Deployment has 0 replicas", zap.String("deployment_name", es.Spec.DeploymentName), zap.String("es", req.String())) + r.Logger.Debug("Deployment has 0 replicas", zap.String("deployment_name", targetDeployment.Name), zap.String("es", req.String())) _, err := r.switchMode(ctx, req, values.ProxyMode) if err != nil { r.Logger.Error("Reconciliation failed", zap.String("es", req.String()), zap.Error(err)) return } } else if targetDeployment.Status.Replicas > 0 && condition[1].Status == values.DeploymentConditionStatusTrue { - r.Logger.Debug("Deployment has replicas", zap.String("deployment_name", es.Spec.DeploymentName), zap.String("es", req.String())) + r.Logger.Debug("Deployment has replicas", zap.String("deployment_name", targetDeployment.Name), zap.String("es", req.String())) _, err := r.switchMode(ctx, req, values.ServeMode) if err != nil { r.Logger.Error("Reconciliation failed", zap.String("es", req.String()), zap.Error(err)) return } } - r.Logger.Info("Deployment changes handled", zap.String("deployment_name", es.Spec.DeploymentName), zap.String("es", req.String())) + r.Logger.Info("Deployment changes handled", zap.String("deployment_name", targetDeployment.Name), zap.String("es", req.String())) } func (r *ElastiServiceReconciler) handleResolverChanges(ctx context.Context, obj interface{}, serviceName, namespace string) { diff --git a/operator/internal/controller/opsInformer.go b/operator/internal/controller/opsInformer.go index 86a2d957..3f2beb60 100644 --- a/operator/internal/controller/opsInformer.go +++ b/operator/internal/controller/opsInformer.go @@ -2,6 +2,7 @@ package controller import ( "context" + "strings" "sync" "github.com/truefoundry/elasti/pkg/values" @@ -69,7 +70,7 @@ func (r *ElastiServiceReconciler) getScaleTargetRefChangeHandler(ctx context.Con } func (r *ElastiServiceReconciler) handleScaleTargetRefChanges(ctx context.Context, obj interface{}, es *v1alpha1.ElastiService, req ctrl.Request) { - switch es.Spec.ScaleTargetRef.Kind { + switch strings.ToLower(es.Spec.ScaleTargetRef.Kind) { case values.KindDeployments: r.Logger.Info("ScaleTargetRef kind is deployment", zap.String("kind", es.Spec.ScaleTargetRef.Kind)) r.handleTargetDeploymentChanges(ctx, obj, es, req) diff --git a/operator/internal/informer/informer.go b/operator/internal/informer/informer.go index cd52cc54..66cd67a0 100644 --- a/operator/internal/informer/informer.go +++ b/operator/internal/informer/informer.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "runtime" + "strings" "sync" "time" @@ -170,7 +171,9 @@ func (m *Manager) AddDeploymentWatch(req ctrl.Request, deploymentName, namespace // Add is to add a watch on a resource func (m *Manager) Add(req *RequestWatch) { m.logger.Info("Adding informer", - zap.String("gvr", req.GroupVersionResource.String()), + zap.String("group", req.GroupVersionResource.Group), + zap.String("version", req.GroupVersionResource.Version), + zap.String("resource", req.GroupVersionResource.Resource), zap.String("resourceName", req.ResourceName), zap.String("resourceNamespace", req.ResourceNamespace), zap.String("crd", req.Req.String()), @@ -244,5 +247,9 @@ func (m *Manager) enableInformer(req *RequestWatch) { // getKeyFromRequestWatch is to get the key for the informer map using namespace and resource name from the request // CRDname.resourcerName.Namespace func (m *Manager) getKeyFromRequestWatch(req *RequestWatch) string { - return fmt.Sprintf("%s/%s/%s", req.Req.Name, req.ResourceName, req.ResourceNamespace) + return fmt.Sprintf("%s/%s/%s/%s", + strings.ToLower(req.ResourceNamespace), + strings.ToLower(req.Req.Name), + strings.ToLower(req.GroupVersionResource.Resource), + strings.ToLower(req.ResourceName)) } diff --git a/pkg/k8sHelper/ops.go b/pkg/k8sHelper/ops.go index 8f22a598..d30fd4df 100644 --- a/pkg/k8sHelper/ops.go +++ b/pkg/k8sHelper/ops.go @@ -3,6 +3,7 @@ package k8sHelper import ( "context" "fmt" + "strings" "github.com/truefoundry/elasti/pkg/values" "go.uber.org/zap" @@ -73,7 +74,7 @@ func (k *Ops) getServiceSelectorStr(ns, svc string) (string, error) { // ScaleTargetWhenAtZero scales the TargetRef to the provided replicas when it's at 0 func (k *Ops) ScaleTargetWhenAtZero(ns, targetName, targetKind string, replicas int32) error { - switch targetKind { + switch strings.ToLower(targetKind) { case values.KindDeployments: k.logger.Info("ScaleTargetRef kind is deployment", zap.String("kind", targetKind)) err := k.ScaleDeployment(ns, targetName, replicas) diff --git a/pkg/values/values.go b/pkg/values/values.go index abf7f1fe..4d56c98c 100644 --- a/pkg/values/values.go +++ b/pkg/values/values.go @@ -4,8 +4,9 @@ const ( ArgoPhaseHealthy = "Healthy" DeploymentConditionStatusTrue = "True" - KindDeployments = "Deployments" - KindRollout = "Rollout" + KindDeployments = "deployments" + KindRollout = "rollouts" + KindService = "services" ServeMode = "serve" ProxyMode = "proxy" diff --git a/resolver/config/deployment.yaml b/resolver/config/deployment.yaml index 6635d41a..28d39fad 100644 --- a/resolver/config/deployment.yaml +++ b/resolver/config/deployment.yaml @@ -16,6 +16,7 @@ spec: containers: - name: playground image: localhost:5001/elasti-resolver:v1alpha1 + imagePullPolicy: Always env: - name: SYSTEM_NAMESPACE value: elasti diff --git a/resolver/config/kustomization.yaml b/resolver/config/kustomization.yaml new file mode 100644 index 00000000..a66f69d6 --- /dev/null +++ b/resolver/config/kustomization.yaml @@ -0,0 +1,141 @@ +# Adds namespace to all resources. +namespace: elasti + +# Value of this field is prepended to the +# names of all resources, e.g. a deployment named +# "wordpress" becomes "alices-wordpress". +# Note that it should also match with the prefix (text before '-') of the namespace +# field above. +#namePrefix: elasti-resolver- + +# Labels to add to all resources and selectors. +#labels: +#- includeSelectors: true +# pairs: +# someName: someValue + +resources: +- deployment.yaml +- service.yaml +# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in +# crd/kustomization.yaml +#- ../webhook +# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. +#- ../certmanager +# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. +#- ../prometheus + +patches: [] +# [METRICS] The following patch will enable the metrics endpoint. Ensure that you also protect this endpoint. +# More info: https://book.kubebuilder.io/reference/metrics +# If you want to expose the metric endpoint of your controller-manager uncomment the following line. +#- path: manager_metrics_patch.yaml + +# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in +# crd/kustomization.yaml +#- path: manager_webhook_patch.yaml + +# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. +# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks. +# 'CERTMANAGER' needs to be enabled to use ca injection +#- path: webhookcainjection_patch.yaml + +# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. +# Uncomment the following replacements to add the cert-manager CA injection annotations +#replacements: +# - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs +# kind: Certificate +# group: cert-manager.io +# version: v1 +# name: serving-cert # this name should match the one in certificate.yaml +# fieldPath: .metadata.namespace # namespace of the certificate CR +# targets: +# - select: +# kind: ValidatingWebhookConfiguration +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 0 +# create: true +# - select: +# kind: MutatingWebhookConfiguration +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 0 +# create: true +# - select: +# kind: CustomResourceDefinition +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 0 +# create: true +# - source: +# kind: Certificate +# group: cert-manager.io +# version: v1 +# name: serving-cert # this name should match the one in certificate.yaml +# fieldPath: .metadata.name +# targets: +# - select: +# kind: ValidatingWebhookConfiguration +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 1 +# create: true +# - select: +# kind: MutatingWebhookConfiguration +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 1 +# create: true +# - select: +# kind: CustomResourceDefinition +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 1 +# create: true +# - source: # Add cert-manager annotation to the webhook Service +# kind: Service +# version: v1 +# name: webhook-service +# fieldPath: .metadata.name # namespace of the service +# targets: +# - select: +# kind: Certificate +# group: cert-manager.io +# version: v1 +# fieldPaths: +# - .spec.dnsNames.0 +# - .spec.dnsNames.1 +# options: +# delimiter: '.' +# index: 0 +# create: true +# - source: +# kind: Service +# version: v1 +# name: webhook-service +# fieldPath: .metadata.namespace # namespace of the service +# targets: +# - select: +# kind: Certificate +# group: cert-manager.io +# version: v1 +# fieldPaths: +# - .spec.dnsNames.0 +# - .spec.dnsNames.1 +# options: +# delimiter: '.' +# index: 1 +# create: true diff --git a/resolver/install.yaml b/resolver/install.yaml new file mode 100644 index 00000000..47bc5ebc --- /dev/null +++ b/resolver/install.yaml @@ -0,0 +1,45 @@ +apiVersion: v1 +kind: Service +metadata: + name: resolver-service + namespace: elasti +spec: + ports: + - name: http-playground + port: 8012 + protocol: TCP + selector: + app: elasti-resolver + type: LoadBalancer +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: elasti-resolver + namespace: elasti +spec: + replicas: 1 + selector: + matchLabels: + app: elasti-resolver + template: + metadata: + labels: + app: elasti-resolver + spec: + containers: + - env: + - name: SYSTEM_NAMESPACE + value: elasti + image: ramantehlan/elasti-resolver:v1alpha1 + imagePullPolicy: Always + name: playground + ports: + - containerPort: 8012 + resources: + limits: + cpu: 750m + memory: 1Gi + requests: + cpu: 250m + memory: 500Mi