-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yongzhi.yang
committed
Jun 20, 2019
1 parent
ca04b14
commit 13cf089
Showing
1,854 changed files
with
283,444 additions
and
30,420 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# | ||
# make - default to 'build' target | ||
# make test - run unit test | ||
# make build - build local binary targets | ||
# make docker-build - build local binary targets by docker | ||
# make container - build containers | ||
# make push - push containers | ||
# make clean - clean up targets | ||
# | ||
# The makefile is also responsible to populate project version information. | ||
|
||
# | ||
# Tweak the variables based on your project. | ||
# | ||
|
||
# Current version of the project. | ||
VERSION ?= v0.0.1 | ||
|
||
# Target binaries. You can build multiple binaries for a single project. | ||
TARGETS := sym-operator | ||
|
||
# Container registries. | ||
# REGISTRIES := hub.tencentyun.com/xkcp0324/ | ||
REGISTRIES := hub.tencentyun.com/demo001/ | ||
|
||
# Container image prefix and suffix added to targets. | ||
# The final built images are: | ||
# $[REGISTRY]$[IMAGE_PREFIX]$[TARGET]$[IMAGE_SUFFIX]:$[VERSION] | ||
# $[REGISTRY] is an item from $[REGISTRIES], $[TARGET] is an item from $[TARGETS]. | ||
IMAGE_PREFIX ?= $(strip ) | ||
IMAGE_SUFFIX ?= $(strip ) | ||
|
||
# This repo's root import path (under GOPATH). | ||
ROOT := github.com/yangyongzhi/sym-operator | ||
|
||
# Project main package location (can be multiple ones). | ||
CMD_DIR := ./cmd | ||
|
||
# Project output directory. | ||
OUTPUT_DIR := ./bin | ||
|
||
# docker file direcotory. | ||
DOCKER_DIR := ./docker | ||
|
||
# Git commit sha. | ||
COMMIT := $(strip $(shell git rev-parse --short HEAD 2>/dev/null)) | ||
COMMIT := $(COMMIT)$(shell git diff-files --quiet || echo '-dirty') | ||
COMMIT := $(if $(COMMIT),$(COMMIT),"Unknown") | ||
|
||
|
||
GO_VERSION := 1.12.5 | ||
ARCH ?= $(shell go env GOARCH) | ||
BuildDate = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ') | ||
Commit = $(shell git rev-parse --short HEAD) | ||
GOENV := GO111MODULE=on CGO_ENABLED=0 GOOS=$(shell uname -s | tr A-Z a-z) GOARCH=$(ARCH) | ||
GO := $(GOENV) go build -mod=vendor | ||
|
||
# | ||
# Define all targets. At least the following commands are required: | ||
# | ||
|
||
.PHONY: build container push test clean | ||
|
||
build: | ||
$(GO) -v -o $(OUTPUT_DIR)/$(TARGETS) -ldflags "-s -w " . | ||
|
||
mod-reset-vendor: | ||
@$(shell [ -f go.mod ] && go mod vendor) | ||
|
||
docker-build: | ||
docker run --rm -v "$$PWD":/go/src/${ROOT} -w /go/src/${ROOT} \ | ||
hub.tencentyun.com/xkcp0324/golang:${GO_VERSION} make build | ||
|
||
container: | ||
@for target in $(TARGETS); do \ | ||
for registry in $(REGISTRIES); do \ | ||
image=$(IMAGE_PREFIX)$${target}$(IMAGE_SUFFIX); \ | ||
docker build -t $${registry}$${image}:$(VERSION) \ | ||
--build-arg ROOT=$(ROOT) --build-arg TARGET=$${target} \ | ||
--build-arg CMD_DIR=$(CMD_DIR) \ | ||
--build-arg VERSION=$(VERSION) \ | ||
--build-arg COMMIT=$(COMMIT) \ | ||
-f $(DOCKER_DIR)/$${target}/Dockerfile .; \ | ||
done \ | ||
done | ||
|
||
push: container | ||
@for target in $(TARGETS); do \ | ||
for registry in $(REGISTRIES); do \ | ||
image=$(IMAGE_PREFIX)$${target}$(IMAGE_SUFFIX); \ | ||
docker push $${registry}$${image}:$(VERSION); \ | ||
done \ | ||
done | ||
|
||
test: | ||
@go test ./... | ||
|
||
clean: | ||
@rm -vrf ${OUTPUT_DIR}/* |
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 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 | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
appVersion: "0.0.1" | ||
description: The operator for symphony | ||
name: sym-operator | ||
version: 0.0.1 |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "sym-operator.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 "sym-operator.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 "sym-operator.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "sym-operator.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "sym-operator.name" . }} | ||
helm.sh/chart: {{ include "sym-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "sym-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ include "sym-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
serviceAccountName: {{ template "sym-operator.name" . }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{- if .Values.rbac.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ template "sym-operator.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "sym-operator.name" . }} | ||
helm.sh/chart: {{ include "sym-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ include "sym-operator.name" . }} | ||
helm.sh/chart: {{ include "sym-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
name: {{ template "sym-operator.fullname" . }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: cluster-admin | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ template "sym-operator.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end -}} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "sym-operator.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "sym-operator.name" . }} | ||
helm.sh/chart: {{ include "sym-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app.kubernetes.io/name: {{ include "sym-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Default values for sym-operator. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
replicaCount: 1 | ||
|
||
image: | ||
repository: hub.tencentyun.com/demo001/sym-operator | ||
tag: v0.0.1 | ||
pullPolicy: IfNotPresent | ||
|
||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
service: | ||
type: ClusterIP | ||
port: 80 | ||
|
||
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 | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} | ||
|
||
rbac: | ||
create: true | ||
serviceAccountName: default |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM alpine:3.9 | ||
MAINTAINER yongzhi <[email protected]> | ||
|
||
RUN apk add --no-cache tzdata curl busybox-extras && \ | ||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | ||
echo "Asia/Shanghai">>/etc/timezone | ||
|
||
COPY bin/sym-operator /sym-operator | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["/sym-operator"] | ||
|
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.