From 50cfc3835f42e8190bc0aee7aae968898710cd4c Mon Sep 17 00:00:00 2001 From: "andreas.knapp" Date: Sat, 22 Jun 2019 18:33:26 +0200 Subject: [PATCH] fix operator docker image error and add dos2unix to entrypoint Error was: Standard_init_linux.go:175 exec user process caused no such file solution found on: https://forums.docker.com/t/standard-init-linux-go-175-exec-user-process-caused-no-such-file/20025/2 --- .drone.yml | 2 +- Makefile | 2 +- build/bin/entrypoint | 2 + ...ppek_v1alpha1_mongodbatlascluster_crd.yaml | 211 ++++++++++++++++++ ...ppek_v1alpha1_mongodbatlasproject_crd.yaml | 81 +++++++ ...operator.v0.0.3.clusterserviceversion.yaml | 119 ++++++++++ deploy/operator-latest.yaml | 33 +++ deploy/operator.yaml | 2 +- 8 files changed, 449 insertions(+), 3 deletions(-) create mode 100644 deploy/olm-catalog/mongodbatlas-operator/0.0.3/knappek_v1alpha1_mongodbatlascluster_crd.yaml create mode 100644 deploy/olm-catalog/mongodbatlas-operator/0.0.3/knappek_v1alpha1_mongodbatlasproject_crd.yaml create mode 100644 deploy/olm-catalog/mongodbatlas-operator/0.0.3/mongodbatlas-operator.v0.0.3.clusterserviceversion.yaml create mode 100644 deploy/operator-latest.yaml diff --git a/.drone.yml b/.drone.yml index 4ab40744..0fc4a910 100644 --- a/.drone.yml +++ b/.drone.yml @@ -37,7 +37,7 @@ steps: repo: knappek/mongodbatlas-operator tag: - latest - - 0.0.2 + - 0.0.3 when: event: - tag diff --git a/Makefile b/Makefile index c9eedb7b..8d6e1c23 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ CRDS=$(shell echo deploy/crds/*_crd.yaml | sed 's/ / -f /g') GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) VERSION?=latest -OLM_VERSION?=0.0.2 +OLM_VERSION?=0.0.3 API_VERSION?=v1alpha1 KIND= diff --git a/build/bin/entrypoint b/build/bin/entrypoint index a14296cd..9b5a1089 100755 --- a/build/bin/entrypoint +++ b/build/bin/entrypoint @@ -3,6 +3,8 @@ # This is documented here: # https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines +dos2unix + if ! whoami &>/dev/null; then if [ -w /etc/passwd ]; then echo "${USER_NAME:-mongodbatlas-operator}:x:$(id -u):$(id -g):${USER_NAME:-mongodbatlas-operator} user:${HOME}:/sbin/nologin" >> /etc/passwd diff --git a/deploy/olm-catalog/mongodbatlas-operator/0.0.3/knappek_v1alpha1_mongodbatlascluster_crd.yaml b/deploy/olm-catalog/mongodbatlas-operator/0.0.3/knappek_v1alpha1_mongodbatlascluster_crd.yaml new file mode 100644 index 00000000..92993d9b --- /dev/null +++ b/deploy/olm-catalog/mongodbatlas-operator/0.0.3/knappek_v1alpha1_mongodbatlascluster_crd.yaml @@ -0,0 +1,211 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: mongodbatlasclusters.knappek.com +spec: + group: knappek.com + names: + kind: MongoDBAtlasCluster + listKind: MongoDBAtlasClusterList + plural: mongodbatlasclusters + singular: mongodbatlascluster + scope: Namespaced + validation: + 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/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/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + autoScaling: + properties: + diskGBEnabled: + type: boolean + required: + - diskGBEnabled + type: object + backupEnabled: + type: boolean + diskSizeGB: + format: double + type: number + mongoDBMajorVersion: + type: string + mongoDBVersion: + type: string + numShards: + format: int64 + type: integer + privateKey: + properties: + valueFrom: + properties: + secretKeyRef: + description: Selects a key of a secret in the CR's namespace + type: object + required: + - secretKeyRef + type: object + required: + - valueFrom + type: object + projectName: + type: string + providerBackupEnabled: + type: boolean + providerSettings: + properties: + backingProviderName: + type: string + diskIOPS: + format: int64 + type: integer + encryptEBSVolume: + type: boolean + instanceSizeName: + type: string + providerName: + type: string + regionName: + type: string + type: object + publicKey: + type: string + replicationFactor: + format: int64 + type: integer + replicationSpec: + additionalProperties: + properties: + analyticsNodes: + format: int64 + type: integer + electableNodes: + format: int64 + type: integer + priority: + format: int64 + type: integer + readOnlyNodes: + format: int64 + type: integer + required: + - priority + - electableNodes + - readOnlyNodes + - analyticsNodes + type: object + type: object + required: + - publicKey + - privateKey + - projectName + - backupEnabled + - providerBackupEnabled + type: object + status: + properties: + autoScaling: + properties: + diskGBEnabled: + type: boolean + required: + - diskGBEnabled + type: object + backupEnabled: + type: boolean + diskSizeGB: + format: double + type: number + groupID: + type: string + id: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed state + of cluster Important: Run "operator-sdk generate k8s" to regenerate + code after modifying this file Add custom validation using kubebuilder + tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html' + type: string + mongoDBMajorVersion: + type: string + mongoDBVersion: + type: string + mongoURI: + type: string + mongoURIUpdated: + type: string + mongoURIWithOptions: + type: string + name: + type: string + numShards: + format: int64 + type: integer + paused: + type: boolean + providerBackupEnabled: + type: boolean + providerSettings: + properties: + backingProviderName: + type: string + diskIOPS: + format: int64 + type: integer + encryptEBSVolume: + type: boolean + instanceSizeName: + type: string + providerName: + type: string + regionName: + type: string + type: object + replicationFactor: + format: int64 + type: integer + replicationSpec: + additionalProperties: + properties: + analyticsNodes: + format: int64 + type: integer + electableNodes: + format: int64 + type: integer + priority: + format: int64 + type: integer + readOnlyNodes: + format: int64 + type: integer + required: + - priority + - electableNodes + - readOnlyNodes + - analyticsNodes + type: object + type: object + srvAddress: + type: string + stateName: + type: string + required: + - backupEnabled + - providerBackupEnabled + - paused + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true diff --git a/deploy/olm-catalog/mongodbatlas-operator/0.0.3/knappek_v1alpha1_mongodbatlasproject_crd.yaml b/deploy/olm-catalog/mongodbatlas-operator/0.0.3/knappek_v1alpha1_mongodbatlasproject_crd.yaml new file mode 100644 index 00000000..efb3edcc --- /dev/null +++ b/deploy/olm-catalog/mongodbatlas-operator/0.0.3/knappek_v1alpha1_mongodbatlasproject_crd.yaml @@ -0,0 +1,81 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: mongodbatlasprojects.knappek.com +spec: + group: knappek.com + names: + kind: MongoDBAtlasProject + listKind: MongoDBAtlasProjectList + plural: mongodbatlasprojects + singular: mongodbatlasproject + scope: Namespaced + subresources: + status: {} + validation: + 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/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/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + orgID: + type: string + privateKey: + properties: + valueFrom: + properties: + secretKeyRef: + description: Selects a key of a secret in the CR's namespace + type: object + required: + - secretKeyRef + type: object + required: + - valueFrom + type: object + publicKey: + type: string + required: + - publicKey + - privateKey + type: object + status: + properties: + clusterCount: + format: int64 + type: integer + created: + type: string + id: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed state + of cluster Important: Run "operator-sdk generate k8s" to regenerate + code after modifying this file Add custom validation using kubebuilder + tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html' + type: string + name: + type: string + orgID: + type: string + required: + - id + - name + - orgID + - created + - clusterCount + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true diff --git a/deploy/olm-catalog/mongodbatlas-operator/0.0.3/mongodbatlas-operator.v0.0.3.clusterserviceversion.yaml b/deploy/olm-catalog/mongodbatlas-operator/0.0.3/mongodbatlas-operator.v0.0.3.clusterserviceversion.yaml new file mode 100644 index 00000000..d6654357 --- /dev/null +++ b/deploy/olm-catalog/mongodbatlas-operator/0.0.3/mongodbatlas-operator.v0.0.3.clusterserviceversion.yaml @@ -0,0 +1,119 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + alm-examples: '[{"apiVersion":"knappek.com/v1alpha1","kind":"MongoDBAtlasCluster","metadata":{"name":"example-mongodbatlascluster"},"spec":{"autoscaling":{"diskGBEnabled":false},"backupEnabled":false,"numShards":1,"orgID":"5c4a2a55553855344780cf5f","privateKey":{"valueFrom":{"secretKeyRef":{"key":"privateKey","name":"example-monogdb-atlas-project"}}},"projectName":"example-project","providerBackupEnabled":false,"providerSettings":{"encryptEBSVolume":false,"instanceSizeName":"M10","providerName":"AWS","regionName":"EU_CENTRAL_1"},"publicKey":"toppaljd"}},{"apiVersion":"knappek.com/v1alpha1","kind":"MongoDBAtlasProject","metadata":{"name":"example-project"},"spec":{"orgID":"5c4a2a55553855344780cf5f","privateKey":{"valueFrom":{"secretKeyRef":{"key":"privateKey","name":"example-monogdb-atlas-project"}}},"publicKey":"toppaljd"}}]' + capabilities: Basic Install + name: mongodbatlas-operator.v0.0.3 + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - kind: MongoDBAtlasCluster + name: mongodbatlasclusters.knappek.com + version: v1alpha1 + - kind: MongoDBAtlasProject + name: mongodbatlasprojects.knappek.com + version: v1alpha1 + description: Placeholder description + displayName: Mongodbatlas Operator + install: + spec: + deployments: + - name: mongodbatlas-operator + spec: + replicas: 1 + selector: + matchLabels: + name: mongodbatlas-operator + strategy: {} + template: + metadata: + labels: + name: mongodbatlas-operator + spec: + containers: + - command: + - mongodbatlas-operator + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: mongodbatlas-operator + image: knappek/mongodbatlas-operator:0.0.3 + imagePullPolicy: Always + name: mongodbatlas-operator + resources: {} + serviceAccountName: mongodbatlas-operator + permissions: + - rules: + - apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' + - apiGroups: + - "" + resources: + - namespaces + verbs: + - get + - apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' + - apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create + - apiGroups: + - apps + resourceNames: + - mongodbatlas-operator + resources: + - deployments/finalizers + verbs: + - update + - apiGroups: + - knappek.com + resources: + - '*' + - mongodbatlasclusters + verbs: + - '*' + serviceAccountName: mongodbatlas-operator + strategy: deployment + installModes: + - supported: true + type: OwnNamespace + - supported: true + type: SingleNamespace + - supported: false + type: MultiNamespace + - supported: true + type: AllNamespaces + maturity: alpha + provider: {} + version: 0.0.3 diff --git a/deploy/operator-latest.yaml b/deploy/operator-latest.yaml new file mode 100644 index 00000000..7d1886ef --- /dev/null +++ b/deploy/operator-latest.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mongodbatlas-operator +spec: + replicas: 1 + selector: + matchLabels: + name: mongodbatlas-operator + template: + metadata: + labels: + name: mongodbatlas-operator + spec: + serviceAccountName: mongodbatlas-operator + containers: + - name: mongodbatlas-operator + # Replace this with the built image name + image: knappek/mongodbatlas-operator:latest + command: + - mongodbatlas-operator + imagePullPolicy: Always + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "mongodbatlas-operator" diff --git a/deploy/operator.yaml b/deploy/operator.yaml index fc14b4bf..d6fdee8f 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -16,7 +16,7 @@ spec: containers: - name: mongodbatlas-operator # Replace this with the built image name - image: knappek/mongodbatlas-operator:0.0.1 + image: knappek/mongodbatlas-operator:0.0.3 command: - mongodbatlas-operator imagePullPolicy: Always