From 9d58f71f94891e849020e69c775b5fd5e492eb4a Mon Sep 17 00:00:00 2001 From: Lucas Caparelli Date: Tue, 5 Jan 2021 10:42:02 -0300 Subject: [PATCH] Upgrade to operator-sdk v1.2.0 and go v1.15.6 (#196) Signed-off-by: Lucas Caparelli --- Dockerfile | 2 +- Makefile | 2 +- RELEASE_NOTES.md | 2 + bundle.Dockerfile | 4 +- ...nitoring.coreos.com_v1_servicemonitor.yaml | 13 ++ ...er-manager-metrics-service_v1_service.yaml | 16 ++ .../nexus-operator.clusterserviceversion.yaml | 2 +- bundle/metadata/annotations.yaml | 3 +- .../nexus-operator.clusterserviceversion.yaml | 2 +- go.mod | 2 +- nexus-operator.yaml | 173 +++++++++++++----- 11 files changed, 167 insertions(+), 54 deletions(-) create mode 100644 bundle/manifests/nexus-operator-controller-manager-metrics-monitor_monitoring.coreos.com_v1_servicemonitor.yaml create mode 100644 bundle/manifests/nexus-operator-controller-manager-metrics-service_v1_service.yaml diff --git a/Dockerfile b/Dockerfile index 0bc19a14..1073d7ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.14 as builder +FROM golang:1.15 as builder WORKDIR /workspace # Copy the Go Modules manifests diff --git a/Makefile b/Makefile index 46962abb..f35682f2 100644 --- a/Makefile +++ b/Makefile @@ -134,7 +134,7 @@ endif # Generate bundle manifests and metadata, then validate generated files. .PHONY: bundle -bundle: manifests +bundle: manifests kustomize operator-sdk generate kustomize manifests -q cd config/manager && $(KUSTOMIZE) edit set image controller=$(OPERATOR_IMG) $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 02d276ea..a8308b08 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,6 +1,8 @@ ## Version 0.5.0 ### Enhancements +- #198 - Upgrade to Go v1.15.6 +- #199 - Upgrade to operator-sdk v1.2.0 ### Bug Fixes - #191 - Pod fails to start after modifying the Nexus resource diff --git a/bundle.Dockerfile b/bundle.Dockerfile index 5d4c234f..9e0d579f 100644 --- a/bundle.Dockerfile +++ b/bundle.Dockerfile @@ -5,13 +5,11 @@ LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ LABEL operators.operatorframework.io.bundle.package.v1=nexus-operator LABEL operators.operatorframework.io.bundle.channels.v1=alpha -LABEL operators.operatorframework.io.bundle.channel.default.v1= -LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.0.1 +LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.2.0 LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v2 LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 - COPY bundle/manifests /manifests/ COPY bundle/metadata /metadata/ COPY bundle/tests/scorecard /tests/scorecard/ diff --git a/bundle/manifests/nexus-operator-controller-manager-metrics-monitor_monitoring.coreos.com_v1_servicemonitor.yaml b/bundle/manifests/nexus-operator-controller-manager-metrics-monitor_monitoring.coreos.com_v1_servicemonitor.yaml new file mode 100644 index 00000000..9a0b2175 --- /dev/null +++ b/bundle/manifests/nexus-operator-controller-manager-metrics-monitor_monitoring.coreos.com_v1_servicemonitor.yaml @@ -0,0 +1,13 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + control-plane: controller-manager + name: nexus-operator-controller-manager-metrics-monitor +spec: + endpoints: + - path: /metrics + port: https + selector: + matchLabels: + control-plane: controller-manager diff --git a/bundle/manifests/nexus-operator-controller-manager-metrics-service_v1_service.yaml b/bundle/manifests/nexus-operator-controller-manager-metrics-service_v1_service.yaml new file mode 100644 index 00000000..5623a8f8 --- /dev/null +++ b/bundle/manifests/nexus-operator-controller-manager-metrics-service_v1_service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + control-plane: controller-manager + name: nexus-operator-controller-manager-metrics-service +spec: + ports: + - name: https + port: 8443 + targetPort: https + selector: + control-plane: controller-manager +status: + loadBalancer: {} diff --git a/bundle/manifests/nexus-operator.clusterserviceversion.yaml b/bundle/manifests/nexus-operator.clusterserviceversion.yaml index 23ce5cdb..c08bddbc 100644 --- a/bundle/manifests/nexus-operator.clusterserviceversion.yaml +++ b/bundle/manifests/nexus-operator.clusterserviceversion.yaml @@ -38,7 +38,7 @@ metadata: containerImage: quay.io/m88i/nexus-operator:0.5.0 createdAt: "2019-11-16T13:12:22Z" description: Nexus Operator to deploy and manage Nexus 3.x servers - operators.operatorframework.io/builder: operator-sdk-v1.0.1 + operators.operatorframework.io/builder: operator-sdk-v1.2.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v2 repository: https://github.com/m88i/nexus-operator support: m88i Labs diff --git a/bundle/metadata/annotations.yaml b/bundle/metadata/annotations.yaml index 65acb5c9..3d71ddcc 100644 --- a/bundle/metadata/annotations.yaml +++ b/bundle/metadata/annotations.yaml @@ -1,11 +1,10 @@ annotations: - operators.operatorframework.io.bundle.channel.default.v1: "" operators.operatorframework.io.bundle.channels.v1: alpha operators.operatorframework.io.bundle.manifests.v1: manifests/ operators.operatorframework.io.bundle.mediatype.v1: registry+v1 operators.operatorframework.io.bundle.metadata.v1: metadata/ operators.operatorframework.io.bundle.package.v1: nexus-operator - operators.operatorframework.io.metrics.builder: operator-sdk-v1.0.1 + operators.operatorframework.io.metrics.builder: operator-sdk-v1.2.0 operators.operatorframework.io.metrics.mediatype.v1: metrics+v1 operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v2 operators.operatorframework.io.test.config.v1: tests/scorecard/ diff --git a/config/manifests/bases/nexus-operator.clusterserviceversion.yaml b/config/manifests/bases/nexus-operator.clusterserviceversion.yaml index b7530fc7..f2e73aff 100644 --- a/config/manifests/bases/nexus-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/nexus-operator.clusterserviceversion.yaml @@ -38,7 +38,7 @@ metadata: containerImage: quay.io/m88i/nexus-operator:0.5.0 createdAt: "2019-11-16T13:12:22Z" description: Nexus Operator to deploy and manage Nexus 3.x servers - operators.operatorframework.io/builder: operator-sdk-v1.0.1 + operators.operatorframework.io/builder: operator-sdk-v1.2.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v2 repository: https://github.com/m88i/nexus-operator support: m88i Labs diff --git a/go.mod b/go.mod index 435b70ee..968071c0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/m88i/nexus-operator -go 1.14 +go 1.15 require ( github.com/RHsyseng/operator-utils v1.4.4 diff --git a/nexus-operator.yaml b/nexus-operator.yaml index 6b409db9..dbce795c 100644 --- a/nexus-operator.yaml +++ b/nexus-operator.yaml @@ -47,10 +47,14 @@ spec: openAPIV3Schema: 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' + 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' + 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 @@ -61,51 +65,76 @@ spec: description: Automatic updates configuration properties: disabled: - description: Whether or not the Operator should perform automatic updates. Defaults to `false` (auto updates are enabled). Is set to `false` if `spec.image` is not empty and is different from the default community image. + description: Whether or not the Operator should perform automatic + updates. Defaults to `false` (auto updates are enabled). Is set + to `false` if `spec.image` is not empty and is different from + the default community image. type: boolean minorVersion: - description: The Nexus image minor version the deployment should stay in. If left blank and automatic updates are enabled the latest minor is set. + description: The Nexus image minor version the deployment should + stay in. If left blank and automatic updates are enabled the latest + minor is set. minimum: 0 type: integer type: object generateRandomAdminPassword: - description: 'GenerateRandomAdminPassword enables the random password generation. Defaults to `false`: the default password for a newly created instance is ''admin123'', which should be changed in the first login. If set to `true`, you must use the automatically generated ''admin'' password, stored in the container''s file system at `/nexus-data/admin.password`. The operator uses the default credentials to create a user for itself to create default repositories. If set to `true`, the repositories won''t be created since the operator won''t fetch for the random password.' + description: 'GenerateRandomAdminPassword enables the random password + generation. Defaults to `false`: the default password for a newly + created instance is ''admin123'', which should be changed in the first + login. If set to `true`, you must use the automatically generated + ''admin'' password, stored in the container''s file system at `/nexus-data/admin.password`. + The operator uses the default credentials to create a user for itself + to create default repositories. If set to `true`, the repositories + won''t be created since the operator won''t fetch for the random password.' type: boolean image: - description: 'Full image tag name for this specific deployment. Will be ignored if `spec.useRedHatImage` is set to `true`. Default: docker.io/sonatype/nexus3:latest' + description: 'Full image tag name for this specific deployment. Will + be ignored if `spec.useRedHatImage` is set to `true`. Default: docker.io/sonatype/nexus3:latest' type: string imagePullPolicy: - description: 'The image pull policy for the Nexus image. If left blank behavior will be determined by the image tag (`Always` if "latest" and `IfNotPresent` otherwise). Possible values: `Always`, `IfNotPresent` or `Never`.' + description: 'The image pull policy for the Nexus image. If left blank + behavior will be determined by the image tag (`Always` if "latest" + and `IfNotPresent` otherwise). Possible values: `Always`, `IfNotPresent` + or `Never`.' enum: - Always - IfNotPresent - Never type: string livenessProbe: - description: LivenessProbe describes how the Nexus container liveness probe should work + description: LivenessProbe describes how the Nexus container liveness + probe should work properties: failureThreshold: - description: Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1. + description: Minimum consecutive failures for the probe to be considered + failed after having succeeded. Defaults to 3. Minimum value is + 1. format: int32 minimum: 1 type: integer initialDelaySeconds: - description: Number of seconds after the container has started before probes are initiated. Defaults to 240 seconds. Minimum value is 0. + description: Number of seconds after the container has started before + probes are initiated. Defaults to 240 seconds. Minimum value is + 0. format: int32 minimum: 0 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. Defaults to 10 seconds. Minimum value is 1. + description: How often (in seconds) to perform the probe. Defaults + to 10 seconds. Minimum value is 1. format: int32 minimum: 1 type: integer successThreshold: - description: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + description: Minimum consecutive successes for the probe to be considered + successful after having failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. format: int32 minimum: 1 type: integer timeoutSeconds: - description: Number of seconds after which the probe times out. Defaults to 15 seconds. Minimum value is 1. + description: Number of seconds after which the probe times out. + Defaults to 15 seconds. Minimum value is 1. format: int32 minimum: 1 type: integer @@ -114,30 +143,41 @@ spec: description: Networking definition properties: expose: - description: Set to `true` to expose the Nexus application. Defaults to `false`. + description: Set to `true` to expose the Nexus application. Defaults + to `false`. type: boolean exposeAs: - description: 'Type of networking exposure: NodePort, Route or Ingress. Defaults to Route on OpenShift and Ingress on Kubernetes. Routes are only available on Openshift and Ingresses are only available on Kubernetes.' + description: 'Type of networking exposure: NodePort, Route or Ingress. + Defaults to Route on OpenShift and Ingress on Kubernetes. Routes + are only available on Openshift and Ingresses are only available + on Kubernetes.' enum: - NodePort - Route - Ingress type: string host: - description: Host where the Nexus service is exposed. This attribute is required if the service is exposed via Ingress. + description: Host where the Nexus service is exposed. This attribute + is required if the service is exposed via Ingress. type: string nodePort: - description: NodePort defined in the exposed service. Required if exposed via NodePort. + description: NodePort defined in the exposed service. Required if + exposed via NodePort. format: int32 type: integer tls: description: TLS/SSL-related configuration properties: mandatory: - description: When exposing via Route, set to `true` to only allow encrypted traffic using TLS (disables HTTP in favor of HTTPS). Defaults to `false`. + description: When exposing via Route, set to `true` to only + allow encrypted traffic using TLS (disables HTTP in favor + of HTTPS). Defaults to `false`. type: boolean secretName: - description: When exposing via Ingress, inform the name of the TLS secret containing certificate and private key for TLS encryption. It must be present in the same namespace as the Operator. + description: When exposing via Ingress, inform the name of the + TLS secret containing certificate and private key for TLS + encryption. It must be present in the same namespace as the + Operator. type: string type: object type: object @@ -145,7 +185,8 @@ spec: description: Persistence definition properties: persistent: - description: Flag to indicate if this instance will be persistent or not + description: Flag to indicate if this instance will be persistent + or not type: boolean storageClass: description: StorageClass used by the managed PVC. @@ -157,30 +198,39 @@ spec: - persistent type: object readinessProbe: - description: ReadinessProbe describes how the Nexus container readiness probe should work + description: ReadinessProbe describes how the Nexus container readiness + probe should work properties: failureThreshold: - description: Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1. + description: Minimum consecutive failures for the probe to be considered + failed after having succeeded. Defaults to 3. Minimum value is + 1. format: int32 minimum: 1 type: integer initialDelaySeconds: - description: Number of seconds after the container has started before probes are initiated. Defaults to 240 seconds. Minimum value is 0. + description: Number of seconds after the container has started before + probes are initiated. Defaults to 240 seconds. Minimum value is + 0. format: int32 minimum: 0 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. Defaults to 10 seconds. Minimum value is 1. + description: How often (in seconds) to perform the probe. Defaults + to 10 seconds. Minimum value is 1. format: int32 minimum: 1 type: integer successThreshold: - description: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + description: Minimum consecutive successes for the probe to be considered + successful after having failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. format: int32 minimum: 1 type: integer timeoutSeconds: - description: Number of seconds after which the probe times out. Defaults to 15 seconds. Minimum value is 1. + description: Number of seconds after which the probe times out. + Defaults to 15 seconds. Minimum value is 1. format: int32 minimum: 1 type: integer @@ -201,7 +251,8 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' type: object requests: additionalProperties: @@ -210,24 +261,43 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + description: 'Requests describes the minimum amount of compute resources + required. If Requests is omitted for a container, it defaults + to Limits if that is explicitly specified, otherwise to an implementation-defined + value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' type: object type: object serverOperations: - description: ServerOperations describes the options for the operations performed on the deployed server instance + description: ServerOperations describes the options for the operations + performed on the deployed server instance properties: disableOperatorUserCreation: - description: DisableOperatorUserCreation disables the auto-creation of the `nexus-operator` user on the deployed server. This user performs all the operations on the server (such as creating the community repos). If disabled, the Operator will use the default `admin` user. Defaults to `false` (always create the user). Setting this to `true` is not recommended as it grants the Operator more privileges than it needs and it would not be possible to tell apart operations performed by the `admin` and the Operator. + description: DisableOperatorUserCreation disables the auto-creation + of the `nexus-operator` user on the deployed server. This user + performs all the operations on the server (such as creating the + community repos). If disabled, the Operator will use the default + `admin` user. Defaults to `false` (always create the user). Setting + this to `true` is not recommended as it grants the Operator more + privileges than it needs and it would not be possible to tell + apart operations performed by the `admin` and the Operator. type: boolean disableRepositoryCreation: - description: DisableRepositoryCreation disables the auto-creation of Apache, JBoss and Red Hat repositories and their addition to the Maven Public group in this Nexus instance. Defaults to `false` (always try to create the repos). Set this to `true` to not create them. Only works if `spec.generateRandomAdminPassword` is `false`. + description: DisableRepositoryCreation disables the auto-creation + of Apache, JBoss and Red Hat repositories and their addition to + the Maven Public group in this Nexus instance. Defaults to `false` + (always try to create the repos). Set this to `true` to not create + them. Only works if `spec.generateRandomAdminPassword` is `false`. type: boolean type: object serviceAccountName: - description: ServiceAccountName is the name of the ServiceAccount used to run the Pods. If left blank, a default ServiceAccount is created with the same name as the Nexus CR (`metadata.name`). + description: ServiceAccountName is the name of the ServiceAccount used + to run the Pods. If left blank, a default ServiceAccount is created + with the same name as the Nexus CR (`metadata.name`). type: string useRedHatImage: - description: If you have access to Red Hat Container Catalog, set this to `true` to use the certified image provided by Sonatype Defaults to `false` + description: If you have access to Red Hat Container Catalog, set this + to `true` to use the certified image provided by Sonatype Defaults + to `false` type: boolean required: - persistence @@ -241,20 +311,26 @@ spec: description: Condition status for the Nexus deployment properties: availableReplicas: - description: Total number of available pods (ready for at least minReadySeconds) targeted by this deployment. + description: Total number of available pods (ready for at least + minReadySeconds) targeted by this deployment. format: int32 type: integer collisionCount: - description: Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet. + description: Count of hash collisions for the Deployment. The Deployment + controller uses this field as a collision avoidance mechanism + when it needs to create the name for the newest ReplicaSet. format: int32 type: integer conditions: - description: Represents the latest available observations of a deployment's current state. + description: Represents the latest available observations of a deployment's + current state. items: - description: DeploymentCondition describes the state of a deployment at a certain point. + description: DeploymentCondition describes the state of a deployment + at a certain point. properties: lastTransitionTime: - description: Last time the condition transitioned from one status to another. + description: Last time the condition transitioned from one + status to another. format: date-time type: string lastUpdateTime: @@ -262,13 +338,15 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about the transition. + description: A human readable message indicating details about + the transition. type: string reason: description: The reason for the condition's last transition. type: string status: - description: Status of the condition, one of True, False, Unknown. + description: Status of the condition, one of True, False, + Unknown. type: string type: description: Type of deployment condition. @@ -287,15 +365,21 @@ spec: format: int32 type: integer replicas: - description: Total number of non-terminated pods targeted by this deployment (their labels match the selector). + description: Total number of non-terminated pods targeted by this + deployment (their labels match the selector). format: int32 type: integer unavailableReplicas: - description: Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created. + description: Total number of unavailable pods targeted by this deployment. + This is the total number of pods that are still required for the + deployment to have 100% available capacity. They may either be + pods that are running but not yet available or pods that still + have not been created. format: int32 type: integer updatedReplicas: - description: Total number of non-terminated pods targeted by this deployment that have the desired template spec. + description: Total number of non-terminated pods targeted by this + deployment that have the desired template spec. format: int32 type: integer type: object @@ -309,7 +393,8 @@ spec: description: Gives more information about a failure status type: string serverOperationsStatus: - description: ServerOperationsStatus describes the general status for the operations performed in the Nexus server instance + description: ServerOperationsStatus describes the general status for + the operations performed in the Nexus server instance properties: communityRepositoriesCreated: type: boolean