Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not creating app deployments #78

Merged
merged 15 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ helm-upgrade-operator:
.PHONY: helm-delete-operator
helm-delete-operator:
helm delete -n ${NAMESPACE} kedahttp

.PHONY: generate-operator
generate-operator:
cd operator && \
make manifests && \
cp config/crd/bases/http.keda.sh_httpscaledobjects.yaml ../charts/keda-http-operator/crds/httpscaledobjects.http.keda.sh.yaml

#####
# universal targets
Expand Down
235 changes: 123 additions & 112 deletions charts/keda-http-operator/crds/httpscaledobjects.http.keda.sh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,119 +16,130 @@ spec:
singular: httpscaledobject
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: HTTPScaledObject is the Schema for the scaledobjects API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: HTTPScaledObjectSpec defines the desired state of HTTPScaledObject
properties:
app_image:
description: The image this application will use.
type: string
app_name:
description: (optional) The name of the application to be created.
type: string
max_replicas:
description: Maximum amount of replicas to have in the deployment (Default 100)
format: int32
type: integer
min_replicas:
description: Minimum amount of replicas to have in the deployment (Default 0)
format: int32
type: integer
port:
description: The port this application will serve on.
format: int32
type: integer
required:
- app_image
- name: v1alpha1
schema:
openAPIV3Schema:
description: HTTPScaledObject is the Schema for the scaledobjects API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: HTTPScaledObjectSpec defines the desired state of HTTPScaledObject
properties:
replicas:
description: (optional) Replica information
properties:
max:
description: Maximum amount of replicas to have in the deployment (Default 100)
format: int32
type: integer
min:
description: Minimum amount of replicas to have in the deployment (Default 0)
format: int32
type: integer
type: object
scaleTargetRef:
description: The name of the deployment to route HTTP requests to (and to autoscale). Either this or Image must be set
properties:
deployment:
description: The name of the deployment to scale according to HTTP traffic
type: string
port:
description: The port to route to
format: int32
type: integer
service:
description: The name of the service to route to
type: string
required:
- deployment
- port
type: object
status:
description: HTTPScaledObjectStatus defines the observed state of HTTPScaledObject
properties:
conditions:
description: List of auditable conditions of the operator
items:
description: Condition to store the condition state
properties:
message:
description: A human readable message indicating details about the transition.
type: string
reason:
description: The reason for the condition's last transition.
enum:
- ErrorCreatingExternalScaler
- ErrorCreatingExternalScalerService
- CreatedExternalScaler
- ErrorCreatingAppDeployment
- AppDeploymentCreated
- ErrorCreatingAppService
- AppServiceCreated
- ErrorCreatingScaledObject
- ScaledObjectCreated
- ErrorCreatingInterceptor
- ErrorCreatingInterceptorAdminService
- ErrorCreatingInterceptorProxyService
- InterceptorCreated
- TerminatingResources
- AppDeploymentTerminationError
- AppDeploymentTerminated
- InterceptorDeploymentTerminated
- InterceptorDeploymentTerminationError
- InterceptorAdminServiceTerminationError
- InterceptorAdminServiceTerminated
- InterceptorProxyServiceTerminationError
- InterceptorProxyServiceTerminated
- ExternalScalerDeploymentTerminationError
- ExternalScalerDeploymentTerminated
- ExternalScalerServiceTerminationError
- ExternalScalerServiceTerminated
- AppServiceTerminationError
- AppServiceTerminated
- ScaledObjectTerminated
- ScaledObjectTerminationError
- PendingCreation
- HTTPScaledObjectIsReady
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
timestamp:
description: Timestamp of the condition
type: string
type:
description: Type of condition
enum:
- Created
- Error
- Pending
- Unknown
- Terminating
- Terminated
- Ready
type: string
required:
- status
- type
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: { }
- service
type: object
required:
- scaleTargetRef
type: object
status:
description: HTTPScaledObjectStatus defines the observed state of HTTPScaledObject
properties:
conditions:
description: List of auditable conditions of the operator
items:
description: Condition to store the condition state
properties:
message:
description: A human readable message indicating details about the transition.
type: string
reason:
description: The reason for the condition's last transition.
enum:
- ErrorCreatingExternalScaler
- ErrorCreatingExternalScalerService
- CreatedExternalScaler
- ErrorCreatingAppDeployment
- AppDeploymentCreated
- ErrorCreatingAppService
- AppServiceCreated
- ErrorCreatingScaledObject
- ScaledObjectCreated
- ErrorCreatingInterceptor
- ErrorCreatingInterceptorAdminService
- ErrorCreatingInterceptorProxyService
- InterceptorCreated
- TerminatingResources
- AppDeploymentTerminationError
- AppDeploymentTerminated
- InterceptorDeploymentTerminated
- InterceptorDeploymentTerminationError
- InterceptorAdminServiceTerminationError
- InterceptorAdminServiceTerminated
- InterceptorProxyServiceTerminationError
- InterceptorProxyServiceTerminated
- ExternalScalerDeploymentTerminationError
- ExternalScalerDeploymentTerminated
- ExternalScalerServiceTerminationError
- ExternalScalerServiceTerminated
- AppServiceTerminationError
- AppServiceTerminated
- ScaledObjectTerminated
- ScaledObjectTerminationError
- PendingCreation
- HTTPScaledObjectIsReady
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
timestamp:
description: Timestamp of the condition
type: string
type:
description: Type of condition
enum:
- Created
- Error
- Pending
- Unknown
- Terminating
- Terminated
- Ready
type: string
required:
- status
- type
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
Expand Down
23 changes: 23 additions & 0 deletions charts/xkcd/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions charts/xkcd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: xkcd
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
22 changes: 22 additions & 0 deletions charts/xkcd/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "xkcd.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "xkcd.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "xkcd.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "xkcd.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions charts/xkcd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "xkcd.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "xkcd.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "xkcd.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "xkcd.labels" -}}
helm.sh/chart: {{ include "xkcd.chart" . }}
{{ include "xkcd.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "xkcd.selectorLabels" -}}
app.kubernetes.io/name: {{ include "xkcd.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "xkcd.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "xkcd.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading