diff --git a/.golangci.yaml b/.golangci.yaml index a0cd859..024103e 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -19,7 +19,6 @@ linters: - govet - importas - ineffassign - - megacheck - misspell - nakedret - nolintlint diff --git a/Makefile b/Makefile index 36c6cc6..4f8d873 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ manager: generate fmt manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/..." paths="./api/..." paths="./controllers/..." output:crd:artifacts:config=config/crd/bases cp config/crd/bases/*.yaml helm/crds/ + yq -i '.spec.versions[0].schema.openAPIV3Schema.properties.spec.properties.imagePullSecrets.items.properties.name.description="Name of the referent."' helm/crds/eventlogger.bakito.ch_eventloggers.yaml generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 1a7538a..318acc4 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -21,6 +21,7 @@ limitations under the License. package v1 import ( + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" ) @@ -122,6 +123,11 @@ func (in *EventLoggerSpec) DeepCopyInto(out *EventLoggerSpec) { *out = new(string) **out = **in } + if in.ImagePullSecrets != nil { + in, out := &in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]corev1.LocalObjectReference, len(*in)) + copy(*out, *in) + } if in.NodeSelector != nil { in, out := &in.NodeSelector, &out.NodeSelector *out = make(map[string]string, len(*in)) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 12e1030..5a4ae7a 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -8,5 +8,6 @@ sources: - https://github.com/bakito/k8s-event-logger-operator annotations: artifacthub.io/changes: | - - Allow additional pid annotations + - add image pull secrets to the EventLogger CRD + - CRD reformatted in post-processing icon: https://raw.githubusercontent.com/bakito/k8s-event-logger-operator/main/docs/chart-logo.png diff --git a/helm/crds/eventlogger.bakito.ch_eventloggers.yaml b/helm/crds/eventlogger.bakito.ch_eventloggers.yaml index 2e859e3..53d7dfe 100644 --- a/helm/crds/eventlogger.bakito.ch_eventloggers.yaml +++ b/helm/crds/eventlogger.bakito.ch_eventloggers.yaml @@ -14,184 +14,168 @@ spec: singular: eventlogger scope: Namespaced versions: - - name: v1 - schema: - openAPIV3Schema: - description: EventLogger is the Schema for the eventloggers 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: EventLoggerSpec defines the desired state of EventLogger - properties: - annotations: - additionalProperties: - type: string - description: Labels additional annotations for the logger pod - type: object - eventTypes: - description: EventTypes the event types to log. If empty all events - are logged. - items: - type: string - minItems: 0 - type: array - imagePullSecrets: - description: |- - ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this EventLoggerSpec. - If specified, these secrets will be passed to individual puller implementations for them to use. - items: - description: |- - LocalObjectReference contains enough information to let you locate the - referenced object inside the same namespace. - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. - type: string + - name: v1 + schema: + openAPIV3Schema: + description: EventLogger is the Schema for the eventloggers 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: EventLoggerSpec defines the desired state of EventLogger + properties: + annotations: + additionalProperties: + type: string + description: Labels additional annotations for the logger pod type: object - x-kubernetes-map-type: atomic - type: array - kinds: - description: Kinds the kinds to log the events for - items: - description: Kind defines a kind to log events for - properties: - apiGroup: - nullable: true - type: string - eventTypes: - description: EventTypes the event types to log. If empty events - are logged as defined in spec. - items: - type: string - minItems: 0 - type: array - matchingPatterns: - description: MatchingPatterns optional regex pattern that must - be contained in the message to be logged - items: + eventTypes: + description: EventTypes the event types to log. If empty all events are logged. + items: + type: string + minItems: 0 + type: array + imagePullSecrets: + description: |- + ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this EventLoggerSpec. + If specified, these secrets will be passed to individual puller implementations for them to use. + items: + description: |- + LocalObjectReference contains enough information to let you locate the + referenced object inside the same namespace. + properties: + name: + default: "" + description: |- + Name of the referent. type: string - minItems: 0 - type: array - name: - minLength: 3 - type: string - reasons: - description: Reasons the event reasons to log. If empty events - with any reasons are logged. - items: + type: object + x-kubernetes-map-type: atomic + type: array + kinds: + description: Kinds the kinds to log the events for + items: + description: Kind defines a kind to log events for + properties: + apiGroup: + nullable: true type: string - minItems: 0 - type: array - skipOnMatch: - description: SkipOnMatch skip the entry if matched - type: boolean - skipReasons: - description: SkipReasons event reasons to log to skip. If empty - events with any reasons are logged. - items: + eventTypes: + description: EventTypes the event types to log. If empty events are logged as defined in spec. + items: + type: string + minItems: 0 + type: array + matchingPatterns: + description: MatchingPatterns optional regex pattern that must be contained in the message to be logged + items: + type: string + minItems: 0 + type: array + name: + minLength: 3 type: string - minItems: 0 - type: array - required: - - name + reasons: + description: Reasons the event reasons to log. If empty events with any reasons are logged. + items: + type: string + minItems: 0 + type: array + skipOnMatch: + description: SkipOnMatch skip the entry if matched + type: boolean + skipReasons: + description: SkipReasons event reasons to log to skip. If empty events with any reasons are logged. + items: + type: string + minItems: 0 + type: array + required: + - name + type: object + minItems: 1 + type: array + labels: + additionalProperties: + type: string + description: Labels additional labels for the logger pod type: object - minItems: 1 - type: array - labels: - additionalProperties: - type: string - description: Labels additional labels for the logger pod - type: object - logFields: - description: LogFields fields ot the event to be logged. - items: - description: LogField defines a log field - properties: - name: - description: name of the log field - type: string - path: - description: Path within the corev1.Event struct https://github.com/kubernetes/api/blob/master/core/v1/types.go - items: + logFields: + description: LogFields fields ot the event to be logged. + items: + description: LogField defines a log field + properties: + name: + description: name of the log field + type: string + path: + description: Path within the corev1.Event struct https://github.com/kubernetes/api/blob/master/core/v1/types.go + items: + type: string + minItems: 1 + type: array + value: + description: Value a static value of the log field. Can be uses to add static log fields + nullable: true type: string - minItems: 1 - type: array - value: - description: Value a static value of the log field. Can be uses - to add static log fields - nullable: true - type: string - required: - - name + required: + - name + type: object + type: array + namespace: + description: namespace the namespace to watch on, may be an empty string + nullable: true + type: string + nodeSelector: + additionalProperties: + type: string + description: |- + NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ type: object - type: array - namespace: - description: namespace the namespace to watch on, may be an empty - string - nullable: true - type: string - nodeSelector: - additionalProperties: + scrapeMetrics: + description: ScrapeMetrics if true, prometheus scrape annotations are added to the pod + type: boolean + serviceAccount: + description: ServiceAccount the service account to use for the logger pod + type: string + type: object + status: + description: EventLoggerStatus defines the observed state of EventLogger + properties: + error: + description: Error + type: string + hash: + description: Hash + type: string + lastProcessed: + description: LastProcessed the timestamp the cr was last processed + format: date-time + type: string + operatorVersion: + description: OperatorVersion the version of the operator that processed the cr type: string - description: |- - NodeSelector is a selector which must be true for the pod to fit on a node. - Selector which must match a node's labels for the pod to be scheduled on that node. - More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ - type: object - scrapeMetrics: - description: ScrapeMetrics if true, prometheus scrape annotations - are added to the pod - type: boolean - serviceAccount: - description: ServiceAccount the service account to use for the logger - pod - type: string - type: object - status: - description: EventLoggerStatus defines the observed state of EventLogger - properties: - error: - description: Error - type: string - hash: - description: Hash - type: string - lastProcessed: - description: LastProcessed the timestamp the cr was last processed - format: date-time - type: string - operatorVersion: - description: OperatorVersion the version of the operator that processed - the cr - type: string - required: - - lastProcessed - - operatorVersion - type: object - type: object - served: true - storage: true + required: + - lastProcessed + - operatorVersion + type: object + type: object + served: true + storage: true