-
Notifications
You must be signed in to change notification settings - Fork 68
Add PagerDutyIntegration CRD #90
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
Merged
openshift-merge-robot
merged 14 commits into
openshift:master
from
grdryn:PagerDutyIntegrationCRD
Jul 20, 2020
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0e7dfe7
Generate PagerDutyIntegration using operator-sdk
grdryn 1021315
Add appropriate fields to CRD Spec
grdryn a63e6f8
Scaffold PagerDutyIntegration controller
grdryn dbcaca6
Replace CD/SS controllers w/ PagerDutyIntegration
grdryn a167709
Add watches to trigger PDI reconciliation requests
grdryn 3baf71c
Make naming of resources more understandable
grdryn 1f19a94
Don't return reconcile.Result from create/delete funcs
grdryn 43a407c
Add migration code for existing ClusterDeployments
grdryn 794df56
Update README with details of new changes
grdryn 44e365e
Re-purpose old tests to new controller
grdryn 251d438
Add test for migration code
grdryn b2bd0d9
Address initial code review comments
grdryn e0df263
Use go:generate directive to generate correct CRD
grdryn 20f2b76
Exit reconcile early after setting finalizer
grdryn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
deploy/crds/pagerduty.openshift.io_pagerdutyintegrations_crd.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| apiVersion: apiextensions.k8s.io/v1beta1 | ||
| kind: CustomResourceDefinition | ||
| metadata: | ||
| name: pagerdutyintegrations.pagerduty.openshift.io | ||
| spec: | ||
| group: pagerduty.openshift.io | ||
| names: | ||
| kind: PagerDutyIntegration | ||
| listKind: PagerDutyIntegrationList | ||
| plural: pagerdutyintegrations | ||
| singular: pagerdutyintegration | ||
| scope: Namespaced | ||
| subresources: | ||
| status: {} | ||
| validation: | ||
| openAPIV3Schema: | ||
| description: PagerDutyIntegration is the Schema for the pagerdutyintegrations | ||
| API | ||
| properties: | ||
| apiVersion: | ||
| description: 'APIVersion defines the versioned schema of this representation | ||
| of an object. Servers should convert recognized schemas to the latest | ||
| internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
| type: string | ||
| kind: | ||
| description: 'Kind is a string value representing the REST resource this | ||
| object represents. Servers may infer this from the endpoint the client | ||
| submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
| type: string | ||
| metadata: | ||
| type: object | ||
| spec: | ||
| description: PagerDutyIntegrationSpec defines the desired state of PagerDutyIntegration | ||
| properties: | ||
| acknowledgeTimeout: | ||
| description: Time in seconds that an incident changes to the Triggered | ||
| State after being Acknowledged. Value must not be negative. Omitting | ||
| or setting this field to 0 will disable the feature. | ||
| minimum: 0 | ||
| type: integer | ||
| clusterDeploymentSelector: | ||
| description: A label selector used to find which clusterdeployment CRs | ||
| receive a PD integration based on this configuration. | ||
| properties: | ||
| matchExpressions: | ||
| description: matchExpressions is a list of label selector requirements. | ||
| The requirements are ANDed. | ||
| items: | ||
| description: A label selector requirement is a selector that contains | ||
| values, a key, and an operator that relates the key and values. | ||
| properties: | ||
| key: | ||
| description: key is the label key that the selector applies | ||
| to. | ||
| type: string | ||
| operator: | ||
| description: operator represents a key's relationship to a | ||
| set of values. Valid operators are In, NotIn, Exists and | ||
| DoesNotExist. | ||
| type: string | ||
| values: | ||
| description: values is an array of string values. If the operator | ||
| is In or NotIn, the values array must be non-empty. If the | ||
| operator is Exists or DoesNotExist, the values array must | ||
| be empty. This array is replaced during a strategic merge | ||
| patch. | ||
| items: | ||
| type: string | ||
| type: array | ||
| required: | ||
| - key | ||
| - operator | ||
| type: object | ||
| type: array | ||
| matchLabels: | ||
| additionalProperties: | ||
| type: string | ||
| description: matchLabels is a map of {key,value} pairs. A single | ||
| {key,value} in the matchLabels map is equivalent to an element | ||
| of matchExpressions, whose key field is "key", the operator is | ||
| "In", and the values array contains only "value". The requirements | ||
| are ANDed. | ||
| type: object | ||
| type: object | ||
| escalationPolicy: | ||
| description: ID of an existing Escalation Policy in PagerDuty. | ||
| type: string | ||
| pagerdutyApiKeySecretRef: | ||
| description: Reference to the secret containing PAGERDUTY_API_KEY. | ||
| properties: | ||
| name: | ||
| description: Name is unique within a namespace to reference a secret | ||
| resource. | ||
| type: string | ||
| namespace: | ||
| description: Namespace defines the space within which the secret | ||
| name must be unique. | ||
| type: string | ||
| type: object | ||
| resolveTimeout: | ||
| description: Time in seconds that an incident is automatically resolved | ||
| if left open for that long. Value must not be negative. Omitting or | ||
| setting this field to 0 will disable the feature. | ||
| minimum: 0 | ||
| type: integer | ||
| servicePrefix: | ||
| description: Prefix to set on the PagerDuty Service name. | ||
| type: string | ||
| targetSecretRef: | ||
| description: Name and namespace in the target cluster where the secret | ||
| is synced. | ||
| properties: | ||
| name: | ||
| description: Name is unique within a namespace to reference a secret | ||
| resource. | ||
| type: string | ||
| namespace: | ||
| description: Namespace defines the space within which the secret | ||
| name must be unique. | ||
| type: string | ||
| type: object | ||
| required: | ||
| - clusterDeploymentSelector | ||
| - escalationPolicy | ||
| - pagerdutyApiKeySecretRef | ||
| - servicePrefix | ||
| - targetSecretRef | ||
| type: object | ||
| status: | ||
| description: PagerDutyIntegrationStatus defines the observed state of PagerDutyIntegration | ||
| type: object | ||
grdryn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| version: v1alpha1 | ||
| versions: | ||
| - name: v1alpha1 | ||
| served: true | ||
| storage: true | ||
18 changes: 18 additions & 0 deletions
18
deploy/examples/pagerduty_v1alpha1_pagerdutyintegration_cr.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| apiVersion: pagerduty.openshift.io/v1alpha1 | ||
| kind: PagerDutyIntegration | ||
| metadata: | ||
| name: example-pagerdutyintegration | ||
| spec: | ||
| acknowledgeTimeout: 21600 | ||
| resolveTimeout: 0 | ||
| escalationPolicy: PA12345X | ||
| servicePrefix: test | ||
| pagerdutyApiKeySecretRef: | ||
| name: pagerduty-api-key | ||
| namespace: pagerduty-operator | ||
| clusterDeploymentSelector: | ||
| matchLabels: | ||
| api.openshift.com/test: "true" | ||
| targetSecretRef: | ||
| name: test-pd-secret | ||
| namespace: test-monitoring |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Commands need to be run from project root | ||
| cd "$( dirname "${BASH_SOURCE[0]}" )"/.. | ||
|
|
||
| operator-sdk generate k8s | ||
| operator-sdk generate crds | ||
|
|
||
| # This can be removed once the operator no longer needs to be run on | ||
| # OpenShift v3.11 | ||
| yq d -i deploy/crds/pagerduty.openshift.io_pagerdutyintegrations_crd.yaml \ | ||
| spec.validation.openAPIV3Schema.type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package apis | ||
|
|
||
| import ( | ||
| "github.com/openshift/pagerduty-operator/pkg/apis/pagerduty/v1alpha1" | ||
| ) | ||
|
|
||
| func init() { | ||
| // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back | ||
| AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| // Package v1alpha1 contains API Schema definitions for the pagerduty v1alpha1 API group | ||
| // +k8s:deepcopy-gen=package,register | ||
| // +groupName=pagerduty.openshift.io | ||
| package v1alpha1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.