IaC基础设施即代码:Terraform 创建ACK集群 与部署应用

目录

 一、实验

1.环境

2.Terraform 创建网络资源

3. 阿里云给RAM添加权限

4.Terraform 创建 ACK集群

5.在ACK集群中部署应用

6.销毁资源

二、问题

1.Terraform 验证失败

2.Terraform申请资源失败


 

 

 

 一、实验

1.环境

(1)主机

表1-1 主机

主机系统软件工具备注
jia

Windows 

Terraform 1.6.6VS Code、 PowerShell、 Chocolatey 

 

2.Terraform 创建网络资源

(1)查看项目

9ab54cbcdc0a4aed9008074caec794d0.png

(2)网络配置文件

network.tf 

//VPC 专有网络
resource "alicloud_vpc" "vpc" {vpc_name   = "k8s_vpc"cidr_block = "172.16.0.0/12"
}//switch 交换机
resource "alicloud_vswitch" "vsw" {vpc_id     = alicloud_vpc.vpc.idcidr_block = "172.16.0.0/16"zone_id    = "cn-hangzhou-j"
}

 

06a5289d858147ab8a2f7c5425ff31d7.png

(3) 版本配置文件

versions.tf

terraform {required_providers {alicloud = {source  = "aliyun/alicloud"version = "1.214.1"}}
}# Configure the Alicloud Provider 默认供应商
provider "alicloud" {access_key = var.access_keysecret_key = var.secret_keyregion     = "cn-hangzhou"
}

49ca244d623c406fb44ad147a60d5e4f.png

(4)变量配置文件

variables.tf

variable "access_key" {description = "access_key"}variable "secret_key" {description = "secret_key"
}

e55d43062af947219e90bad52e375ab0.png

 

(5) 密钥配置文件

terraform.tfvars

 

62801c8bf0df4c3594cfedd4b723a1ea.png

(6)初始化

terraform init

 

d99663c94fc8471aadf9d9183696334c.png

(7)格式化代码

terraform fmt

 

f8ea133b87ed4b669a1b6fb48495d671.png

(8)验证代码

terraform validate

 

8a696b4d4e894d8bbe13e70f21938809.png

(9)计划与预览

 terraform plan

0c2c279e6f5244ab82281506b3025768.png

 

(10)申请资源

terraform apply

a4d668221043449aadf61c97f8ce107e.png

 

(11)登录阿里云系统查看VPC

VPC已新增1个 (cn-hangzhou)

d8e06e53dfe54090b4d34160f39d26fb.png

 

交换机已新增1个 (cn-hangzhou)

 

acaf993301104456b7ab2c59d93b3d8c.png

 

3. 阿里云给RAM添加权限

(1)AliyunCSFullAcess

b305f07f47e746ae81a0826e34a2d019.png

b59bce833dc84be8aa7a428d42687ff5.png

(2)AliyunApiGatewayFullAcess

f4e724593d3d479e9569976d117eae8c.png

918dc98145b34cafb8e751a3e51312af.png

(3)NATGatewayFullAcess

9fafd458eb4240e5a93ea81f98787e1a.png

279074f1916440a99fbb30900d883c2a.png

 

4.Terraform 创建 ACK集群

(1)查看alicloud provider 示例

Terraform Registry

托管版K8S 示例

……resource "alicloud_cs_managed_kubernetes" "k8s" {name         = var.namecluster_spec = "ack.pro.small"# version can not be defined in variables.tf.version            = "1.26.3-aliyun.1"worker_vswitch_ids = length(var.vswitch_ids) > 0 ? split(",", join(",", var.vswitch_ids)) : length(var.vswitch_cidrs) < 1 ? [] : split(",", join(",", alicloud_vswitch.vswitches.*.id))pod_vswitch_ids    = length(var.terway_vswitch_ids) > 0 ? split(",", join(",", var.terway_vswitch_ids)) : length(var.terway_vswitch_cidrs) < 1 ? [] : split(",", join(",", alicloud_vswitch.terway_vswitches.*.id))new_nat_gateway    = truenode_cidr_mask     = var.node_cidr_maskproxy_mode         = var.proxy_modeservice_cidr       = var.service_cidrdynamic "addons" {for_each = var.cluster_addonscontent {name   = lookup(addons.value, "name", var.cluster_addons)config = lookup(addons.value, "config", var.cluster_addons)}}
}

867214271df148639049e7276f578535.png

(2) 修改主配置文件

main.tf

locals {cluster_version = "1.26.3-aliyun.1"service_cidr    = "192.168.0.0/16"pod_cidr        = "10.212.0.0/16"
}resource "alicloud_cs_managed_kubernetes" "k8s" {name                 = var.cluster_nameversion              = local.cluster_version  cluster_spec         = "ack.standard"worker_vswitch_ids   = [alicloud_vswitch.vsw.id] new_nat_gateway      = truepod_cidr             = local.service_cidrservice_cidr         = local.pod_cidrload_balancer_spec   = "slb.s1.small"slb_internet_enabled = truedynamic "addons" {for_each = var.cluster_addonscontent {name   = lookup(addons.value, "name", var.cluster_addons)config = lookup(addons.value, "config", var.cluster_addons)}}
}resource "alicloud_cs_kubernetes_node_pool" "default" {name                 = var.nodepool_namecluster_id           = alicloud_cs_managed_kubernetes.k8s.idvswitch_ids          = [alicloud_vswitch.vsw.id]instance_types       = ["ecs.g6.xlarge"]system_disk_category = "cloud_efficiency"system_disk_size     = 40desired_size         = 1password             = "Admin@123"runtime_name         = "containerd"runtime_version      = "1.6.20"
}

496c30d4126a435fb2d114d8cfc0805a.png

(3) 修改变量配置文件

variables.tf

variable "access_key" {description = "access_key"}variable "secret_key" {description = "secret_key"
}variable "cluster_name" {default = "k8s_cluster_01"
}variable "nodepool_name" {default = "k8s-nodepool"
}variable "cluster_addons" {type = list(object({name   = stringconfig = string}))default = [{"name"   = "flannel","config" = "",},{"name"   = "csi-plugin","config" = "",},{"name"   = "csi-provisioner","config" = "",},{"name"   = "logtail-ds","config" = "{'IngressDashboardEnabled':'true'}",},{"name"   = "nginx-ingress-controller","config" = "{'IngressSlbNetworkType':'internet'}",},{"name"   = "arms-prometheus","config" = "",},{"name"   = "ack-node-problem-detector","config" = "{'sls_project_name':''}",}]
}

f9e0deeedcef46dcbf63e79c8510516e.png

(4)  验证代码

terraform validate

 

a015185b62de40649647df5a496982d8.png

(5) 计划与预览

 terraform plan

 

1e50ea9cff4c4e98bf802aa38121bad3.png02288a9be8ff4b65b20428cb443741c2.png12fa61981e6647aebecd0a3d98102d6c.png

(6)申请资源

terraform apply

01a5109d97fd42aaae6c628637cbe848.png1cfb34e02aa04d7fac3defc04e6a9cac.png810e5004b89340f6b2e79a855b2d951e.png

yes ,用时大约6分钟

a2d3c9ba2bb648eca84c2cfcbf82953d.png

 

(7) 登录阿里云系统查看ACK集群

初始化中

0c7a956196ef4e14bebfdb61bf8bf016.png

运行中

005888b3894e47cd9e552167e7785c34.png

(8)查看节点池

节点池

290b8ae7495c41d1964fa65947935080.png

伸缩活动

7ee80fc837b941f9bd232c46da215fd8.png

(9)查看命名空间

8a2ef837e349412abf552aac4a729123.png

(10)查看网络

服务 service

cf08235fc56a4b3fbf3d4d67ca0414a8.png

 

5.在ACK集群中部署应用

(1)查看目录

54da1544775044e1953aae5a83ed794e.png

(2)Terraform模板(docker)

Terraform Registry

USE PROVIDER

terraform {required_providers {kubernetes = {source = "hashicorp/kubernetes"version = "2.25.2"}}
}provider "kubernetes" {# Configuration options
}

2c0da6a7327e4b7fbe839ac6e1690162.png

(3)下载软件包

https://github.com/hashicorp/terraform-provider-kubernetes/releases

ebdf9996b578423983a7665763011a2b.png

(3)修改K8S集群配置文件

阿里云系统查看连接集群信息

8aabbe2ef4ca4fe29ce876d3cdb46800.png

 

复制上面的连接集群信息到clustera.config

dce09b0204c34f4cbd507e1bc38bb0e4.png

 

(5)修改主配置文件

provider "kubernetes" {# Configuration optionsconfig_path    = "../config/clustera.config"config_context = "kubernetes-admin-c718a5ce282f94d539ee5ce1986370194"alias          = "clustera"insecure       = true
}resource "kubernetes_namespace" "jenkins" {provider = kubernetes.clusterametadata {name = "devops"}
}

3eeee993a8834d13a964fd9f1d01d6c0.png

 

(6)修改版本配置文件

terraform {required_providers {kubernetes = {source = "hashicorp/kubernetes"version = "2.25.2"}}
}provider "kubernetes" {# Configuration options
}

b78fa2155a5045b8afd212627906c50e.png

(7)修改输出配置文件

output "service_name" {value = kubernetes_service_v1.jenkins.metadata[0].name}

bec8e761d0a54774a18777d977835a12.png

(8)修改服务配置文件

jenkins.tf

resource "kubernetes_deployment_v1" "jenkins" {provider = kubernetes.clusterametadata {name = "jenkins"labels = {app = "jenkins"}namespace = kubernetes_namespace.jenkins.id}spec {replicas = 1selector {match_labels = {app = "jenkins"}}template {metadata {labels = {app = "jenkins"}}spec {container {image             = "jenkins/jenkins:latest"name              = "jenkins"image_pull_policy = "IfNotPresent"port {container_port = 8080}resources {limits = {cpu    = "1000m"memory = "4096Mi"}requests = {cpu    = "250m"memory = "1024Mi"}}#   liveness_probe {#     http_get {#       path = "/"#       port = 8080#     }#     initial_delay_seconds = 30#     period_seconds        = 3#   }}}}}
}resource "kubernetes_service_v1" "jenkins" {provider = kubernetes.clusterametadata {name      = "jenkins-service"namespace = kubernetes_namespace.jenkins.id}spec {selector = {app = kubernetes_deployment_v1.jenkins.metadata[0].labels.app}port {port        = 8080target_port = 8080}type = "ClusterIP"}
}resource "kubernetes_ingress_v1" "jenkins_ingress" {provider = kubernetes.clusterametadata {name      = "jenkins-ingress"namespace = kubernetes_namespace.jenkins.id}spec {rule {host = "jenkins.maojing.site"http {path {backend {service {name = kubernetes_service_v1.jenkins.metadata[0].nameport {number = 8080}}}path_type = "Prefix"path = "/"}}}}
}

0c764a459d2e4a5caa95512f43d6654b.png

(9)初始化

terraform init

a8e8dad86e1d4d1995ebf819936cf92c.png

 

(10)格式化代码

terraform fmt

a9d301edc39e4edea7c03e55707ef3fa.png

 

(11)验证代码

terraform validate

80a0ff1a7d484db3afca5121823966e6.png

 

(12)计划与预览

 terraform plan

46e0e19c6eb04472a44ac368269ea357.png59f23b6d3d354a228af227ebabedcd2d.png501aa7a983814358a6e00cb609d2a4cc.pnge51633331f334bd6a64fcd117db8697e.png

(13) 申请资源

terraform apply

14111e7cebd64e2bb6e0d467795f06a3.png

668f719b79c04821aa7a135feec4925a.png

5ce807acff5e40e9b70434cddcb34f37.png

c47ae47f57e44f4db4b3fcac6903f308.png

yes , 4个资源将被添加

f38b01b25a874a8d8cb19344ca164ef8.png

(14)登录阿里云系统查看

命名空间新增1个 devops

e534e2a6cb7b4582afb6bf2c6ac5fe35.png

工作负载(无状态deployment)新增1个jenkins

95d72e5139074ca284b537598946de7e.png

进入jenkins,状态为running

abaed85fe1d54faaa64c5ee07ed4b482.png

服务service

185db580c1454f89845e545eb07bd532.png

service关联路由

57a7eec08076465fb27374c1d8b276be.png

 

(15)修改输出配置文件

outputs.tf,添加如下代码

output "ingress_ip" {value = kubernetes_ingress_v1.jenkins_ingress.status[0].load_balancer[0].ingress[0].ip
}

ac0702191acb47e0ad0caee2f8c94475.png

(16)计划与预览

 terraform plan

成功拿到ingress的ip

aee32260f17341068e0ae673e8c90b53.png

 

(17)添加DNS配置文件

dns.tf

#  DNS
resource "alicloud_dns_record" "record" {name        = "maojing.site"host_record = "jenkins"type        = "A"value       = kubernetes_ingress_v1.jenkins_ingress.status[0].load_balancer[0].ingress[0].ip
}

5d7a4ce04361414e8af5cc4be5222e82.png

(18) 添加变量配置文件

variables.tf

variable "access_key" {description = "access_key"}variable "secret_key" {description = "secret_key"
}

5850877302ba40c984462ffc8d2f64e6.png

(19) 修改版本配置文件

terraform {required_providers {kubernetes = {source  = "hashicorp/kubernetes"version = "2.25.2"}alicloud = {source  = "aliyun/alicloud"version = "1.214.1"}}
}provider "kubernetes" {# Configuration options
}# Configure the Alicloud Provider 默认供应商
provider "alicloud" {access_key = var.access_keysecret_key = var.secret_keyregion     = "cn-hangzhou"
}

1dbbdd06239e42c78be8f803f9b6ac82.png

92d1cad54d0e4565966ade5759dbb4f7.png

(20)初始化

terraform init

0e573712dc0b4d1eace1bc0cac12afa0.png

(21)格式化代码

terraform fmt

8f8a45f0b93143e29304238183cd3243.png

(22)验证代码

terraform validate

e39fd6de02484f4cafd32d34312a68d1.png

(23)计划与预览

 terraform plan

54ebef1848704de090e44227e4f832a0.png

(24)申请资源

terraform apply

5268af8a19944d4bb62842de06745ef3.png

yes

cd219865faa14e618862c8b577d07a35.png

(25)阿里云系统查看

域名解析已新增

ca1f0736fd3645649107d32a446ed29f.png

(26)dig测试DNS

dig jenkins.maojing.site

2be47f1ee1da48c3a7b4eb135fa8dfb5.png

(27) 浏览器测试

显示Jenkins安装界面

6d774444547d4faba7520cf172a56a92.png

(28) 查看集群监控

92fd50d2e4254138b32e6f7f8473787a.pngef9644502c7d4a79bce612e5a482ddaa.png

 

6.销毁资源

(1)销毁服务资源

terraform destroy

2fc0d46bfcc4495ba18d2fa04556d87f.png

b95360b726714f8db446ba8a14c96a3e.png016b65fa035d4e5c9086ee4b31f28f67.png67c32bfc509244a39138352ce4635eb8.png

yes

a2315e97301e48e1923851357fef1105.png

(2)登录阿里云系统

DNS解析已删除

ac3ae6d1caf8427d94c1ebed923894e3.png

devops命名空间已删除

3e113ff8ef7f44d9816672ccb7281dc2.png

 

(3)销毁集群资源

terraform destroy

9ec0ef4bbb8b4719bf43550f1ad43804.png

2f66b1a0b7664a0b8cc8b1afa2d086bb.pngd93f44573a854fa98b82d6f618e1edc1.png17f838a0cfe844f4a52e8e4e1f253e82.png800b50e43e8b43d6a4e20344f7aa699f.png

yes ,用时大约5分钟

e2562b2d1a35470daeccd0d1b05844c1.png

(4)登录阿里云系统查看集群

删除中

8ed3dc23e0244a608ec99859a892e928.png

已删除

b7f0097142664195859c85db2aa9d984.png

二、问题

1.Terraform 验证失败

(1)报错

╷
│ Error: "availability_zone": [REMOVED] Field 'availability_zone' has been removed from provider version 1.212.0.
│
│   with alicloud_cs_managed_kubernetes.k8s,
│   on main.tf line 7, in resource "alicloud_cs_managed_kubernetes" "k8s":
│    7: resource "alicloud_cs_managed_kubernetes" "k8s" {

7eb41f2eb3d44837a1cc1ab20963b052.png

│ Error: "availability_zone": [REMOVED] Field 'availability_zone' has been removed from provider version 1.212.0.
│
│   with alicloud_cs_managed_kubernetes.k8s,
│   on main.tf line 7, in resource "alicloud_cs_managed_kubernetes" "k8s":
│    7: resource "alicloud_cs_managed_kubernetes" "k8s" {

c4f60055b8374e5cb38697f0f24e40fa.png

│ Error: "runtime": [REMOVED] Field 'runtime' has been removed from provider version 1.212.0. Please use resource 'alicloud_cs_kubernetes_node_pool' to manage cluster nodes, by using field 'runtime_name' and 'runtime_version' to replace it.
│
│   with alicloud_cs_managed_kubernetes.k8s,
│   on main.tf line 7, in resource "alicloud_cs_managed_kubernetes" "k8s":
│    7: resource "alicloud_cs_managed_kubernetes" "k8s" {

c266f418dc8f4ca9a30879fe8015ab1c.png

(2)原因分析

Terraform Registry

从1.212版本开始,部分关键地段被移除,推荐使用alicloud_cs_kubernetes_node_pool 管理工作节点。

From version 1.212.0, runtime,enable_ssh,rds_instances,exclude_autoscaler_nodes,worker_number,worker_instance_types,password,key_name,kms_encrypted_password,kms_encryption_context,worker_instance_charge_type,worker_period,worker_period_unit,worker_auto_renew,worker_auto_renew_period,worker_disk_category,worker_disk_size,worker_data_disks,node_name_mode,node_port_range,os_type,platform,image_id,cpu_policy,user_data,taints,worker_disk_performance_level,worker_disk_snapshot_policy_id,install_cloud_monitor,kube_config,availability_zone are removed. Please use resource alicloud_cs_kubernetes_node_pool to manage your cluster worker nodes.

e34839b283c64b1297fddf016aa83af2.png

(3)解决方法

修改配置文件。

496c30d4126a435fb2d114d8cfc0805a.png

 

2.Terraform申请资源失败

(1)报错

Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes.go:1230: Resource c28e6d5ac0cf64922a476e6963f1239b8 DescribeNatGateways Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
│ SDK.ServerError
│ ErrorCode: Forbidden.RAM
│ Recommend: https://api.aliyun.com/troubleshoot?q=Forbidden.RAM&product=Vpc&requestId=0254494A-FE5F-51C9-96DA-394123C37E13
│ RequestId: 0254494A-FE5F-51C9-96DA-394123C37E13
│ Message: User not authorized to operate on the specified resource, or this API doesn't support RAM.
│ RespHeaders: map[Access-Control-Allow-Origin:[*] Access-Control-Expose-Headers:[*] Connection:[keep-alive] Content-Length:[568] Content-Type:[application/json;charset=utf-8] Date:[Tue, 23 Jan 2024 05:11:28 GMT] Keep-Alive:[timeout=25] X-Acs-Request-Id:[0254494A-FE5F-51C9-96DA-394123C37E13] X-Acs-Trace-Id:[740d51a284c42eb37e67556a9d62faa6]]
│ AccessDeniedDetail: map[AuthPrincipalDisplayName:205814005146961779 AuthPrincipalOwnerId:1889388625243280 AuthPrincipalType:SubUser EncodedDiagnosticMessage:AQEAAAAAZa9KgzAyNTQ0OTRBLUZFNUYtNTFDOS05NkRBLTM5NDEyM0MzN0UxMw==]
│
│   with alicloud_cs_managed_kubernetes.k8s,
│   on main.tf line 7, in resource "alicloud_cs_managed_kubernetes" "k8s":
│    7: resource "alicloud_cs_managed_kubernetes" "k8s" {

da0f1184cbd94abb94a798e05a9dbb8e.png623371129a834af5a4e48d8a7b527ed2.png

(2)原因分析

RAM缺少NATGatewayFullAcess权限

(3)解决方法

RAM添加NATGatewayFullAcess权限。

afcbd6005b6a443db00ca567061355ea.png

重新申请资源

7992822f61d4460199c79d9a99ff5aa8.png39f3413d72e54eb99d0334ac64675ca6.pngcf012b388bce488b8909f7d293995138.png

yes,先删除旧的实例

ecedb8b836304d689833664cbfa94c51.png

开始创建新实例

a2d3c9ba2bb648eca84c2cfcbf82953d.png

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/641950.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

火山引擎ByteHouse:“专用向量数据库”与“数据库+向量扩展”,怎么选?

更多技术交流、求职机会&#xff0c;欢迎关注字节跳动数据平台微信公众号&#xff0c;回复【1】进入官方交流群 背景 随着LLM&#xff08;Large Language Model&#xff09;的不断发展&#xff0c;向量检索也逐渐成为关注的焦点。LLM通过处理大量的文本数据&#xff0c;获取丰…

第1章-计算机网络基础

目录 1. 计算机网络与计算机 2. 计算机网络的定义和基本功能 2.1. 定义&#xff1a;计算机网络是一组自治计算机互连的集合 2.2. 基本功能 2.3. 计算机网络的演进 2.4. 广域网(Wide Area Network&#xff0c;WAN) 2.5. 网络的拓扑结构 2.6. 数据交换方式 2.7. 衡量计算…

图灵日记之java奇妙历险记--异常包装类泛型

目录 异常概念与体系结构异常的分类异常的处理防御式编程异常的抛出异常的捕获异常声明throwstry-catch捕获并处理 自定义异常类 包装类基本数据类型及其对应包装类装箱和拆箱 泛型泛型使用类型推导 裸类型说明 泛型的编译机制泛型的上界语法 异常概念与体系结构 在java中,将程…

VisualODX——ODX数据自动转换工具 加快开发进度

在创建ODX数据库的过程中&#xff0c;我们需要录入大量的数据以及应对多种数据格式。这不仅费时费力&#xff0c;而且还需很高的人力成本&#xff0c;且其错误率也非常高&#xff0c;从而导致开发速度缓慢、效率低下。基于多年的汽车行业诊断经验&#xff0c;我们开发了VisualO…

org.apache.rocketmq.remoting.exception.RemotingTooMuchRequestException

异常信息&#xff1a; org.apache.rocketmq.remoting.exception.RemotingTooMuchRequestException: sendDefaultImpl call timeout 开发环境描述&#xff1a; rocketMq 版本是 4.9.0&#xff0c;部署在服务器主机上&#xff0c; Broker 部署为单节点&#xff08;单机&#xff…

jdk的安装和Tomcat的安装

jdk的安装 双击jdk&#xff0c;然后一路下一步 公共JRE可以关闭&#xff0c;没多大用&#xff0c;反而会占用内存 计算机–>属性–>高级系统设置–>环境变量 系统变量–新建 JAVA_HOMEjdk的存放路径 修改path 在path的最后面添加&#xff08;&#xff1b;%JAVA_H…

Python算法题集_移动零

本文为Python算法题集之一的代码示例 题目283&#xff1a;移动零 说明&#xff1a;给定一个数组 nums&#xff0c;编写一个函数将所有 0 移动到数组的末尾&#xff0c;同时保持非零元素的相对顺序 注意 &#xff0c;必须在不复制数组的情况下原地对数组进行操作 本文给出四…

ChatGPT与生成式AI在教育领域的应用前景光明,但也伴随着挑战

随着ChatGPT和其他生成式AI技术&#xff0c;如GPT-3.5、GPT-4的出现&#xff0c;我们正见证教育领域一场前所未有的变革浪潮。这些技术不仅推动了教育方式的进步&#xff0c;也为学习者带来了全新的机遇和挑战。 NO.1 教育变革的新浪潮 生成式AI技术&#xff0c;特别是ChatGPT…

力扣每日一题 --- 972. 相等的有理数

本题中的一个难点是怎么判断是否相等&#xff0c;如果自己写判断的话是不是很麻烦&#xff0c;判断整数之后再去判断小数部分&#xff0c;那么我们这题的另一个难点就要登场了&#xff0c;第一个难点让本题的情况变得复杂&#xff0c;第二个难点让本题变得很难想到怎么判断&…

如何测试你的 Golang 代码

文章目录 简单概述最易想到的方法一个快速体验案例学会使用 go testing测试的编写规则灵活记忆 API 的使用 实践一个案例简洁紧凑的表组测试详细的日志输出灵活控制运行哪些测试总结参考 不论是开源项目&#xff0c;还是日常程序的开发&#xff0c;测试都是必不可少的一个环节。…

STM32-GPIO输出(HAL库)

STM32-GPIO 介绍 什么是GPIO&#xff1f; GPIO&#xff08;通用输入/输出&#xff09;是一种用于与外部设备进行数字通信的通用硬件接口。它允许微控制器或其他数字电路的引脚以灵活的方式配置为输入或输出&#xff0c;并在运行时进行动态控制。GPIO可用于连接和控制各种外围…

C# CefSharp 根据输入日期段自动选择日期

1&#xff0c;前言 搞这个Demo整整搞几天通宵&#xff0c;爆肝了。后做的效果出来&#xff0c;还是不错的。给小伙伴看看效果图。 2, 遇到的问题 日期之间相差多少个月数。开始时间框点击对应月份要点击多少次&#xff0c;结束时间框点击对应月份要点击多少次Xpath获取问题。…

使用NVIDIA TensorRT-LLM支持CodeFuse-CodeLlama-34B上的int4量化和推理优化实践

本文首发于 NVIDIA 一、概述 CodeFuse&#xff08;https://github.com/codefuse-ai&#xff09;是由蚂蚁集团开发的代码语言大模型&#xff0c;旨在支持整个软件开发生命周期&#xff0c;涵盖设计、需求、编码、测试、部署、运维等关键阶段。 为了在下游任务上获得更好的精…

MP4是什么文件格式?如何转换视频格式为MP4?

MP4文件格式&#xff0c;全称MPEG-4 Part 14&#xff0c;源自MPEG&#xff08;Moving Picture Experts Group&#xff09;对数字媒体压缩标准的不断迭代。其产生背景主要是为了适应数字娱乐时代对更高质量、更高效压缩的需求。MP4文件格式在视频、音频和字幕等多媒体元素的集成…

ps发现一张图片上我有些文字我希望扣出去

问: 上面这是在同一个图层中的,一张图片,但是我希望删除: 剩余__次抽奖这几个文字,怎么办? 回答: 选择 快速选择工具, 讲这几个字括起来, 右键选择删除后填充选区, 就实现了将这几个文字删除,

如何在一个集合对象中A排除另外一个集合对象B中A中拥有的数据通用思路,很精妙!

标题是什么意思呢&#xff1f; 假如我有一个集合对象A&#xff0c;数据有1,2,3,4,5,6 另外一个集合对象B&#xff0c;数据有2,4,5 那么在A中排除B拥有的数据就是 最终需要返回的结果就是1,3 那么我们一般一开始的想法其实就是在集合对象中A遍历取到每一个元素&#xff0c;然…

麒麟linux混血安装kali linux工具集合

因为日常要使用麒麟Linux办公&#xff0c;缺少常见的网络管理软件&#xff0c;尝试麒麟linux混血安装kali linux工具集合。 步骤1&#xff1a; 添加Kali的APT源&#xff1a; echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" | sudo tee…

【吃灰开发板复活】DIY全志V3s随身终端屏幕适配,LVGL以及各种外设驱动移植教程

在上周的文章中介绍了一款因作者想要学习Linux而动手DIY的终端设备V3S-PI&#xff0c; 《梦回2004&#xff01;我用全志V3s做了个成本100元&#xff0c;功能媲美MP4的随身终端》&#xff1a;梦回2004&#xff01;我用全志V3s做了个成本100元&#xff0c;功能媲美MP4的随身终端…

[设计模式Java实现附plantuml源码~创建型] 集中式工厂的实现~简单工厂模式

前言&#xff1a; 为什么之前写过Golang 版的设计模式&#xff0c;还在重新写Java 版&#xff1f; 答&#xff1a;因为对于我而言&#xff0c;当然也希望对正在学习的大伙有帮助。Java作为一门纯面向对象的语言&#xff0c;更适合用于学习设计模式。 为什么类图要附上uml 因为很…