Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Manifest = NewTemplate("manifest", `
---
apiVersion: v1
kind: Namespace
metadata:
name: {{.Namespace}}
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
component: sonobuoy
name: sonobuoy-serviceaccount
namespace: {{.Namespace}}
{{- if .EnableRBAC }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
component: sonobuoy
namespace: {{.Namespace}}
name: sonobuoy-serviceaccount-{{.Namespace}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: sonobuoy-serviceaccount-{{.Namespace}}
subjects:
- kind: ServiceAccount
name: sonobuoy-serviceaccount
namespace: {{.Namespace}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
component: sonobuoy
namespace: {{.Namespace}}
name: sonobuoy-serviceaccount-{{.Namespace}}
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '/metrics'
- '/logs'
- '/logs/*'
verbs:
- 'get'
{{- end }}
{{- if .SSHKey }}
---
apiVersion: v1
kind: Secret
metadata:
name: ssh-key
namespace: {{.Namespace}}
type: Opaque
data:
id_rsa: {{.SSHKey}}
{{- end }}
---
apiVersion: v1
data:
config.json: |
{{.SonobuoyConfig}}
kind: ConfigMap
metadata:
labels:
component: sonobuoy
name: sonobuoy-config-cm
namespace: {{.Namespace}}
---
apiVersion: v1
{{- if .Plugins }}
data:{{- range $i, $v := .Plugins }}
plugin-{{- $i -}}.yaml: |
{{ indent 4 $v }}
{{- end }}
{{- end }}
kind: ConfigMap
metadata:
labels:
component: sonobuoy
name: sonobuoy-plugins-cm
namespace: {{.Namespace}}
---
apiVersion: v1
kind: Pod
metadata:
labels:
component: sonobuoy
run: sonobuoy-master
tier: analysis
name: sonobuoy
namespace: {{.Namespace}}
{{- if .CustomAnnotations }}
annotations:{{- range $k, $v := .CustomAnnotations }}
{{ indent 4 $k}}: {{$v}}
{{- end }}
{{- end }}
spec:
{{- if .NodeSelectors }}
nodeSelector:{{- range $k, $v := .NodeSelectors }}
{{ indent 4 $k}}: {{$v}}
{{- end }}{{- end }}
containers:
- env:
- name: SONOBUOY_ADVERTISE_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
image: {{.SonobuoyImage}}
imagePullPolicy: {{.ImagePullPolicy}}
name: kube-sonobuoy
volumeMounts:
- mountPath: /etc/sonobuoy
name: sonobuoy-config-volume
- mountPath: /plugins.d
name: sonobuoy-plugins-volume
- mountPath: /tmp/sonobuoy
name: output-volume
{{- if .ImagePullSecrets }}
imagePullSecrets:
- name: {{.ImagePullSecrets}}
{{- end }}
restartPolicy: Never
serviceAccountName: sonobuoy-serviceaccount
tolerations:
- key: "kubernetes.io/e2e-evict-taint-key"
operator: "Exists"
volumes:
- configMap:
name: sonobuoy-config-cm
name: sonobuoy-config-volume
- configMap:
name: sonobuoy-plugins-cm
name: sonobuoy-plugins-volume
- emptyDir: {}
name: output-volume
---
{{- if .CustomRegistries }}
apiVersion: v1
data:
repo-list.yaml: |
{{ indent 4 .CustomRegistries }}
kind: ConfigMap
metadata:
name: repolist-cm
namespace: {{.Namespace}}
---
{{- end}}
apiVersion: v1
kind: Service
metadata:
labels:
component: sonobuoy
run: sonobuoy-master
name: sonobuoy-master
namespace: {{.Namespace}}
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
run: sonobuoy-master
type: ClusterIP
`)
Manifest is the template found in examples
View Source
var TemplateFuncs = map[string]interface{}{ "indent": func(i int, input string) string { split := strings.Split(input, "\n") ident := "\n" + strings.Repeat(" ", i) return strings.Join(split, ident) }, }
TemplateFuncs exports (currently singular) functions to be used inside the template
Functions ¶
func NewTemplate ¶
NewTemplate declares a new template that already has TemplateFuncs in scope
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.