Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to operator-sdk 0.10.0 #4

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions cmd/manager/main.go
Expand Up @@ -123,9 +123,22 @@ func main() {
{Port: operatorMetricsPort, Name: metrics.CRPortName, Protocol: v1.ProtocolTCP, TargetPort: intstr.IntOrString{Type: intstr.Int, IntVal: operatorMetricsPort}},
}
// Create Service object to expose the metrics port(s).
_, err = metrics.CreateMetricsService(ctx, cfg, servicePorts)
service, err := metrics.CreateMetricsService(ctx, cfg, servicePorts)
if err != nil {
log.Info(err.Error())
log.Info("Could not create metrics Service", "error", err.Error())
}

// CreateServiceMonitors will automatically create the prometheus-operator ServiceMonitor resources
// necessary to configure Prometheus to scrape metrics from this operator.
services := []*v1.Service{service}
_, err = metrics.CreateServiceMonitors(cfg, namespace, services)
if err != nil {
log.Info("Could not create ServiceMonitor object", "error", err.Error())
// If this operator is deployed to a cluster without the prometheus-operator running, it will return
// ErrServiceMonitorNotPresent, which can be used to safely skip ServiceMonitor creation.
if err == metrics.ErrServiceMonitorNotPresent {
log.Info("Install prometheus-operator in your cluster to create ServiceMonitor objects", "error", err.Error())
}
}

log.Info("Starting the Cmd.")
Expand Down
1 change: 1 addition & 0 deletions deploy/role.yaml
Expand Up @@ -8,6 +8,7 @@ rules:
resources:
- pods
- services
- services/finalizers
- endpoints
- persistentvolumeclaims
- events
Expand Down
8 changes: 5 additions & 3 deletions go.mod
@@ -1,9 +1,8 @@
module github.com/openshift/managed-velero-operator

require (
github.com/NYTimes/gziphandler v1.0.1 // indirect
github.com/openshift/api v3.9.1-0.20190806225813-d2972510af76+incompatible
github.com/operator-framework/operator-sdk v0.9.1-0.20190729152335-7a35cfc9a7cf
github.com/operator-framework/operator-sdk v0.10.1-0.20190809191117-c1e2eae6580e
github.com/spf13/pflag v1.0.3
k8s.io/api v0.0.0-20190612125737-db0771252981
k8s.io/apimachinery v0.0.0-20190612125636-6a5db36e93ad
Expand All @@ -24,9 +23,12 @@ replace (

replace (
github.com/coreos/prometheus-operator => github.com/coreos/prometheus-operator v0.29.0
// Pinned to v2.9.2 (kubernetes-1.13.1) so https://proxy.golang.org can
// resolve it correctly.
github.com/prometheus/prometheus => github.com/prometheus/prometheus v0.0.0-20190424153033-d3245f150225
k8s.io/kube-state-metrics => k8s.io/kube-state-metrics v1.6.0
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.1.12
sigs.k8s.io/controller-tools => sigs.k8s.io/controller-tools v0.1.11-0.20190411181648-9d55346c2bde
)

replace github.com/operator-framework/operator-sdk => github.com/operator-framework/operator-sdk v0.9.0
replace github.com/operator-framework/operator-sdk => github.com/operator-framework/operator-sdk v0.10.0