投稿時間:2021-06-12 01:35:51 RSSフィード2021-06-12 01:00 分まとめ(39件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita NO.2 ウィンドウに取得した色を表示 https://qiita.com/otoboke162/items/4a4aa661f47f5a1a13b2 あとは順番ですkにがはいってピンクの枠がそれぞれ入りますforkxsysxeyexsysxeyeinenumeratezipxstartystartxendyendxstartystartxendyendforixyinenumerateframexyそしたら仮に下のBGRを取得したらBGR緑色一番上のcolorindexの水色の枠にはいります。 2021-06-12 00:46:01
js JavaScriptタグが付けられた新着投稿 - Qiita JavaScript 超初心者向け https://qiita.com/tataboo/items/a812880fd06f93dc6735 ltscriptgt 2021-06-12 01:00:13
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ディレクトリを維持したまま、カスタム投稿の記事を「投稿」へ移管したい https://teratail.com/questions/343556?rss=all ディレクトリを維持したまま、カスタム投稿の記事を「投稿」へ移管したい概要カスタム投稿newsにある記事を、投稿postへ移管したいです。 2021-06-12 00:46:31
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) C#でランダム問題出題のサンプルコードがほしい https://teratail.com/questions/343555?rss=all unity 2021-06-12 00:32:21
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) rails チュートリアル 1章 Bitbucketについて https://teratail.com/questions/343554?rss=all railsチュートリアル章Bitbucketについて前提・実現したいことrailsnbspチュートリアルを行なっていて、章の「Bitbucketへのリポジトリへのプッシュ」で以下のエラーメッセージが発生しました。 2021-06-12 00:25:37
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) [Unity]カメラがオブジェクトを貫通しないようにする方法 https://teratail.com/questions/343553?rss=all cinemachine 2021-06-12 00:23:16
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 横並びにした<ol><li>の高さを中央にした https://teratail.com/questions/343552?rss=all 横並びにしたltolgtltligtの高さを中央にした以下のように、高さを有するltdivgtの中にある横並びのltolgtltligtの高さを中央に寄せたいのですがうまく設定することができません。 2021-06-12 00:15:57
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Latexの長い数式のコマンドを表示させる方法 https://teratail.com/questions/343551?rss=all displaystylesumxnfracaxx 2021-06-12 00:10:54
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Firebase RealTimeDatabaseでchatアプリの未読数を取得したい https://teratail.com/questions/343550?rss=all FirebaseRealTimeDatabaseでchatアプリの未読数を取得したい前提・実現したいこといつも大変お世話になってます。 2021-06-12 00:06:15
Ruby Rubyタグが付けられた新着投稿 - Qiita Pagyのページネーションの件数をページごとに設定する https://qiita.com/morioka1206/items/65955662a7a60f7a3bef pagyの設定をそれぞれにするページネーションさせるのがひとつのページならいいのですが、ここは件ずつでとやりたい場合ができず、上記の例だと件ずつになってしまいます。 2021-06-12 00:14:31
Ruby Rubyタグが付けられた新着投稿 - Qiita ゼロ埋めの逆 Ruby https://qiita.com/dauuricus/items/38b1da798f1768da22de RubyはiRubyで書いていて、それ以前には全く興味がなかったのでRubyについては知らない、ゼロ知識から一ヶ月くらいたったのではないだろうか、というところにいる。 2021-06-12 00:06:38
AWS AWSタグが付けられた新着投稿 - Qiita AWS クライアントVPN 2要素認証 秘密鍵にパスワードを付加する https://qiita.com/quryu/items/6fcbaf65fcfd7e134acf クライアント証明書と秘密鍵を作成するとき、以下のようにドキュメントにあるnopassを消してコマンドを実行します。 2021-06-12 00:37:10
AWS AWSタグが付けられた新着投稿 - Qiita Amazon Linux環境でSupervisorを使ってLaravel Queueを動作させる方法 https://qiita.com/kimzzang/items/0f7369fc062a5e4b2f45 touchprojecthomestoragelogsworkerlogsupervisor設定ファイルの読み込み修正された設定ファイルを読み込ませるため、下記コマンドを実行します。 2021-06-12 00:24:46
Ruby Railsタグが付けられた新着投稿 - Qiita YouTubeチャンネルの動画を一覧表示したい https://qiita.com/hedgehog-genki/items/19fdd36989d0f7e9cfc6 これでサムネイルの画像にp要素を載せることができます。 2021-06-12 00:27:51
Ruby Railsタグが付けられた新着投稿 - Qiita Pagyのページネーションの件数をページごとに設定する https://qiita.com/morioka1206/items/65955662a7a60f7a3bef pagyの設定をそれぞれにするページネーションさせるのがひとつのページならいいのですが、ここは件ずつでとやりたい場合ができず、上記の例だと件ずつになってしまいます。 2021-06-12 00:14:31
海外TECH Ars Technica Google Chrome ends its war on address bar URLs—for now, at least https://arstechnica.com/?p=1772423 chrome 2021-06-11 15:33:36
海外TECH Ars Technica Tesla takes aim at upstarts with 390-mile range, 200 mph Model S Plaid https://arstechnica.com/?p=1772426 longest 2021-06-11 15:08:09
海外TECH DEV Community How to make teams more productive (WDS #3) https://dev.to/blaketweeted/how-to-make-teams-more-productive-wds-3-4aco How to make teams more productive WDS Disclaimer this is satire For fun on a Friday Web Dev Satire Everyone wants to be more productiveManagers might try to block off time to focus on coding or keep you out of meetings This is the worst way to have a productive team Here s an outline for any manager trying to squeeze some more code out of developers Outline More MeetingsI m not just talking about more meetings though that is part of it We want meetings with no clear goal and scattered no more than two hours apart This ensures that developers are hyper focused for that two hour gap The less clear the meeting is the better Developers are natural problem solvers Help them work out those muscles with practice Title your sessions vaguely Afternoon Debug or Productive Morning meeting Code fastThis is what we are after a short sweet code It makes sense that we need short sweet time to accomplish our goals Why write tests or dig into details of the code Developers don t make mistakes Switch Systems Slowly and oftenChange is good as long as it s drawn out If you re using Slack switch to Microsoft Teams Make sure you don t do this all at once It should be a month or two processes where developers need to respond to messages in both at any given time While doing this transfer other internal systems Shock and awe your developers with the amount of unnecessary change This is the ideal workday You make not like it but this is peak performance In case it isn t clear by now this is satire Happy Friday and keep coding 2021-06-11 15:35:54
海外TECH DEV Community How to Level Up Your React Conditionals https://dev.to/reedbarger/how-to-level-up-your-react-conditionals-4of6 How to Level Up Your React ConditionalsDo you write conditionals correctly within your React applications Good conditionals are an essential part of any React application We use conditionals to show or hide elements or components in our applications In short to be an effective React developer you must know how to write good conditionals Let s go over all of the major patterns you need to know to write clean concise conditionals plus what anti patterns you should avoid Want Your Own Copy ‬Download the cheatsheet in PDF format here it takes seconds Here are some quick wins from grabbing the downloadable version Quick reference guide to review however and whenever Tons of copyable code snippets for easy reuse Read this massive guide wherever suits you best On the train at your desk standing in line anywhere There s a ton of great stuff to cover so let s get started Use if statements primarily No need for else or else if Let s start with the most basic type of conditional in React If we have data we want to display it If not we want to show nothing Simple How would we write that Let s say we are fetching an array of posts data from an API When it is fetching the data posts has a value of undefined We can check for that value with a simple if statement export default function App const posts usePosts posts undefined at first if posts return null return lt div gt lt PostList posts posts gt lt div gt The reason this pattern works is that we are returning early If it meets the condition if posts is has a boolean value of true we display nothing in our component by returning null If statements also work when you have multiple conditions that you want to check for For example if you want to check for loading and error states before you display your data export default function App const isLoading isError posts usePosts if isLoading return lt div gt Loading lt div gt if isError return lt div gt Error lt div gt return lt div gt lt PostList posts posts gt lt div gt Notice that we can reuse the if statement and do not have to write if else or if else if which cuts down on the code that we have to write and is still just as readable Use the ternary operator to write conditionals in your JSXIf statements are great when we want to exit early and display nothing or a totally different component However what if we don t want to write a conditional separate from our returned JSX but directly within it In React we must include expressions something that resolves to a value not statements within our JSX This is why we must write conditionals in our JSX only with ternaries and not if statements For example if we wanted to display one nested component on a mobile sized screen and another on a larger screen a ternary would be a perfect choice function App const isMobile useWindowSize return lt main gt lt Header gt lt Sidebar gt isMobile lt MobileChat gt lt Chat gt lt main gt Most developers think this the only pattern they can leverage when it comes to using ternaries In fact you don t have to clutter your component tree by including all of these ternaries directly in your returned JSX Since ternaries resolve to a value remember that you can assign the result of a ternary to a variable which you can then use where you like function App const isMobile useWindowSize const ChatComponent isMobile lt MobileChat gt lt Chat gt return lt main gt lt Header gt lt Sidebar gt ChatComponent lt main gt No else condition Use the amp amp and operatorIn many cases you will want to use a ternary in your JSX but will realize that if that condition is not met you don t want to display anything This ternary would look like the following condition lt Component gt null If you don t have an else condition use the amp amp operator export default function PostFeed const posts hasFinished usePosts return lt gt lt PostList posts posts gt hasFinished amp amp lt p gt You have reached the end lt p gt lt gt Switch statements for multiple conditionsWhat if we are in a situation where have many different conditions more than just one or two We could certainly write multiple if statements but all of these if statements as we ve seen earlier go above our returned JSX Too many if statements can clutter our components How do we make our code cleaner We can often extract multiple conditions to a separate component which contains a switch statement For example we have a Menu component that we can toggle and display different tabs We have tabs that can display user chat and room data as you see below export default function Menu const menu setMenu React useState function toggleMenu setMenu m gt if m return return m return lt gt lt MenuItem menu menu gt lt button onClick toggleMenu gt Toggle Menu lt button gt lt gt function MenuItem menu switch menu case return lt Users gt case return lt Chats gt case return lt Rooms gt default return null Since we are using a dedicated MenuItem component with a switch statement our parent Menu component is not cluttered by conditional logic and we can easily see what component will be displayed given the menu state Want conditionals as components Try JSX Control StatementsIt s greatly beneficial to be able to use plain JavaScript within our React components But if you want even more declarative and straightforward conditionals check out the React library JSX control statements You can bring it into your React projects by running the following command npm install save dev babel plugin jsx control statementsAdditionally you can list it in your babelrc file like so plugins jsx control statements This is a Babel plugin that allows you to use React components directly within your JSX to write very easy to understand conditionals The best way to understand the use of such a library is by taking a look at an example Let s rewrite one of our previous examples with the help of JSX control statements export default function App const isLoading isError posts usePosts return lt Choose gt lt When condition isLoading gt lt div gt Loading lt div gt lt When gt lt When condition isError gt lt div gt Error lt div gt lt When gt lt Otherwise gt lt PostList posts posts gt lt Otherwise gt lt Choose gt You can see that there s no if or ternary statement in sight and we have a very readable component structure Give JSX control statements a try in your next React project and see if a library like this is for you What s NextI hope this guide gave you some helpful patterns to write great React conditionals If you want a copy of this cheatsheet to keep for learning purposes you can download a complete PDF version of this cheatsheet here Also check out these ultimate resources made to take your React skills to the next level including React for beginners The complete guide How to fetch data in React from front to back How to build fullstack apps in React with Node 2021-06-11 15:23:16
海外TECH DEV Community Contributing To Open Source - Getting Started https://dev.to/vickykoblinski/contributing-to-open-source-getting-started-2o19 Contributing To Open Source Getting StartedContributing to open source projects can be very fulfilling but getting started may be intimidating and confusing Most large open source projects have steep learning curves which can be off putting for the first time contributor However there are a lot of opportunities to get started and thrive even if you ve never contributed to an open source project before  Open source is incredibly valuable Where would the Linux kernel be without the developers and companies that have contributed since And what of the thousands of projects built on its back These days every project you start is built using packages and building blocks from those who came before you You can stand on the shoulders of giants The wheel has already been invented and it s more reliable and battle tested than anything you could build in house Open source software has been essential for developers companies and ideally consumers However there would be no giants no blocks no wheels without communities contributors and passionate people to drive these projects forward These are ordinary people doing extraordinary things  Although the main objective of open source is to create accessible and valuable software for everyone to build off of contributors can find a plethora of personal benefits from contributing You will sharpen your technical skills nurture your interpersonal communication skills and practice giving and receiving feedback   The CultureOkay so you ve decided you want to become a contributor but you re not convinced that you ve got what it takes You re feeling quite intimidated actually That s okay You ve never done this before Every contributor has had a first contribution and open source projects tend to culture empathy patience and understanding In my experience successful open source projects have maintainers and communities that are the friendliest on the planet They are excited and enthusiastic about someone wanting to contribute Often they ll be active on Twitter Slack Discord and or another platform that you can join and speak directly with the maintainers and other contributors Many large open source communities even have their own community guidelines that boil down to “Don t be a jerk These communities welcome new contributors with open arms Finding the Right FitOne of the best ways to find an open source project to work on is to look to open source software that you already use Tools packages frameworks or languages that you work with regularly and enjoy using could be great candidates To find out if the project is open source check its license and if it accepts contributions It s also important to check that the project is actively maintained Are the pull requests sitting dormant or are the maintainers providing feedback Are the issues getting acknowledged or are they sitting there stale If that approach doesn t work for you try using GitHub to explore I recommend starting your contribution journey with languages and frameworks that you re familiar with It ll be difficult enough to get up to speed on the codebase but if you re already familiar with a framework s best practices and typical layout you ll have a more successful time hitting the ground running GitHub has excellent search capabilities to find open source projects that are actively seeking out new contributors By searching for the right tags and filtering by languages you know best you can quickly find new issues that beg for assistance Some great tags to search for are contributions welcomegood first issuehacktoberfest beginner friendly good first bugeasylow hanging fruitfirst timers onlyGitHub also suggests projects you may like based on the people and repositories that you have starred follow or watch   Your First ContributionOnce you find an issue that you feel confident in tackling in an active project that has a culture you feel comfortable in it s time to get your hands dirty The first thing you will want to do is to “claim the ticket It s a bad idea to run off and solve the problem without communicating your intentions to the maintainers Instead reply to the ticket in question by volunteering yourself for the task This allows the maintainers and other contributors to know this ticket is being actively worked on and the maintainers may have requests suggestions or guidance to help solve the problem Start small Pick tickets that are easy and have the smallest contribution and code changes when you first start Not only will this enable you to slowly get familiar with the codebase but it will also build your confidence and credibility before you try taking on harder tasks  After you have picked up a ticket and think you have finished it do your research before you open your first pull request Carefully read the documentation code and discussions related to this ticket to get the best understanding of how to handle the problem If you re stuck reach out to the community and ask for guidance clarification or mentorship  Once you feel confident that you ve solved the problem it s time to submit a PR Look in the project for a CONTRIBUTORS md file most open source projects on GitHub will likely have this within their project This file will contain instructions on how this project would like PRs to be submitted by contributors They may request strict branch naming conventions PR titles documentation or tests comments or other things in pull requests GitHub also has a great checklist on what to check for before you open your pull request  Create the PR and follow the PR template if the project has one Be sure to link back to the original ticket The maintainer may request changes or want to have a discussion about your changes It s normal to have a back and forth before a PR is accepted Work with the maintainer until your PR is ready to be accepted Once your PR passes the maintainer s review they will merge your code in  Congratulations You re an open source contributor Are You An Open Source Project Maintainer Release Wants To Support You Open source projects benefit dramatically from Ephemeral Environments on every pull request We love open source and are dedicated to giving back Contact us to find out how we can help fuel your rocket through preview environments and help put confidence in contributor s PRs 2021-06-11 15:18:47
海外TECH DEV Community Button Animation Using HTML CSS & JS https://dev.to/nikhil27b/button-animation-using-html-css-js-1824 Button Animation Using HTML CSS amp JSHello Guys Today I created a Amazing Button Loading Animation with HTML amp JS This is simple Loading Button Animation using JavaScript after a button click I added setTimeout Function to removed the loader class If you find this useful in a post like and save this post also comments about your thoughts For more content follow me on Instagram developer nikhil Thank you 2021-06-11 15:16:51
海外TECH DEV Community Creating an API that runs Selenium via AWS Lambda https://dev.to/awscommunity-asean/creating-an-api-that-runs-selenium-via-aws-lambda-3ck3 Creating an API that runs Selenium via AWS LambdaBeing an automation tester my job is to automate everything As I was running my test script via terminal I realised that I m the only who can execute the scripts I made What if someone wants to run it like the Devs Project Manager etc It would be a tedious task to clone my repo install libraries and run the script So I decided that maybe I can store my test script inside a serverless machine and make it accessible via API request I experimented with various AWS resources such as creating my own lambda function checking features of API gateway Codepipeline etc After several attempts I was finally able to run my script inside And then I just researched how to access my lambda via API This will result in higher production and time savings Engineers may focus on vital work because automated testing does not require human interaction This is like a portable testing device that anyone could execute With fast test execution developers get testing reports in an instant so whenever a failure occurs they will react to it quickly  Test automation will make it easier to update programs quickly As a result automated testing leads to increased team responsiveness improved user experience and increased customer satisfaction OverviewCreate Lambda layers that has selenium and chromedriver librariesInclude created lambda layers in serverless yml of lambda then deploy Creating Selenium Lambda LayerPlace libraries in python lib python site packages to include them in a layer Download Selenium to layer directory  pip install t selenium python lib python site packages selenium  cd selenium  zip r python zip python Once finished Create lambda layer then upload zip file  Go to AWS Console Lambda Layers  Click Create Layer  Input the following in the layer configurationName  seleniumDescription  Selenium layerUpload zip file created python zipCompatible runtimes Python  Click Create  Creating Chromedriver Lambda layerDownload chrome driver  mkdir p chromedriver  cd chromedriver  curl SL   gt  chromedriver zip  unzip chromedriver zip  rm chromedriver zipDownload chrome binary  curl SL   gt  headless chromium zip  unzip headless chromium zip  rm headless chromium zipCompress driver and binary  lschromedriver headless chromium  zip r chromedriver zip chromedriver headless chromiumOnce finished Create lambda layer then upload zip file  Go to AWS Console Lambda Layers  Click Create Layer  Input the following in the layer configurationName  chromedriverDescription  chrome driver and binary layerUpload zip file created chromedriver zipCompatible runtimes Python  Click Create  Creating Lambda FunctionTo ensure that your function code has access to libraries included in layers Lambda runtimes include paths in the opt directory  File Structureー  lambda         lambda function ├ー handler py      source code of lambda function  └ー serverless yaml  serverless config  CodeCopy the code below to lambda handler pyfrom selenium import webdriverfrom selenium webdriver chrome options import Optionsdef main event context options Options options binary location opt headless chromium options add argument headless options add argument no sandbox options add argument single process options add argument disable dev shm usage driver webdriver Chrome opt chromedriver chrome options options driver get driver close driver quit response statusCode body Selenium Headless Chrome Initialized return responseCopy the code below to lambda serverless yaml service selenium lambdaprovider name aws runtime python region ap southeast timeout functions main memorySize handler handler main events http path test method get layers arn aws lambda ap southeast layer chromedriver arn aws lambda ap southeast layer selenium resources Resources ApiGatewayRestApi Properties BinaryMediaTypes  Deploy Lambda FunctionGo to lambda directory  sls deploy  OutputServerless  Stack update finished Service Informationservice  selenium lambdastage  devregion  ap southeast stack  selenium lambda devapi keys  Noneendpoints  GET https name execute api ap southeast amazonaws com dev testfunctions  main selenium lambda dev mainYou should get same response as below when accessing API statusCode   body   Selenium Headless Chrome Initialized This deployment automatically creates cloudformation stack and s bucket 2021-06-11 15:06:37
海外TECH DEV Community Helm Charts Testing https://dev.to/chiragdm/helm-charts-testing-4de2 Helm Charts TestingTools to use for Helm Chart Testing during Development to Release IntroductionHelm Chart is a package management software to write Kubernetes templates and package it as a chart with all its dependencies A single chart can be used to deploy nginx memcache or any full stack web application You can deploy any application chart just by running the following command helm install my release bitnami nginx ScopeThis article does not cover detailed information about Helm Chart development instead Helm chart has very good documentation which you can go through to learn more about it I am going to cover how to test helm charts as part of development and what different types of testing tools can be used to test charts from unit tests to integration tests Helm Chart Development ーNot a pleasant ExperienceHelm Chart is written in go templates and writing those templates to render Kubernetes manifests is a painful experience There is no good debugger support available and errors are clueless so sometimes you need to spend hours to fix minor indentation related issues Helm provides a debug flag while rendering templates though it does not pinpoint the exact line where the error is in the code so it s difficult to find issues I hope to have better tools available in the future for helm chart development to make developers lives easy Photo by Ryan Snaadt on Unsplash Are your chart templates correct As mentioned earlier Helm Chart templates use go templates so as part of development you need to be sure of syntactical errors so you don t get last minute surprises when you release your chart Helm provides a lint command which finds and reports all these issues related to templates so you can execute this command frequently to find compile time errors as part of your development Here is a helm chart deployment template with errors Helm lint will report the following issues which were expected ➜mychart helm lint gt Linting INFO Chart yaml icon is recommended ERROR templates parse error at mychart templates deployment yaml function “Values not defined ERROR templates template mychart templates deployment yaml executing “mychart templates deployment yaml at lt include “namespace gt error calling include template no template “namespace associated with template “gotpl Error chart s linted chart s failedI know this is a very simple example but good enough for understating how lint works Validate against Kubernetes ManifestsHelm template is the command you can use to render generate Kubernetes manifests templates out of your helm chart templates There is a command Helm install to install deploy charts to Kubernetes cluster Internally It first executes helm template command and then deploys generated template output to the cluster helm template gt deployment yaml Are your Kubernetes Manifests Valid If you make mistakes while developing a chart then it might be possible that the generated Kubernetes Manifests generate errors when applied to the Kubernetes cluster but I want to know about those errors before deployment Kubeval is the tool to rescue It s a tool to validate your generated manifests against official Kubernetes specification and reports issues if any Can you spot any issue in this Deployment template Run kubeval against this deployment manifest and look at the issues ➜mychart kubeval deployment yamlWARN ーmychart templates deployment yaml contains an invalid Deployment myservice nginx deployment ーselector selector is requiredWARN ーmychart templates deployment yaml contains an invalid Deployment myservice nginx deployment ーcontainerPort containerPort is requiredWARN ーmychart templates deployment yaml contains an invalid Deployment myservice nginx deployment ーspec replicas Invalid type Expected integer null given string This is the output if it was valid deployment PASS ーmychart templates deployment yaml contains a valid Deployment myservice nginx deployment Additionally you can specify Kubernetes version against which you want to validate generated templates using option “ーkubernetes version v Custom Validations against Kubernetes ManifestsLet s say I have the following simple requirements Containers should not run as root Docker images should come from my org repository You can address this by implementing an admission controller in Kubernetes when resources get deployed to the cluster but would it not be nice if we can apply this custom validation before deployment Conftest is a framework which allows you to write rules using OPA policies and run it against the Kubernetes manifests Run these custom rules against deployment manifests using conftest which will report issues based on configured rules ➜mychart conftest test ーpolicy deployment yamlFAIL ーdeployment yaml ーmain ーContainers must not run as rootFAIL ーdeployment yaml ーmain ーimage nginx doesn t come from myorg com repository tests passed warnings failures exceptionsYou can write any custom policies for all your resources which you can execute against Kubernetes manifests before deployment That s Pretty Cool Schema Validations for Custom ValuesAs I explained you can verify Kubernetes manifests using Kubeval and Conftest tools but when you are creating a helm chart then you need to allow your users who are using the chart to add some custom values for any new feature you need to validate that those custom values are in correct format to be consumed by the chart otherwise it will fail chart rendering which is a very difficult task to debug how can we apply the first level of defense to make sure provided custom values are in correct format otherwise error it out with proper validation message Helm Chart provides Schema Validation feature for which you need to provide a schema file in a chart containing rules for all your custom values It validates this schema validation first before executing any of these commands helm linthelm templatehelm installhelm upgradeThese are a few of the use cases using custom values Users should be able to specify memory and cpu requirements Some users want to specify different log locations for application logs Users want to supply environment variables for the application container Let s implement the first use case where if the user specifies custom values for memory and cpu then it will take it otherwise set default values Here is values schema json file to validate against custom values This is custom values yaml which users can provide while consuming the chart As the user has provided wrong custom values it should fail ➜mychart helm template f custom values yamlError values don t meet the specifications of the schema s in the following chart s mychart memory Does not match pattern M G i cpu Does not match pattern m You can do any type of validation as long as it s supported by json schema specifications though the only condition is you should have all json schema rules available in file named values schema json in your chart Unit TestingLike any other programming language Unit tests are the first which developers should consider in the early stage of development I see a scarcity of good unit testing frameworks available for Helm Charts There is a unit test framework helm unittest It is a very nice framework for unit testing and lots of active deployment is going on so one should definitely go for it There is another hacky way of testing Helm charts which is a mix of unit tests and regression tests Idea is very simple you need to add a binding file containing custom values for each new feature you are implementing in helm chart and generate fixture file out of it using helm template command You need to commit binding and it s fixture file in the repository Now create a simple shell script to be executed in CI which will create a fixture file out of a binding file on the fly against your changes in chart and compare it with existing fixture file you just fail the test if there is difference in fixture files then you need to either fix your helm chart or update the existing fixture file if it s expected behavior Testing using fixtures is very helpful in code refactoring and also can be considered for unit tests while writing new features Integration Tests using KubetestTill now we have tested helm chart templates and Kubernetes manifests using different tools but we did not verify anything by actually deploying Kubernetes manifests in the Kubernetes cluster Why do we need integration tests I have mentioned a few of the use cases which can only be verified by deploying resources in a cluster I have mounted the volume as writable which I want to verify by creating a file in volume There are some custom resources which I want to verify I want to verify the health check of the internal load balancer created as part of Kubernetes service creation There are many tools available but I really liked Kubetest which is a pytest plugin Kubetest makes it easy to write integration tests by providing abstraction on top of Kubernetes client It provides many helper functions so you don t need to write complex code using Kubernetes client unless it s absolutely necessary It s very intuitive and fun to write integration tests using Kubetest I was tempted to skip not putting any example code here because it is self explanatory once you look at this example code SummaryI have covered the basics about helm charts various tools we can use for different types of testing including unit test and integration tests during the lifecycle from development to releasing the helm charts Don t miss out to look at my github I have used as an example through out the article if anything is not clear Hope you enjoyed it Cheers References schema files 2021-06-11 15:04:33
海外科学 NYT > Science Glacier Blood? Watermelon Snow? Whatever It’s Called, Snow Shouldn’t Be So Red. https://www.nytimes.com/2021/06/11/science/watermelon-snow-algae-glacier-blood.html Glacier Blood Watermelon Snow Whatever It s Called Snow Shouldn t Be So Red Researchers are starting to investigate the species that drive alpine algal blooms to better understand their causes and effects 2021-06-11 15:30:46
金融 RSS FILE - 日本証券業協会 インターネット取引に関する調査結果について https://www.jsda.or.jp/shiryoshitsu/toukei/interan.html 調査結果 2021-06-11 16:00:00
金融 金融庁ホームページ 「違法な金融業者に関する情報について」を更新しました。 https://www.fsa.go.jp/ordinary/chuui/index.html Detail Nothing 2021-06-11 17:00:00
金融 金融庁ホームページ 金融審議会「市場制度ワーキング・グループ」(第9回)議事録を公表しました。 https://www.fsa.go.jp/singi/singi_kinyu/market-system/gijiroku/20210514.html 金融審議会 2021-06-11 17:00:00
金融 金融庁ホームページ 「政府機関・地方公共団体等における業務でのLINE利用状況調査を踏まえた今後のLINEサービス等の利用の際の考え方(ガイドライン)」の一部改正について公表しました。 https://www.fsa.go.jp/news/r2/sonota/20210611/20210611.html 地方公共団体 2021-06-11 17:00:00
金融 金融庁ホームページ 「立入検査の基本的手続」の一部改正(案)に対するパブリックコメントの結果等について公表しました。 https://www.fsa.go.jp/news/r2/ginkou/20210611/20210611.html 立入検査 2021-06-11 16:00:00
金融 金融庁ホームページ 「投資家と企業の対話ガイドライン」(改訂版)の確定について公表しました。 https://www.fsa.go.jp/news/r2/singi/20210611-1.html 確定 2021-06-11 15:30:00
ニュース BBC News - Home G7: Boris Johnson kicks off summit with plea to tackle inequality https://www.bbc.co.uk/news/uk-politics-57445184 coronavirus 2021-06-11 15:08:29
ニュース BBC News - Home Delay 21 June lockdown lifting, urge health leaders https://www.bbc.co.uk/news/uk-57438745 delay 2021-06-11 15:32:05
ニュース BBC News - Home Andrew Dymock: Neo-Nazi guilty of terrorism charges https://www.bbc.co.uk/news/uk-england-somerset-57439480 andrew 2021-06-11 15:35:41
ニュース BBC News - Home G7 summit: Officer staying on ferry tests positive for Covid https://www.bbc.co.uk/news/uk-england-cornwall-57445893 lateral 2021-06-11 15:05:40
ニュース BBC News - Home In Pictures: G7 leaders meet at the seaside https://www.bbc.co.uk/news/uk-57438878 occasional 2021-06-11 15:11:35
ニュース BBC News - Home Fact-checking Matt Hancock's Covid claims https://www.bbc.co.uk/news/57427777 government 2021-06-11 15:33:29
ニュース BBC News - Home PM gifts photo of Edinburgh anti-slavery mural to Biden https://www.bbc.co.uk/news/uk-scotland-edinburgh-east-fife-57441825 douglass 2021-06-11 15:18:58
北海道 北海道新聞 G7、ワクチン10億回分供給へ 英サミット開幕、2年ぶり https://www.hokkaido-np.co.jp/article/554673/ 首脳会議 2021-06-12 00:08:00
北海道 北海道新聞 道の大規模接種 14日からネット予約 不慣れな高齢者も https://www.hokkaido-np.co.jp/article/554648/ 高齢者 2021-06-12 00:01:50

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)