更改inject打包逻辑
This commit is contained in:
23
ansible/roles/packet_adapter/files/helm/.helmignore
Normal file
23
ansible/roles/packet_adapter/files/helm/.helmignore
Normal file
@@ -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
ansible/roles/packet_adapter/files/helm/Chart.yaml
Normal file
24
ansible/roles/packet_adapter/files/helm/Chart.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: helm
|
||||||
|
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"
|
||||||
@@ -14,5 +14,5 @@ statsd_port=8100
|
|||||||
# 2 : FS_OUTPUT_INFLUX_LINE
|
# 2 : FS_OUTPUT_INFLUX_LINE
|
||||||
statsd_format=1
|
statsd_format=1
|
||||||
statsd_cycle=2
|
statsd_cycle=2
|
||||||
prometheus_listen_port=9001
|
prometheus_listen_port=9009
|
||||||
prometheus_listen_url=/sce_prometheus
|
prometheus_listen_url=/packet_adapter_prometheus
|
||||||
125
ansible/roles/packet_adapter/files/helm/templates/_config.tpl
Normal file
125
ansible/roles/packet_adapter/files/helm/templates/_config.tpl
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
{{- define "traffic-engine.mount.mrzcpd" -}}
|
||||||
|
- name: opt-tsg-mrzcpd
|
||||||
|
mountPath: /opt/tsg/mrzcpd
|
||||||
|
readOnly: false
|
||||||
|
- name: var-run-mrzcpd
|
||||||
|
mountPath: /var/run/mrzcpd
|
||||||
|
readOnly: false
|
||||||
|
- name: var-run-dpdk
|
||||||
|
mountPath: /var/run/dpdk
|
||||||
|
readOnly: false
|
||||||
|
- name: root-sys
|
||||||
|
mountPath: /root/sys
|
||||||
|
readOnly: false
|
||||||
|
- name: profile-mrzcpd
|
||||||
|
mountPath: /etc/profile.d/mrzcpd.sh
|
||||||
|
readOnly: true
|
||||||
|
- name: ldconfig-mrzcpd
|
||||||
|
mountPath: /etc/ld.so.conf.d/mrzcpd.conf
|
||||||
|
readOnly: true
|
||||||
|
- name: sysconfig-mrzcpd
|
||||||
|
mountPath: /etc/sysconfig/mrzcpd
|
||||||
|
readOnly: true
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.mount.localtime" -}}
|
||||||
|
- name: localtime-node
|
||||||
|
mountPath: /etc/localtime
|
||||||
|
readOnly: true
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.volume.mrzcpd" -}}
|
||||||
|
- name: opt-tsg-mrzcpd
|
||||||
|
hostPath:
|
||||||
|
path: /opt/tsg/mrzcpd
|
||||||
|
- name: var-run-mrzcpd
|
||||||
|
hostPath:
|
||||||
|
path: /var/run/mrzcpd
|
||||||
|
- name: var-run-dpdk
|
||||||
|
hostPath:
|
||||||
|
path: /var/run/dpdk
|
||||||
|
- name: root-sys
|
||||||
|
hostPath:
|
||||||
|
path: /root/sys
|
||||||
|
- name: profile-mrzcpd
|
||||||
|
hostPath:
|
||||||
|
path: /etc/profile.d/mrzcpd.sh
|
||||||
|
type: File
|
||||||
|
- name: ldconfig-mrzcpd
|
||||||
|
hostPath:
|
||||||
|
path: /etc/ld.so.conf.d/mrzcpd.conf
|
||||||
|
type: File
|
||||||
|
- name: sysconfig-mrzcpd
|
||||||
|
hostPath:
|
||||||
|
path: /etc/sysconfig/mrzcpd
|
||||||
|
type: File
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.volume.hostpath" -}}
|
||||||
|
- name: host-root
|
||||||
|
hostPath:
|
||||||
|
path: /
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.volume.localtime" -}}
|
||||||
|
- name: localtime-node
|
||||||
|
hostPath:
|
||||||
|
path: /etc/localtime
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.inject_adapter.workerthread" -}}
|
||||||
|
{{- len .Values.inject_adapter_affinity }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.inject_adapter.cpu-affinity" -}}
|
||||||
|
{{- join "," .Values.inject_adapter_affinity }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.inject_adapter.copy-config-to-dest" -}}
|
||||||
|
cp /opt/tsg/config/packet_adapter.conf /opt/tsg/packet_adapter/conf
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.inject_adapter.mount.hostpath" -}}
|
||||||
|
{{- if eq .Values.debug.inject_adapter.enable_mount_host_filesystem .Values.define_enable_val_yes }}
|
||||||
|
- name: host-root
|
||||||
|
mountPath: /host
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.inject_adapter.start" -}}
|
||||||
|
{{- if eq .Values.debug.inject_adapter.enable_interactive_startup .Values.define_enable_val_yes -}}
|
||||||
|
while true; do sleep 10;done
|
||||||
|
{{- else -}}
|
||||||
|
exec /opt/tsg/packet_adapter/bin/packet_adapter
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.inject_adapter.volume.prestart" -}}
|
||||||
|
{{- if eq .Values.debug.inject_adapter.enable_prestart_script .Values.define_enable_val_yes }}
|
||||||
|
- name: inject-adapter-prestart
|
||||||
|
hostPath:
|
||||||
|
{{- if .Values.debug.inject_adapter.prestart_script }}
|
||||||
|
path: {{ .Values.debug.inject_adapter.prestart_script }}
|
||||||
|
{{- else }}
|
||||||
|
path: /etc/tsg-os/{{ .Release.Name }}/inject_adapter_prestart_script.sh
|
||||||
|
{{- end }}
|
||||||
|
type: FileOrCreate
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.inject_adapter.mount.prestart" -}}
|
||||||
|
{{- if eq .Values.debug.inject_adapter.enable_prestart_script .Values.define_enable_val_yes }}
|
||||||
|
- name: prestart-dir
|
||||||
|
mountPath: /tmp/prestart
|
||||||
|
- name: inject-adapter-prestart
|
||||||
|
mountPath: /opt/tsg/scripts/prestart.sh
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "traffic-engine.inject_adapter.prestart" -}}
|
||||||
|
{{- if eq .Values.debug.inject_adapter.enable_prestart_script .Values.define_enable_val_yes }}
|
||||||
|
chmod 0755 /opt/tsg/scripts/prestart.sh
|
||||||
|
/opt/tsg/scripts/prestart.sh
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
@@ -20,11 +20,10 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: {{ .Release.Name }}-inject-adapter
|
app: {{ .Release.Name }}-inject-adapter
|
||||||
vsysId: "{{ .Values.vsys_id }}"
|
|
||||||
serviceFunction: {{ .Release.Name }}
|
serviceFunction: {{ .Release.Name }}
|
||||||
component: inject_adapter
|
component: inject_adapter
|
||||||
annotations:
|
annotations:
|
||||||
prometheus.io/port: "9007"
|
prometheus.io/port: "9009"
|
||||||
prometheus.io/scrape: "true"
|
prometheus.io/scrape: "true"
|
||||||
|
|
||||||
spec:
|
spec:
|
||||||
@@ -49,7 +48,7 @@ spec:
|
|||||||
{{ template "traffic-engine.inject_adapter.prestart" . }}
|
{{ template "traffic-engine.inject_adapter.prestart" . }}
|
||||||
{{ template "traffic-engine.inject_adapter.start" . }}
|
{{ template "traffic-engine.inject_adapter.start" . }}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 9007
|
- containerPort: 9009
|
||||||
env:
|
env:
|
||||||
- name: SERVICENAME
|
- name: SERVICENAME
|
||||||
value: inject-adapter-announce-port-{{ .Release.Name }}
|
value: inject-adapter-announce-port-{{ .Release.Name }}
|
||||||
@@ -68,12 +67,12 @@ spec:
|
|||||||
{{- if eq .Values.debug.inject_adapter.enable_liveness_probe .Values.define_enable_val_yes }}
|
{{- if eq .Values.debug.inject_adapter.enable_liveness_probe .Values.define_enable_val_yes }}
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: 9007
|
port: 9009
|
||||||
failureThreshold: 1
|
failureThreshold: 1
|
||||||
timeoutSeconds: 10
|
timeoutSeconds: 10
|
||||||
startupProbe:
|
startupProbe:
|
||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: 9007
|
port: 9009
|
||||||
failureThreshold: 30
|
failureThreshold: 30
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -104,4 +103,4 @@ spec:
|
|||||||
{{ template "traffic-engine.volume.localtime" . }}
|
{{ template "traffic-engine.volume.localtime" . }}
|
||||||
{{ template "traffic-engine.inject_adapter.volume.prestart" . }}
|
{{ template "traffic-engine.inject_adapter.volume.prestart" . }}
|
||||||
{{ template "traffic-engine.volume.hostpath" . }}
|
{{ template "traffic-engine.volume.hostpath" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -2,7 +2,7 @@ apiVersion: v1
|
|||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
name: inject-adapter-{{ .Release.Name }}
|
name: inject-adapter-{{ .Release.Name }}
|
||||||
namespace: default
|
namespace: tsg-os-system
|
||||||
data:
|
data:
|
||||||
packet_adapter.conf: {{ tpl (.Files.Get "conf/packet_adapter.conf") . | quote }}
|
packet_adapter.conf: {{ tpl (.Files.Get "conf/packet_adapter.conf") . | quote }}
|
||||||
tsg_device_tag.json: {{ tpl (.Files.Get "conf/tsg_device_tag.json") . | quote }}
|
tsg_device_tag.json: {{ tpl (.Files.Get "conf/tsg_device_tag.json") . | quote }}
|
||||||
100
ansible/roles/packet_adapter/files/helm/values.yaml
Normal file
100
ansible/roles/packet_adapter/files/helm/values.yaml
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
# Default values for helm.
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
# Declare variables to be passed into your templates.
|
||||||
|
|
||||||
|
replicaCount: 1
|
||||||
|
|
||||||
|
|
||||||
|
inject_adapter_affinity: [95]
|
||||||
|
|
||||||
|
inject_adapter:
|
||||||
|
enable: yes
|
||||||
|
|
||||||
|
inject_adapter_config:
|
||||||
|
inject_adapter_nic: nf_1_shaping_engine
|
||||||
|
|
||||||
|
debug:
|
||||||
|
inject_adapter:
|
||||||
|
enable_liveness_probe: yes
|
||||||
|
enable_interactive_startup: no
|
||||||
|
enable_prestart_script: no
|
||||||
|
enable_mount_host_filesystem: no
|
||||||
|
#default: /etc/tsg-os/${service_function_name}/shaping_prestart_script.sh
|
||||||
|
prestart_script: ""
|
||||||
|
|
||||||
|
image:
|
||||||
|
repository: nginx
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
|
tag: ""
|
||||||
|
|
||||||
|
imagePullSecrets: []
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
# Specifies whether a service account should be created
|
||||||
|
create: true
|
||||||
|
# Annotations to add to the service account
|
||||||
|
annotations: {}
|
||||||
|
# The name of the service account to use.
|
||||||
|
# If not set and create is true, a name is generated using the fullname template
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
podSecurityContext: {}
|
||||||
|
# fsGroup: 2000
|
||||||
|
|
||||||
|
securityContext: {}
|
||||||
|
# capabilities:
|
||||||
|
# drop:
|
||||||
|
# - ALL
|
||||||
|
# readOnlyRootFilesystem: true
|
||||||
|
# runAsNonRoot: true
|
||||||
|
# runAsUser: 1000
|
||||||
|
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
className: ""
|
||||||
|
annotations: {}
|
||||||
|
# kubernetes.io/ingress.class: nginx
|
||||||
|
# kubernetes.io/tls-acme: "true"
|
||||||
|
hosts:
|
||||||
|
- host: chart-example.local
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: ImplementationSpecific
|
||||||
|
tls: []
|
||||||
|
# - secretName: chart-example-tls
|
||||||
|
# hosts:
|
||||||
|
# - chart-example.local
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
# limits:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
# requests:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
autoscaling:
|
||||||
|
enabled: false
|
||||||
|
minReplicas: 1
|
||||||
|
maxReplicas: 100
|
||||||
|
targetCPUUtilizationPercentage: 80
|
||||||
|
# targetMemoryUtilizationPercentage: 80
|
||||||
|
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
affinity: {}
|
||||||
25
ansible/roles/packet_adapter/files/inject-adapter-crd.yaml
Normal file
25
ansible/roles/packet_adapter/files/inject-adapter-crd.yaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
apiVersion: helm.cattle.io/v1
|
||||||
|
kind: HelmChart
|
||||||
|
metadata:
|
||||||
|
name: inject-adapter
|
||||||
|
namespace: kube-system
|
||||||
|
spec:
|
||||||
|
chart: https://%{KUBERNETES_API}%/static/charts/inject-adapter-1.0.1.tgz
|
||||||
|
targetNamespace: tsg-os-system
|
||||||
|
valuesContent: |-
|
||||||
|
inject_adapter_affinity: [95]
|
||||||
|
|
||||||
|
inject_adapter:
|
||||||
|
enable: yes
|
||||||
|
|
||||||
|
inject_adapter_config:
|
||||||
|
inject_adapter_nic: nf_1_shaping_engine
|
||||||
|
|
||||||
|
debug:
|
||||||
|
inject_adapter:
|
||||||
|
enable_liveness_probe: yes
|
||||||
|
enable_interactive_startup: no
|
||||||
|
enable_prestart_script: no
|
||||||
|
enable_mount_host_filesystem: no
|
||||||
|
#default: /etc/tsg-os/${service_function_name}/shaping_prestart_script.sh
|
||||||
|
prestart_script: ""
|
||||||
@@ -11,6 +11,8 @@ HELM_CHART_TAR_GLOB := traffic-engine-*.tgz
|
|||||||
|
|
||||||
TARGET_BUILD_DIR := $(BUILDDIR_BASE)/$(PROFILE_ID)/containers
|
TARGET_BUILD_DIR := $(BUILDDIR_BASE)/$(PROFILE_ID)/containers
|
||||||
TARGET_INSTALLER_DIR := $(TARGET_BUILD_DIR)/installer
|
TARGET_INSTALLER_DIR := $(TARGET_BUILD_DIR)/installer
|
||||||
|
TRAFFIC_ENGINE_HELM_FILE_PATH := /ansible/roles/traffic-engine/files/helm
|
||||||
|
INJECT_ADAPTER_HELM_FILE_PATH := /ansible/roles/packet_adapter/files/helm
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all build_dir installer clean_installer_dir prebuild_container_images build_container_images build_helm_charts build_app_bundle_bin
|
.PHONY: all build_dir installer clean_installer_dir prebuild_container_images build_container_images build_helm_charts build_app_bundle_bin
|
||||||
@@ -49,7 +51,8 @@ build_container_images: prebuild_container_images
|
|||||||
|
|
||||||
build_helm_charts: build_dir
|
build_helm_charts: build_dir
|
||||||
chmod 0755 $(PROJECTDIR)/tools/build_helm_charts.sh
|
chmod 0755 $(PROJECTDIR)/tools/build_helm_charts.sh
|
||||||
$(PROJECTDIR)/tools/build_helm_charts.sh $(PROJECTDIR) $(OS_RELEASE_VER) $(HELM_CHART_VER) $(TARGET_INSTALLER_DIR)
|
$(PROJECTDIR)/tools/build_helm_charts.sh $(PROJECTDIR) $(OS_RELEASE_VER) $(HELM_CHART_VER) $(TARGET_INSTALLER_DIR) $(TRAFFIC_ENGINE_HELM_FILE_PATH)
|
||||||
|
$(PROJECTDIR)/tools/build_helm_charts.sh $(PROJECTDIR) $(OS_RELEASE_VER) $(HELM_CHART_VER) $(TARGET_INSTALLER_DIR) $(INJECT_ADAPTER_HELM_FILE_PATH)
|
||||||
|
|
||||||
build_app_bundle_bin: clean_installer_dir installer build_helm_charts build_container_images
|
build_app_bundle_bin: clean_installer_dir installer build_helm_charts build_container_images
|
||||||
mkdir -p $(TARGET_BUILD_DIR)/app-bundle-cook-bits
|
mkdir -p $(TARGET_BUILD_DIR)/app-bundle-cook-bits
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ CODE_PROJECT_DIR=$1
|
|||||||
OS_RELEASE_VER=$2
|
OS_RELEASE_VER=$2
|
||||||
WRITE_HELM_CHART_VER=$3
|
WRITE_HELM_CHART_VER=$3
|
||||||
WRITE_HELM_CHART_DIR=$4
|
WRITE_HELM_CHART_DIR=$4
|
||||||
|
WRITE_HELM_CHART_FILE_PATH=$5
|
||||||
##function define start
|
##function define start
|
||||||
function build_helm_charts()
|
function build_helm_charts()
|
||||||
{
|
{
|
||||||
mkdir -p /tmp/helm
|
mkdir -p /tmp/helm
|
||||||
tar -zxvf ${CODE_PROJECT_DIR}/ansible/roles/traffic-engine/files/helm-linux-amd64.tar.gz -C /tmp/helm
|
tar -zxvf ${CODE_PROJECT_DIR}/ansible/roles/traffic-engine/files/helm-linux-amd64.tar.gz -C /tmp/helm
|
||||||
/tmp/helm/linux-amd64/helm package --app-version ${OS_RELEASE_VER} --version ${WRITE_HELM_CHART_VER} -d ${WRITE_HELM_CHART_DIR} ${CODE_PROJECT_DIR}/ansible/roles/traffic-engine/files/helm
|
/tmp/helm/linux-amd64/helm package --app-version ${OS_RELEASE_VER} --version ${WRITE_HELM_CHART_VER} -d ${WRITE_HELM_CHART_DIR} ${CODE_PROJECT_DIR}${WRITE_HELM_CHART_FILE_PATH}
|
||||||
rm -rf /tmp/helm
|
rm -rf /tmp/helm
|
||||||
}
|
}
|
||||||
##function define end
|
##function define end
|
||||||
|
|||||||
Reference in New Issue
Block a user