Skip to content

Commit 80ab923

Browse files
Initial support operator commit
0 parents  commit 80ab923

File tree

11,210 files changed

+3323506
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

11,210 files changed

+3323506
-0
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/*.pprof

Diff for: Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM registry.svc.ci.openshift.org/ocp/builder:golang-1.10 AS builder
2+
WORKDIR /go/src/github.com/openshift/support-operator
3+
COPY . .
4+
RUN make build
5+
6+
FROM registry.svc.ci.openshift.org/ocp/4.0:base
7+
COPY --from=builder /go/src/github.com/openshift/support-operator/bin/support-operator /usr/bin/
8+
COPY config/pod.yaml /etc/support-operator/server.yaml
9+
COPY manifests /manifests
10+
ENTRYPOINT ["/usr/bin/support-operator"]

Diff for: Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
build:
2+
go build -ldflags "-X github.com/openshift/support-operator/vendor/k8s.io/client-go/pkg/version.gitCommit=$$(git rev-parse HEAD) -X github.com/openshift/support-operator/vendor/k8s.io/client-go/pkg/version.gitVersion=v1.0.0+$$(git rev-parse --short=7 HEAD)" -o bin/support-operator ./cmd/support-operator
3+
.PHONY: build
4+
5+
test:
6+
go test ./...
7+
.PHONY: test
8+
9+
vendor:
10+
glide up -v --skip-test
11+
.PHONY: vendor

Diff for: OWNERS

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
approvers:
2+
- smarterclayton
3+
- derekwaynecarr
4+
reviewers:
5+
- smarterclayton
6+
- derekwaynecarr

Diff for: README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# support-operator
2+
3+
This cluster operator gathers anonymized system configuration and reports it to Red Hat Insights. It is a part of the standard OpenShift distribution.
4+
5+
## Building
6+
7+
To build the operator, install Go 1.11 or above and run:
8+
9+
make build
10+
11+
To test the operator against a remote cluster, run:
12+
13+
bin/support-operator --config=config/local.yaml --kubeconfig=$KUBECONFIG
14+
15+
where `$KUBECONFIG` has sufficiently high permissions against the target cluster.
16+
17+
## Roadmap
18+
19+
The current operator only collects global configuration. Future revisions will expand the set of config that can be gathered as well as add on-demand capture.

Diff for: bin/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/*
2+
!/.gitignore

Diff for: cmd/support-operator/main.go

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package main
2+
3+
import (
4+
goflag "flag"
5+
"fmt"
6+
"os"
7+
8+
"github.com/spf13/cobra"
9+
"github.com/spf13/pflag"
10+
11+
utilflag "k8s.io/apiserver/pkg/util/flag"
12+
"k8s.io/apiserver/pkg/util/logs"
13+
"k8s.io/client-go/pkg/version"
14+
15+
"github.com/openshift/support-operator/pkg/cmd/start"
16+
)
17+
18+
func main() {
19+
pflag.CommandLine.SetNormalizeFunc(utilflag.WordSepNormalizeFunc)
20+
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
21+
pflag.CommandLine.Lookup("alsologtostderr").Value.Set("true")
22+
23+
logs.InitLogs()
24+
defer logs.FlushLogs()
25+
26+
command := NewOperatorCommand()
27+
if err := command.Execute(); err != nil {
28+
fmt.Fprintf(os.Stderr, "error: %v\n", err)
29+
os.Exit(1)
30+
}
31+
}
32+
33+
func NewOperatorCommand() *cobra.Command {
34+
cmd := &cobra.Command{
35+
Use: "support-operator",
36+
Short: "OpenShift Support Operator",
37+
38+
SilenceUsage: true,
39+
SilenceErrors: true,
40+
41+
Run: func(cmd *cobra.Command, args []string) {
42+
cmd.Help()
43+
os.Exit(1)
44+
},
45+
}
46+
47+
if v := version.Get().String(); len(v) == 0 {
48+
cmd.Version = "<unknown>"
49+
} else {
50+
cmd.Version = v
51+
}
52+
53+
cmd.AddCommand(start.NewOperator())
54+
cmd.AddCommand(start.NewReceiver())
55+
56+
return cmd
57+
}

Diff for: config/local.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
kind: GenericOperatorConfig
2+
apiVersion: operator.openshift.io/v1alpha1
3+
leaderElection:
4+
disable: true
5+
interval: "30s"
6+
storagePath: /tmp/support-operator
7+
endpoint: http://localhost:8081
8+
impersonate: system:serviceaccount:openshift-support:gather

Diff for: config/pod.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
kind: GenericOperatorConfig
2+
apiVersion: operator.openshift.io/v1alpha1
3+
leaderElection:
4+
disable: true
5+
interval: "30s"
6+
storagePath: /var/lib/support-operator
7+
endpoint: https://cloud.redhat.com/api/ingress/v1/upload
8+
impersonate: system:serviceaccount:openshift-support:gather

0 commit comments

Comments
 (0)