-
Notifications
You must be signed in to change notification settings - Fork 1.8k
generate/internal/manifests.go: add all supported kinds to manifests #4137
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| entries: | ||
| - description: When generating bundles and packagemanifests, add all resources supported by OLM. | ||
| kind: change | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| package genutil | ||
|
|
||
| import ( | ||
| "github.com/operator-framework/operator-registry/pkg/lib/bundle" | ||
| "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" | ||
|
|
||
| "github.com/operator-framework/operator-sdk/internal/generate/collector" | ||
|
|
@@ -35,6 +36,19 @@ func GetManifestObjects(c *collector.Manifests) (objs []controllerutil.Object) { | |
| objs = append(objs, &c.ServiceAccounts[i]) | ||
| } | ||
|
|
||
| // All Services passed in should be written. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't quite true. OLM manages webhooks and their services, no explicitly defined webhook
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we just match on namespace and name? What if a service declares multiple ports and one of them is for the webhook? Do you think we need to filter out webhook service ports and then filter out any services that have no ports?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we constrain the problem by filtering any service that matches a webhook config by name/namespace, and document that webhooks need their own separate service? Modifying a resource's functional content doesn't feel right.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could. I think I have a working solution that does what I suggest above. Let me know what you think. |
||
| for i := range c.Services { | ||
| objs = append(objs, &c.Services[i]) | ||
| } | ||
|
|
||
| // Add all other supported kinds | ||
| for i := range c.Others { | ||
| obj := &c.Others[i] | ||
| if supported, _ := bundle.IsSupported(obj.GroupVersionKind().Kind); supported { | ||
| objs = append(objs, obj) | ||
| } | ||
| } | ||
|
|
||
| // RBAC objects that are not a part of the CSV should be written. | ||
| _, roleObjs := c.SplitCSVPermissionsObjects() | ||
| objs = append(objs, roleObjs...) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: ServiceMonitor | ||
| metadata: | ||
| labels: | ||
| control-plane: controller-manager | ||
| name: memcached-operator-controller-manager-metrics-monitor | ||
| spec: | ||
| endpoints: | ||
| - path: /metrics | ||
| port: https | ||
| selector: | ||
| matchLabels: | ||
| control-plane: controller-manager |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| creationTimestamp: null | ||
| labels: | ||
| control-plane: controller-manager | ||
| name: memcached-operator-controller-manager-metrics-service | ||
| spec: | ||
| ports: | ||
| - name: https | ||
| port: 8443 | ||
| targetPort: https | ||
| selector: | ||
| control-plane: controller-manager | ||
| status: | ||
| loadBalancer: {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: ServiceMonitor | ||
| metadata: | ||
| labels: | ||
| control-plane: controller-manager | ||
| name: memcached-operator-controller-manager-metrics-monitor | ||
| spec: | ||
| endpoints: | ||
| - path: /metrics | ||
| port: https | ||
| selector: | ||
| matchLabels: | ||
| control-plane: controller-manager |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| creationTimestamp: null | ||
| labels: | ||
| control-plane: controller-manager | ||
| name: memcached-operator-controller-manager-metrics-service | ||
| spec: | ||
| ports: | ||
| - name: https | ||
| port: 8443 | ||
| targetPort: https | ||
| selector: | ||
| control-plane: controller-manager | ||
| status: | ||
| loadBalancer: {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| creationTimestamp: null | ||
| name: memcached-operator-webhook-service | ||
| spec: | ||
| ports: | ||
| - port: 443 | ||
| targetPort: 9443 | ||
| selector: | ||
| control-plane: controller-manager | ||
| status: | ||
| loadBalancer: {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: ServiceMonitor | ||
| metadata: | ||
| labels: | ||
| control-plane: controller-manager | ||
| name: memcached-operator-controller-manager-metrics-monitor | ||
| spec: | ||
| endpoints: | ||
| - path: /metrics | ||
| port: https | ||
| selector: | ||
| matchLabels: | ||
| control-plane: controller-manager |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| creationTimestamp: null | ||
| labels: | ||
| control-plane: controller-manager | ||
| name: memcached-operator-controller-manager-metrics-service | ||
| spec: | ||
| ports: | ||
| - name: https | ||
| port: 8443 | ||
| targetPort: https | ||
| selector: | ||
| control-plane: controller-manager | ||
| status: | ||
| loadBalancer: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I almost want to say this is a net-new feature because we explicitly do this for RBAC and no other types, but I am ok with "change" since the explicitness isn't user-facing.