Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cmd/milo/controller-manager/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/blang/semver/v4"
"github.com/spf13/cobra"
agreementv1alpha1webhook "go.miloapis.com/milo/internal/webhooks/agreement/v1alpha1"
coordinationv1 "k8s.io/api/coordination/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
Expand Down Expand Up @@ -77,9 +78,11 @@ import (
remoteapiservicecontroller "go.miloapis.com/milo/internal/controllers/remoteapiservice"
resourcemanagercontroller "go.miloapis.com/milo/internal/controllers/resourcemanager"
infracluster "go.miloapis.com/milo/internal/infra-cluster"
documentationv1alpha1webhook "go.miloapis.com/milo/internal/webhooks/documentation/v1alpha1"
iamv1alpha1webhook "go.miloapis.com/milo/internal/webhooks/iam/v1alpha1"
notificationv1alpha1webhook "go.miloapis.com/milo/internal/webhooks/notification/v1alpha1"
resourcemanagerv1alpha1webhook "go.miloapis.com/milo/internal/webhooks/resourcemanager/v1alpha1"
documentationv1alpha1 "go.miloapis.com/milo/pkg/apis/documentation/v1alpha1"
iamv1alpha1 "go.miloapis.com/milo/pkg/apis/iam/v1alpha1"
infrastructurev1alpha1 "go.miloapis.com/milo/pkg/apis/infrastructure/v1alpha1"
notificationv1alpha1 "go.miloapis.com/milo/pkg/apis/notification/v1alpha1"
Expand Down Expand Up @@ -127,6 +130,7 @@ func init() {
utilruntime.Must(infrastructurev1alpha1.AddToScheme(Scheme))
utilruntime.Must(iamv1alpha1.AddToScheme(Scheme))
utilruntime.Must(notificationv1alpha1.AddToScheme(Scheme))
utilruntime.Must(documentationv1alpha1.AddToScheme(Scheme))
utilruntime.Must(apiregistrationv1.AddToScheme(Scheme))
}

Expand Down Expand Up @@ -448,6 +452,18 @@ func Run(ctx context.Context, c *config.CompletedConfig, opts *Options) error {
logger.Error(err, "Error setting up contactgroupmembershipremoval webhook")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)
}
if err := documentationv1alpha1webhook.SetupDocumentWebhooksWithManager(ctrl); err != nil {
logger.Error(err, "Error setting up document webhook")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)
}
if err := documentationv1alpha1webhook.SetupDocumentRevisionWebhooksWithManager(ctrl); err != nil {
logger.Error(err, "Error setting up document revision webhook")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)
}
if err := agreementv1alpha1webhook.SetupDocumentAcceptanceWebhooksWithManager(ctrl); err != nil {
logger.Error(err, "Error setting up document acceptance webhook")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)
}

projectCtrl := resourcemanagercontroller.ProjectController{
ControlPlaneClient: ctrl.GetClient(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.18.0
name: documentacceptances.agreement.miloapis.com
spec:
group: agreement.miloapis.com
names:
kind: DocumentAcceptance
listKind: DocumentAcceptanceList
plural: documentacceptances
singular: documentacceptance
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: |-
DocumentAcceptance is the Schema for the documentacceptances API.
It represents a document acceptance.
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: DocumentAcceptanceSpec defines the desired state of DocumentAcceptance.
properties:
acceptanceContext:
description: AcceptanceContext is the context of the document acceptance.
properties:
acceptanceLanguage:
description: AcceptanceLanguage is the language of the document
acceptance.
type: string
ipAddress:
description: IPAddress is the IP address of the accepter.
type: string
method:
description: Method is the method of the document acceptance.
enum:
- web
- email
- cli
type: string
userAgent:
description: UserAgent is the user agent of the accepter.
type: string
required:
- method
type: object
accepterRef:
description: AccepterRef is a reference to the accepter that this
document acceptance applies to.
properties:
apiGroup:
description: APIGroup is the group for the resource being referenced.
type: string
kind:
description: Kind is the type of resource being referenced.
type: string
name:
description: Name is the name of the Resource being referenced.
type: string
namespace:
description: Namespace is the namespace of the Resource being
referenced.
type: string
required:
- apiGroup
- kind
- name
type: object
documentRevisionRef:
description: DocumentRevisionRef is a reference to the document revision
that is being accepted.
properties:
name:
description: Name is the name of the DocumentRevision being referenced.
type: string
namespace:
description: Namespace of the referenced document revision.
type: string
version:
description: Version is the version of the DocumentRevision being
referenced.
pattern: ^v\d+\.\d+\.\d+$
type: string
required:
- name
- namespace
- version
type: object
signature:
description: Signature is the signature of the document acceptance.
properties:
timestamp:
description: Timestamp is the timestamp of the document acceptance.
format: date-time
type: string
type:
description: Type specifies the signature mechanism used for the
document acceptance.
enum:
- checkbox
type: string
required:
- timestamp
- type
type: object
subjectRef:
description: SubjectRef is a reference to the subject that this document
acceptance applies to.
properties:
apiGroup:
description: APIGroup is the group for the resource being referenced.
type: string
kind:
description: Kind is the type of resource being referenced.
type: string
name:
description: Name is the name of the Resource being referenced.
type: string
namespace:
description: Namespace is the namespace of the Resource being
referenced.
type: string
required:
- apiGroup
- kind
- name
type: object
required:
- acceptanceContext
- accepterRef
- documentRevisionRef
- signature
- subjectRef
type: object
x-kubernetes-validations:
- message: spec is immutable
rule: self == oldSelf
status:
description: DocumentAcceptanceStatus defines the observed state of DocumentAcceptance.
properties:
conditions:
default:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: Waiting for control plane to reconcile
reason: Unknown
status: Unknown
type: Ready
description: Conditions represent the latest available observations
of an object's current state.
items:
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
3 changes: 3 additions & 0 deletions config/crd/bases/agreement/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- agreement.miloapis.com_documentacceptances.yaml

Loading
Loading