mongodb / mongodb-atlas-cli

MongoDB Atlas CLI and MongoDB CLI enable you to manage your MongoDB in the Cloud
https://www.mongodb.com/docs/atlas/cli/stable/
Apache License 2.0
160 stars 72 forks source link

atlas kubernetes generate ... incorrect project name and DB version in Deployment and Project #1635

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.

duplicate mongodb/mongodb-atlas-kubernetes/issues/855

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: [] ```
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: [] ```
kubectl error for not compliant name of project `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])?)*')`
igor-karpukhin commented 1 year ago

Fixed by: https://github.com/mongodb/mongodb-atlas-cli/pull/1631. We'll let you know when it is released

zelig81 commented 1 year ago

About project names normalization, thank you, I got you...

Could it be that the work on DB version parsing from the Atlas deployment to k8s manifest as well is already fixed? Thank you in advance

igor-karpukhin commented 1 year ago

The MongoDB version issue is on our list, yes. It is intentionally not filled by the exporter, as if you try to apply this resource and the deployment already exists, it will fail, as PATCH requests are not allowed to change the MongoDB version for the provisioned clusters. So, this requires changes on the operator side.

zelig81 commented 1 year ago

@igor-karpukhin thank you! Would you like that I'll close the ticket? Currently I have all the answers that I need

igor-karpukhin commented 1 year ago

Hi, @zelig81. Thanks! I'm closing the ticket then.