Flux2 Image Reflector Controller not able to find a match on my image tags - fluxcd

I'm working with Flux2. I'm new to Flux and I'm trying to set up the Image Reflector controller to find the last image tag in my image registry but I'm getting an error on my image policy 'unable to determine latest version from provided list'
In my registry I have the following tags:
16
rc-9.20.7975.18473
Flux is reporting that it's connecting to my image registry and says 'successful scan, found 2 tags'. Based on my image policy below I was expecting only 1 tag to match.
Here is my Image Policy:
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImagePolicy
metadata:
name: xxxxxxxx
spec:
imageRepositoryRef:
name: xxxxxxxx
filterTags:
pattern: '^rc-(?P<ts>.*)'
extract: '$ts'
policy:
semver:
range: '^9.20.x.x'
I would like to it update on new 'rc' images. Any thoughts on why the Image Reflector is saying it found 2 tags when '16' isn't a match by the filter pattern? What should I change in my Image Policy to determine the latest version? Thx!

Your range is not correct. It should be '>=9.20.0.0'. For more details check https://fluxcd.io/flux/components/image/imagepolicies/

Related

Adding a note to Request sample in OpenAPI

Is it possible to add a note to the field where the Request Samples show on Swagger UI?
My API is described in the following way:
/v1/test:
post:
summary:test
tags:
- test
description: test
parameters:
- in: body
name: body
required: false
schema:
$ref: '#/definitions/test'
x-code-samples:
- lang: cURL
source: >-
When the yaml is rendered by our UI program, the Request sample is shown like this:
sample request
Is it possible to add a note someplace marked in red on the image?
I have tried adding x-description and x-summary, but that doesn't work.
I wonder if this is possible at all.
Thank you

kubernetes operator, how to hide property value in describe

I am writing a k8s operator. In my CR file, I want to get password and store it in secret.
Everything works fine except this password gets printed on the screen when I describe my object kubectl describe myKind myObject is there any way to hide particular property from spec or at least show *** instead of actual value? just like secret it just shows bytes and not actual value.
Added line before my property // +kubebuilder:validation:Format=password. this add format: password in CRD file but when I describe myObject it still prints all Spec values on the console.
Edit: SO putting more light on this:
my **_types.go snipplet is:
// DB username
DbUser string `json:"dbUser,required"`
// DB password
// +kubebuilder:validation:Format=password
DbPassword string `json:"dbPassword,required"`
so I am making k8s secret out of dbUser and dbPassword
I have another option to ask users to create a secret as pre-req but I am not happy with that approach.
Thanks in advance.
You should NOT store passwords / tokens etc. in plain text in the CR. It will be visible to anyone with permissions to read the CR (no matter if k describe shows it or not).
I would recommend changing the CRD spec so users can reference their secret by name. Users will need to create a secret of type opaque then create a CR that looks something like this:
apiVersion: "grp/v1"
kind: "mykind"
metadata:
name: "my-kind-cr"
namespace: "default"
spec:
secretName: mysecret
where the secret would look like this:
apiVersion: v1
kind: Secret
metadata:
name: dbpassword
namespace: default
type: Opaque
stringData:
dbPassword: "my password"

Request body does not show up in curl example with OpenApi3 + widdershins + shins

I am generating API documentation for our Java endpoints. I am using widdershins to convert our openAPI3.0 yaml file to markdown. Then, I am using shins to convert the markdown file to html. The request body for all of our endpoints does not appear in the generated cURL examples. Why is this? This defeats the purpose of having cURL examples because copying and pasting a cURL example without the required body will not work. Can anyone recommend a workaround or alternative tool that generates good documentation with complete cURL examples?
Example endpoint from our openAPI.yaml file...
post:
tags:
- Tools
description: Installs a tool on a user's account
operationId: Install Tool
requestBody:
description: UserTool object that needs to be installed on the user's account
content:
application/json:
schema:
$ref: '#/components/schemas/UserTool'
required: true
parameters:
responses:
default:
description: default response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
This is the documentation our toolchain generates from this yaml file...
We would like to add a line just like the one below (grey highlight) to our cURL examples. This is a chunk from the markdown file that Widdershins produces from our openAPI yaml file. I manually added the –“d
This stack overflow Q/A suggests the answer is it is impossible to include a body parameter in a code example using swagger or openAPI. Is this correct? If so, why is this the case? What's the reasoning?
Cheers,
Gideon
I also had the same problem.
As a result of trial and error, it was found that the behavior displayed on curl varies depending on the in value.
Please look at the ParameterIn enum.
public enum ParameterIn {
DEFAULT(""),
HEADER("header"),
QUERY("query"),
PATH("path"),
COOKIE("cookie");
I tried by like below at first time:
new Parameter().name("foo").in(ParameterIn.HEADER.name())
But name return like "HEADER", So swagger(or OpenAPI) recognized to header.
It should be lower character like "header" follow ParameterIn enum.
So, you can fix it like this
new Parameter().name("foo").in(ParameterIn.HEADER.toString())
or
new Parameter().name("foo").in("header")
I also encountered the same problem and I did a little digging. It turns out I had to set options.httpSnippet option in widdershins to true so that the requestBody params will show up. However, setting that to true just shows the params if content type is of application/json. For multipart-form-data, you need to set options.experimental to true as well.
Unfortunately, there is a bug in widdershins for handling application/x-www-form-urlencoded content-type.. I created a PR for it which you can probably manually patch on the widdershins package. PR link: https://github.com/Mermade/widdershins/pull/492/files

GitLab API: how to create a merge request note with a position?

I can successfully create "general" merge request notes using following API:
POST /projects/:id/merge_requests/:merge_request_iid/notes
However, when trying to add a position object to the POST request, it will be ignored. For my experiments, I've tried to use exactly the same position object as it's reported when querying merge request information:
type: "DiffNote"
body: "+6x1"
position:
base_sha: "b1f8788c186e0120ccae93797cd280fa28a0ef3c"
start_sha: "b1f8788c186e0120ccae93797cd280fa28a0ef3c"
head_sha: "27ce170fcd248f980679f8ffd104c9b600141db1"
old_path: "file1.txt"
new_path: "file1.txt"
position_type: "text"
old_line: null
new_line: 5

How can I hotlink/embed a Twitpic image?

So in this URL: http://twitpic.com/2paihn
The Twitpic ID is: 2paihn
And the actual image URL is:
http://s3.amazonaws.com/twitpic/photos/large/163413275.jpg?AWSAccessKeyId=0ZRYP5X5F6FSMBCCSE82&Expires=1284740401&Signature=6lgT6ruyyUDDjLOB7d42XABoCLU%3D
I've tried getting the integer id through the api (i.e. 163413275) and replacing it in the s3.amazon.com url, but this seems to only work some of the time. Most of the time I get an 'access denied' message when I request the amazon-hosted image.
Do you know of another hack to do this?
This is the direct link to the image:
http://twitpic.com/show/full/2paihn
You can use it in an img tag or link it. It will forward to the amazon S3 url with a new expiration date and signature so whoever you're showing it to won't get the access denied message.
Source: http://dev.twitpic.com/docs/thumbnails/
Use http://twitpic.com/show/thumb/<imageid> to get a thumbnail version.