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

Changed Operator to set ownership of the instances it manages #571

Merged

Conversation

jpkrohling
Copy link
Contributor

@jpkrohling jpkrohling commented Jul 30, 2019

Fixes #567 by setting a managed-by value with the namespace.name of the operator that manages the instance.

Signed-off-by: Juraci Paixão Kröhling juraci@kroehling.de

@jpkrohling
Copy link
Contributor Author

I tested this by deploying the same code in two namespaces (one via make run):

Operator default:

$ make run
INFO[0000] Versions                                      arch=amd64 identity=default.jaeger-operator jaeger=1.13.1 jaeger-operator=v1.13.1-37-g5190c6c4 operator-sdk=v0.8.1 os=linux version=go1.12.5
...
INFO[0067] Storage type not provided. Falling back to 'memory'  instance=simplest namespace=default

Operator observability:

$ kubectl logs -n observability jaeger-operator-67f8c7b5ff-tj9x6 -f
time="2019-07-30T16:16:22Z" level=info msg=Versions arch=amd64 identity=observability.jaeger-operator jaeger=1.13.1 jaeger-operator=v1.13.1-37-g5190c6c4 operator-sdk=v0.8.1 os=linux version=go1.12.5
...
time="2019-07-30T16:18:21Z" level=error msg="failed to set this operator's instance as the manager of the instance" error="Operation cannot be fulfilled on jaegers.jaegertracing.io \"simplest\": the object has been modified; please apply your changes to the latest version and try again" execution="2019-07-30 16:18:21.313172318 +0000 UTC" instance=simplest namespace=default operator-identity=observability.jaeger-operator

And this is the resulting CR after it has been stored by one of the operators:

apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"jaegertracing.io/v1","kind":"Jaeger","metadata":{"annotations":{},"name":"simplest","namespace":"default"}}
  creationTimestamp: 2019-07-30T16:18:21Z
  finalizers:
  - finalizer.jaegertracing.io
  generation: 3
  labels:
    app.kubernetes.io/managed-by: default.jaeger-operator
  name: simplest
  namespace: default
  resourceVersion: "5173"
  selfLink: /apis/jaegertracing.io/v1/namespaces/default/jaegers/simplest
  uid: f81bfb19-33cf-4703-b3f4-778eb47edb39
spec:
  agent:
    options: {}
    resources: {}
  allInOne:
    options: {}
    resources: {}
  collector:
    options: {}
    resources: {}
  ingester:
    options: {}
    resources: {}
  ingress:
    openshift: {}
    resources: {}
    security: none
  query:
    options: {}
    resources: {}
  resources: {}
  sampling:
    options: {}
  storage:
    cassandraCreateSchema: {}
    dependencies:
      image: jaegertracing/spark-dependencies
      schedule: 55 23 * * *
    elasticsearch:
      nodeCount: 1
      redundancyPolicy: ZeroRedundancy
      resources: {}
      storage: {}
    esIndexCleaner:
      image: jaegertracing/jaeger-es-index-cleaner
      numberOfDays: 7
      schedule: 55 23 * * *
    esRollover:
      image: jaegertracing/jaeger-es-rollover
      schedule: '*/30 * * * *'
    options: {}
    type: memory
  strategy: allInOne
  ui:
    options: {}
status:
  version: 1.13.1

@objectiser
Copy link
Contributor

@jpkrohling Will take a closer look tomorrow, but noticed the jaeger.clusterserviceversion.yaml hasn't been updated.

@codecov
Copy link

codecov bot commented Jul 31, 2019

Codecov Report

Merging #571 into master will decrease coverage by 0.3%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #571      +/-   ##
==========================================
- Coverage   91.56%   91.25%   -0.31%     
==========================================
  Files          73       73              
  Lines        3615     3648      +33     
==========================================
+ Hits         3310     3329      +19     
- Misses        213      227      +14     
  Partials       92       92
Impacted Files Coverage Δ
pkg/apis/jaegertracing/v1/builder.go 0% <0%> (ø) ⬆️
pkg/upgrade/upgrade.go 60.97% <100%> (+14.3%) ⬆️
pkg/controller/jaeger/jaeger_controller.go 51.2% <45%> (-1.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60f5ed6...ef64de4. Read the comment docs.

@codecov
Copy link

codecov bot commented Jul 31, 2019

Codecov Report

Merging #571 into master will decrease coverage by 0.3%.
The diff coverage is 58.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #571      +/-   ##
==========================================
- Coverage   91.56%   91.25%   -0.31%     
==========================================
  Files          73       73              
  Lines        3615     3647      +32     
==========================================
+ Hits         3310     3328      +18     
- Misses        213      227      +14     
  Partials       92       92
Impacted Files Coverage Δ
pkg/apis/jaegertracing/v1/builder.go 0% <0%> (ø) ⬆️
pkg/upgrade/upgrade.go 60% <100%> (+13.33%) ⬆️
pkg/controller/jaeger/jaeger_controller.go 51.2% <45%> (-1.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60f5ed6...984c0d2. Read the comment docs.

@jpkrohling
Copy link
Contributor Author

CSV and the test's operator.yaml were fixed.

pkg/controller/jaeger/jaeger_controller.go Outdated Show resolved Hide resolved
pkg/controller/jaeger/jaeger_controller.go Outdated Show resolved Hide resolved
pkg/apis/jaegertracing/v1/const.go Show resolved Hide resolved
pkg/upgrade/upgrade.go Outdated Show resolved Hide resolved
Copy link
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just one minor change.

pkg/upgrade/upgrade.go Outdated Show resolved Hide resolved
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
@jpkrohling jpkrohling force-pushed the 567-Lock-instance-to-operator branch from ba2b2a4 to 984c0d2 Compare July 31, 2019 12:50
@jpkrohling
Copy link
Contributor Author

PR updated and squashed.

@jpkrohling jpkrohling merged commit 1d09774 into jaegertracing:master Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two operators managing the same instance
2 participants