diff --git a/http-add-on/templates/crd.yaml b/http-add-on/templates/crd.yaml index 1fee160e..dcc60638 100644 --- a/http-add-on/templates/crd.yaml +++ b/http-add-on/templates/crd.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: httpscaledobjects.http.keda.sh spec: @@ -18,9 +18,6 @@ spec: scope: Namespaced versions: - additionalPrinterColumns: - - jsonPath: .spec.targetPendingRequests - name: TargetPendingRequests - type: integer - jsonPath: .spec.scaleTargetRef.deploymentName name: ScaleTargetDeploymentName type: string @@ -80,9 +77,6 @@ spec: format: int32 type: integer type: object - targetPendingRequests: - description: Value for the pending requests that the scaler will return to KEDA - type: integer scaleTargetRef: description: The name of the deployment to route HTTP requests to (and to autoscale). Either this or Image must be set @@ -103,6 +97,14 @@ spec: - port - service type: object + scaledownPeriod: + description: (optional) Cooldown period value + format: int32 + type: integer + targetPendingRequests: + description: (optional) Target metric value + format: int32 + type: integer required: - host - scaleTargetRef @@ -158,11 +160,5 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] - {{ end }} +{{ end }} \ No newline at end of file diff --git a/http-add-on/templates/deployment-interceptor.yaml b/http-add-on/templates/deployment-interceptor.yaml index ca9e382d..98c5f4ed 100644 --- a/http-add-on/templates/deployment-interceptor.yaml +++ b/http-add-on/templates/deployment-interceptor.yaml @@ -41,6 +41,7 @@ spec: spec: imagePullSecrets: {{- toYaml .Values.interceptor.imagePullSecrets | nindent 8 }} + serviceAccountName: {{ .Chart.Name }} containers: - args: image: "{{ .Values.images.interceptor }}:{{ .Values.images.tag | default .Chart.AppVersion }}" diff --git a/http-add-on/templates/deployment-operator.yaml b/http-add-on/templates/deployment-operator.yaml index 338e9a83..13b9c91b 100644 --- a/http-add-on/templates/deployment-operator.yaml +++ b/http-add-on/templates/deployment-operator.yaml @@ -31,6 +31,7 @@ spec: spec: imagePullSecrets: {{- toYaml .Values.operator.imagePullSecrets | nindent 8 }} + serviceAccountName: {{ .Chart.Name }} containers: - args: - --secure-listen-address=0.0.0.0:{{ .Values.operator.port | default 8443 }} @@ -61,7 +62,6 @@ spec: value: "{{ .Release.Namespace }}" - name: KEDA_HTTP_OPERATOR_WATCH_NAMESPACE value: "{{ .Values.operator.watchNamespace }}" - ports: - containerPort: {{ .Values.operator.adminPort }} name: admin-http diff --git a/http-add-on/templates/deployment-scaler.yaml b/http-add-on/templates/deployment-scaler.yaml index 1787b6e3..51cc10d0 100644 --- a/http-add-on/templates/deployment-scaler.yaml +++ b/http-add-on/templates/deployment-scaler.yaml @@ -41,6 +41,7 @@ spec: spec: imagePullSecrets: {{- toYaml .Values.scaler.imagePullSecrets | nindent 8 }} + serviceAccountName: {{ .Chart.Name }} containers: - args: image: "{{ .Values.images.scaler }}:{{ .Values.images.tag | default .Chart.AppVersion }}" diff --git a/http-add-on/templates/rbac.yml b/http-add-on/templates/rbac.yml index d60b0fb2..af03dc1e 100644 --- a/http-add-on/templates/rbac.yml +++ b/http-add-on/templates/rbac.yml @@ -5,10 +5,10 @@ metadata: httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }} keda.sh/addon: {{ .Chart.Name }} app: {{ .Chart.Name }} - name: {{ .Chart.Name }}-leader-election-role - app.kubernetes.io/name: {{ .Chart.Name }}-leader-election-role + name: {{ .Chart.Name }}-role + app.kubernetes.io/name: {{ .Chart.Name }}-role {{- include "keda-addons-http.labels" . | indent 4 }} - name: {{ .Chart.Name }}-leader-election-role + name: {{ .Chart.Name }}-role namespace: {{ .Release.Namespace }} rules: - apiGroups: @@ -16,27 +16,7 @@ rules: resources: - configmaps verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - configmaps/status - verbs: - - get - - update - - patch -- apiGroups: - - "" - resources: - - events - verbs: - - create + - '*' --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole @@ -46,19 +26,22 @@ metadata: httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }} keda.sh/addon: {{ .Chart.Name }} app: {{ .Chart.Name }} - name: {{ .Chart.Name }}-manager-role - app.kubernetes.io/name: {{ .Chart.Name }}-manager-role + name: {{ .Chart.Name }}-role + app.kubernetes.io/name: {{ .Chart.Name }}-role {{- include "keda-addons-http.labels" . | indent 4 }} - name: {{ .Chart.Name }}-manager-role + name: {{ .Chart.Name }}-role +rules: rules: - apiGroups: - "" resources: - configmaps + - configmaps/status + - endpoint + - endpoints + - events - pods - services - - endpoints - - endpoint verbs: - create - delete @@ -76,17 +59,15 @@ rules: - list - watch - apiGroups: - - keda.sh + - coordination.k8s.io resources: - - scaledobjects + - leases verbs: - create - delete - get - list - update - - patch - - watch - apiGroups: - http.keda.sh resources: @@ -108,15 +89,17 @@ rules: - patch - update - apiGroups: - - coordination.k8s.io + - keda.sh resources: - - leases + - scaledobjects verbs: - - get - - list - create - delete + - get + - list + - patch - update + - watch - apiGroups: - networking resources: @@ -131,6 +114,7 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: + creationTimestamp: null labels: httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }} keda.sh/addon: {{ .Chart.Name }} @@ -140,18 +124,14 @@ metadata: {{- include "keda-addons-http.labels" . | indent 4 }} name: {{ .Chart.Name }}-proxy-role rules: -- apiGroups: - - authentication.k8s.io +- apiGroups: ["authentication.k8s.io"] resources: - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io + verbs: ["create"] +- apiGroups: ["authorization.k8s.io"] resources: - subjectaccessreviews - verbs: - - create + verbs: ["create"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole @@ -177,18 +157,18 @@ metadata: httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }} keda.sh/addon: {{ .Chart.Name }} app: {{ .Chart.Name }} - name: {{ .Chart.Name }}-leader-election-binding - app.kubernetes.io/name: {{ .Chart.Name }}-leader-election-binding + name: {{ .Chart.Name }}-role-binding + app.kubernetes.io/name: {{ .Chart.Name }}-role-binding {{- include "keda-addons-http.labels" . | indent 4 }} - name: {{ .Chart.Name }}-leader-election-rolebinding + name: {{ .Chart.Name }}-role-rolebinding namespace: {{ .Release.Namespace }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role - name: {{ .Chart.Name }}-leader-election-role + name: {{ .Chart.Name }}-role subjects: - kind: ServiceAccount - name: default + name: {{ .Chart.Name }} namespace: {{ .Release.Namespace }} --- apiVersion: rbac.authorization.k8s.io/v1 @@ -198,17 +178,17 @@ metadata: httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }} keda.sh/addon: {{ .Chart.Name }} app: {{ .Chart.Name }} - name: {{ .Chart.Name }}-manager-rolebinding - app.kubernetes.io/name: {{ .Chart.Name }}-manager-rolebinding + name: {{ .Chart.Name }}-rolebinding + app.kubernetes.io/name: {{ .Chart.Name }}-rolebinding {{- include "keda-addons-http.labels" . | indent 4 }} - name: {{ .Chart.Name }}-manager-rolebinding + name: {{ .Chart.Name }}-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: {{ .Chart.Name }}-manager-role + name: {{ .Chart.Name }}-role subjects: - kind: ServiceAccount - name: default + name: {{ .Chart.Name }} namespace: {{ .Release.Namespace }} --- apiVersion: rbac.authorization.k8s.io/v1 @@ -218,8 +198,8 @@ metadata: httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }} keda.sh/addon: {{ .Chart.Name }} app: {{ .Chart.Name }} - name: {{ .Chart.Name }}-proxy-rolebinding - app.kubernetes.io/name: {{ .Chart.Name }}-proxy-rolebinding + name: {{ .Chart.Name }}-rolebinding + app.kubernetes.io/name: {{ .Chart.Name }}-rolebinding {{- include "keda-addons-http.labels" . | indent 4 }} name: {{ .Chart.Name }}-proxy-rolebinding roleRef: @@ -228,5 +208,5 @@ roleRef: name: {{ .Chart.Name }}-proxy-role subjects: - kind: ServiceAccount - name: default + name: {{ .Chart.Name }} namespace: {{ .Release.Namespace }} diff --git a/http-add-on/templates/routing-table-config-map.yaml b/http-add-on/templates/routing-table-config-map.yaml index dba3e173..b3bbd3e5 100644 --- a/http-add-on/templates/routing-table-config-map.yaml +++ b/http-add-on/templates/routing-table-config-map.yaml @@ -1,12 +1,21 @@ apiVersion: v1 kind: ConfigMap metadata: - name: keda-http-routing-table labels: - "control-plane": "operator" - "keda.sh/addon": "http-add-on" - "app": "http-add-on" - "name": "http-add-on-routing-table" + control-plane: external-scaler + httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }} + keda.sh/addon: {{ .Chart.Name }} + app: {{ .Chart.Name }} + name: {{ .Chart.Name }}-external-scaler + app.kubernetes.io/name: {{ .Chart.Name }}-external-scaler + app.kubernetes.io/version: {{ .Values.images.tag | default .Chart.AppVersion }} + app.kubernetes.io/component: external-scaler + app.kubernetes.io/part-of: {{ .Chart.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} +{{ tpl .Values.additionalLabels . | indent 4}} + name: keda-http-routing-table + namespace: {{ .Release.Namespace }} data: # this is where the operator writes the encoded routing table, # and where the interceptor/scaler reads it diff --git a/http-add-on/templates/scaledobject-interceptor.yaml b/http-add-on/templates/scaledobject-interceptor.yaml index 27aee00a..32e66825 100644 --- a/http-add-on/templates/scaledobject-interceptor.yaml +++ b/http-add-on/templates/scaledobject-interceptor.yaml @@ -3,6 +3,7 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: "{{ .Chart.Name }}-interceptor" + namespace: {{ .Release.Namespace }} spec: minReplicaCount: {{ .Values.interceptor.replicas.min }} maxReplicaCount: {{ .Values.interceptor.replicas.max }} diff --git a/http-add-on/templates/serviceaccount.yaml b/http-add-on/templates/serviceaccount.yaml new file mode 100644 index 00000000..aa5933b9 --- /dev/null +++ b/http-add-on/templates/serviceaccount.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }} + keda.sh/addon: {{ .Chart.Name }} + app: {{ .Chart.Name }} + name: {{ .Chart.Name }} + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/version: {{ .Values.images.tag | default .Chart.AppVersion }} + app.kubernetes.io/part-of: {{ .Chart.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + {{ tpl .Values.additionalLabels . | indent 4}} + name: {{ .Chart.Name }} + namespace: {{ .Release.Namespace }}