mongodb / mongodb-atlas-kubernetes

MongoDB Atlas Kubernetes Operator - Manage your MongoDB Atlas clusters from Kubernetes
http://www.mongodb.com/cloud/atlas
Apache License 2.0
152 stars 78 forks source link

`atlas kubernetes generate ...` manifests issues in Deployment #855

Closed zelig81 closed 1 year ago

zelig81 commented 1 year ago

What did you do to encounter the bug? Steps to reproduce the behavior:

What did you expect? A clear and concise description of what you expected to happen.

What happened instead? A clear and concise description of what happened instead

Operator Information

Kubernetes Cluster Information

Additional context Add any other context about the problem here.

DB manifest ```yaml apiVersion: atlas.mongodb.com/v1 kind: AtlasDeployment metadata: creationTimestamp: null name: cluster0 namespace: atlas spec: advancedDeploymentSpec: backupEnabled: true biConnector: enabled: false readPreference: secondary clusterType: REPLICASET encryptionAtRestProvider: NONE name: cluster0 paused: false pitEnabled: true replicationSpecs: - numShards: 1 regionConfigs: - analyticsSpecs: instanceSize: M10 nodeCount: 0 autoScaling: compute: enabled: true maxInstanceSize: M30 minInstanceSize: M10 scaleDownEnabled: true diskGB: enabled: true electableSpecs: instanceSize: M10 nodeCount: 3 priority: 7 providerName: GCP readOnlySpecs: instanceSize: M10 nodeCount: 0 regionName: EASTERN_US zoneName: Zone 1 rootCertType: ISRGROOTX1 versionReleaseSystem: LTS backupRef: name: "" namespace: "" processArgs: javascriptEnabled: true minimumEnabledTlsProtocol: TLS1_2 noTableScan: false projectRef: name: poc_project namespace: atlas status: conditions: [] ```
operator error `{"level":"INFO","time":"2023-01-25T14:32:58.877Z","msg":"Status update","atlasdeployment":"atlas/cluster0","lastCondition":{"type":"DeploymentReady","status":"False","lastTransitionTime":null,"reason":"InternalError","message":"AtlasProject.atlas.mongodb.com \"poc_project\" not found"}}`
igor-karpukhin commented 1 year ago

Hi @zelig81. Resource names for k8s objects are always in lower case as well as they don't have to contain certain characters. See RFC1123. Could you please also post the AtlasProject resource that was generated?

zelig81 commented 1 year ago

Sorry, you are right:

AtlasProject ```yaml apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: creationTimestamp: null name: poc_project namespace: atlas spec: alertConfigurations: - enabled: true eventTypeName: REPLICATION_OPLOG_WINDOW_RUNNING_OUT metricThreshold: threshold: "" notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: operator: LESS_THAN threshold: "1.000000" units: HOURS - enabled: true eventTypeName: NO_PRIMARY metricThreshold: threshold: "" notifications: - delayMin: 15 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: CLUSTER_MONGOS_IS_MISSING metricThreshold: threshold: "" notifications: - delayMin: 15 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: OUTSIDE_METRIC_THRESHOLD metricThreshold: metricName: CONNECTIONS_PERCENT mode: AVERAGE operator: GREATER_THAN threshold: "80.000000" units: RAW notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: OUTSIDE_METRIC_THRESHOLD metricThreshold: metricName: DISK_PARTITION_SPACE_USED_DATA mode: AVERAGE operator: GREATER_THAN threshold: "90.000000" units: RAW notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: OUTSIDE_METRIC_THRESHOLD metricThreshold: metricName: QUERY_TARGETING_SCANNED_OBJECTS_PER_RETURNED mode: AVERAGE operator: GREATER_THAN threshold: "1000.000000" units: RAW notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: CREDIT_CARD_ABOUT_TO_EXPIRE metricThreshold: threshold: "" notifications: - delayMin: 0 emailEnabled: true intervalMin: 1440 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: OUTSIDE_METRIC_THRESHOLD metricThreshold: metricName: NORMALIZED_SYSTEM_CPU_USER mode: AVERAGE operator: GREATER_THAN threshold: "95.000000" units: RAW notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: HOST_HAS_INDEX_SUGGESTIONS metricThreshold: threshold: "" notifications: - delayMin: 10 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: HOST_MONGOT_CRASHING_OOM metricThreshold: threshold: "" notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: OUTSIDE_SERVERLESS_METRIC_THRESHOLD metricThreshold: metricName: SERVERLESS_CONNECTIONS_PERCENT mode: AVERAGE operator: GREATER_THAN threshold: "80.000000" units: RAW notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: OUTSIDE_SERVERLESS_METRIC_THRESHOLD metricThreshold: metricName: SERVERLESS_DATA_SIZE_TOTAL mode: AVERAGE operator: GREATER_THAN threshold: "0.750000" units: TERABYTES notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: HOST_NOT_ENOUGH_DISK_SPACE metricThreshold: threshold: "" notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: JOINED_GROUP metricThreshold: threshold: "" notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: OUTSIDE_SERVERLESS_METRIC_THRESHOLD metricThreshold: metricName: SERVERLESS_TOTAL_READ_UNITS mode: AVERAGE operator: GREATER_THAN threshold: "0.250000" units: MILLION_RPU notifications: - delayMin: 30 emailEnabled: true intervalMin: 720 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: OUTSIDE_SERVERLESS_METRIC_THRESHOLD metricThreshold: metricName: SERVERLESS_TOTAL_READ_UNITS mode: AVERAGE operator: GREATER_THAN threshold: "1.000000" units: MILLION_RPU notifications: - delayMin: 5 emailEnabled: true intervalMin: 120 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} - enabled: true eventTypeName: OUTSIDE_METRIC_THRESHOLD metricThreshold: metricName: SEARCH_MAX_NUMBER_OF_LUCENE_DOCS mode: AVERAGE operator: GREATER_THAN threshold: "1.000000" units: BILLION notifications: - delayMin: 0 emailEnabled: true intervalMin: 60 roles: - GROUP_OWNER smsEnabled: false typeName: GROUP threshold: {} auditing: auditAuthorizationSuccess: false enabled: false connectionSecretRef: name: "" encryptionAtRest: awsKms: enabled: false valid: false azureKeyVault: enabled: false googleCloudKms: enabled: false maintenanceWindow: {} name: POC_PROJECT projectIpAccessList: - cidrBlock: 0.0.0.0/0 settings: isCollectDatabaseSpecificsStatisticsEnabled: true isDataExplorerEnabled: true isPerformanceAdvisorEnabled: true isRealtimePerformancePanelEnabled: true isSchemaAdvisorEnabled: true status: conditions: [] ```
zelig81 commented 1 year ago

My fault - I did not check the result of kubectl apply -k ... and there I had the following error: The AtlasProject "poc_project" is invalid: metadata.name: Invalid value: "poc_project": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

I'll do the changes manually - this issue should be opened in mongodb-atlas-cli :(

zelig81 commented 1 year ago

I got a next error (I'll add it to cli repo as well):

{"level":"INFO","time":"2023-01-26T08:26:59.370Z","msg":"Status update","atlasdeployment":"atlas/cluster0","lastCondition":{"type":"DeploymentReady","status":"False","lastTransitionTime":null,"reason":"InternalError","message":"groupId is invalid because must be set"}}

igor-karpukhin commented 1 year ago

Hi @zelig81. This is fixed by this PR: https://github.com/mongodb/mongodb-atlas-cli/pull/1631. We'll let you know when it is released

zelig81 commented 1 year ago

Hi @zelig81. This is fixed by this PR: mongodb/mongodb-atlas-cli#1631. We'll let you know when it is released

Thank you!!!!

igor-karpukhin commented 1 year ago

The fix is released with atlas-cli 1.5.0: https://github.com/mongodb/mongodb-atlas-cli/releases/tag/atlascli%2Fv1.5.0.

igor-karpukhin commented 1 year ago

Closing this one as fixed with AtlasCLI v1.5.0