是否有使用 kubectl 从 Kubernetes 配置映射中删除特定键的好方法?
现在我运行:
$ kubectl edit configmap myconfigmap
Run Code Online (Sandbox Code Playgroud)
然后我删除了该条目,但我想要一个可以作为脚本运行的解决方案。
这是我目前用于将文件从谷歌驱动器读入谷歌应用引擎的blobstore的代码.
private BlobKey getBlobKey(File f, DriveObject driveObject)
throws IOException, MalformedURLException {
Drive service = ((GoogleDrive) driveObject).getService();
byte[] buffer = new byte[(int) f.getFileSize().intValue()];
GenericUrl url = new GenericUrl(f.getDownloadUrl());
HttpResponse response = service.getRequestFactory()
.buildGetRequest(url).execute();
InputStream is = response.getContent();
FileService fileService = FileServiceFactory.getFileService();
AppEngineFile file = null;
boolean lock = true;
try {
file = fileService.createNewBlobFile("application/zip");
FileWriteChannel writeChannel = fileService.openWriteChannel(
file, lock);
int len;
while ((len = is.read(buffer)) >= 0) {
ByteBuffer bb = ByteBuffer.wrap(buffer, 0, len);
writeChannel.write(bb);
}
writeChannel.closeFinally();
} catch (IOException …Run Code Online (Sandbox Code Playgroud) 我创建了一个 docker 镜像,其中包含一个 rust 应用程序,该应用程序响应端口 8000 上的获取请求。应用程序本身是一个使用火箭库 ( https://rocket.rs/ )的基本示例,它看起来像这样
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
}
fn main() {
rocket::ignite().mount("/", routes![index]).launch();
}
Run Code Online (Sandbox Code Playgroud)
我已经编译了这个并称之为 server
然后我创建了一个 Docker 文件来托管它
FROM ubuntu:16.04
RUN apt-get update; apt-get install -y curl
COPY server /root/
EXPOSE 8000
CMD ["/root/server"]
Run Code Online (Sandbox Code Playgroud)
我构建 docker 镜像
$ docker build -t port_test并运行它$ docker run -p 8000:8000 port_test
在这一点上,一切看起来都不错
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用Drive API调用,而我正在尝试列出我的文件.
到目前为止,我的函数看起来像这样:
var retrieveAllFiles = function () {
var retrievePageOfFiles = function(request, result) {
request.execute(function(resp) {
console.log(resp);
result = result.concat(resp.items);
var nextPageToken = resp.nextPageToken;
console.log("nextPageToken ="+nextPageToken);
if (nextPageToken) {
request = gapi.client.drive.files.list({'pageToken': nextPageToken});
retrievePageOfFiles(request, result);
} else {
printFileList(result);
}
});
}
var initialRequest = gapi.client.drive.files.list({'maxResults': 10});
console.log("initialRequest = "+initialRequest);
retrievePageOfFiles(initialRequest, []);
}
Run Code Online (Sandbox Code Playgroud)
在firebug中,我看到响应看起来像这样:
[
{
"id": "gapiRpc",
"result": {
"kind": "drive#fileList",
"etag": "\"vGmlhiWxP02tugPmRvLynwC_A0Y/vyGp6PvFo4RvsFtPoIWeCReyIC8\""
}
}
]
Run Code Online (Sandbox Code Playgroud)
这不是我所期望的,因为我的驱动器包含两个文件.
谁能指出我的错误是什么?
谢谢
我有一个 bash 脚本,它接受一个参数并返回大约 8-10 行文本。
我希望能够从 vim 中调用这个脚本。理想情况下,通过突出显示字符串作为参数。然后我希望脚本的输出显示在新窗格中。
我是 vim 新手,所以我不确定这是否可以简单地通过在我的 vimrc 文件中创建命令来完成,或者是否需要创建一个插件。
任何建议将不胜感激。
经过一番谷歌搜索后我想出了
function! Foo(a1)
new
r !myscript a:a1
endfunction
Run Code Online (Sandbox Code Playgroud)
这还不太行得通。它似乎传递名称 a:a1 而不是值。
bash ×1
blobstore ×1
configmap ×1
curl ×1
docker ×1
java ×1
javascript ×1
kubectl ×1
kubernetes ×1
networking ×1
plugins ×1
rust ×1
rust-rocket ×1
vim ×1