Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
581a24da7e
commit
14f554f0e9
8 changed files with 44 additions and 15 deletions
|
@ -62,8 +62,8 @@ export default {
|
|||
];
|
||||
},
|
||||
learnMoreUrl() {
|
||||
return helpPagePath('user/clusters/agent/index.md', {
|
||||
anchor: 'create-an-agent-record-in-gitlab',
|
||||
return helpPagePath('user/clusters/agent/install/index', {
|
||||
anchor: 'register-an-agent-with-gitlab',
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -47,7 +47,7 @@ export default {
|
|||
enableKasPath: helpPagePath('administration/clusters/kas'),
|
||||
installAgentPath: helpPagePath('user/clusters/agent/install/index'),
|
||||
registerAgentPath: helpPagePath('user/clusters/agent/install/index', {
|
||||
anchor: 'create-an-agent-record-in-gitlab',
|
||||
anchor: 'register-an-agent-with-gitlab',
|
||||
}),
|
||||
components: {
|
||||
AvailableAgentsDropdown,
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
import Vue from 'vue';
|
||||
import Cookies from 'js-cookie';
|
||||
import { parseBoolean } from '~/lib/utils/common_utils';
|
||||
import DismissibleAlert from '~/vue_shared/components/dismissible_alert.vue';
|
||||
|
||||
const getCookieExpirationPeriod = (expirationPeriod) => {
|
||||
const defaultExpirationPeriod = 30;
|
||||
const alertExpirationPeriod = Number(expirationPeriod);
|
||||
|
||||
return !expirationPeriod || Number.isNaN(alertExpirationPeriod)
|
||||
? defaultExpirationPeriod
|
||||
: alertExpirationPeriod;
|
||||
};
|
||||
|
||||
const mountVueAlert = (el) => {
|
||||
const props = {
|
||||
html: el.innerHTML,
|
||||
|
@ -10,11 +20,25 @@ const mountVueAlert = (el) => {
|
|||
...el.dataset,
|
||||
dismissible: parseBoolean(el.dataset.dismissible),
|
||||
};
|
||||
const { dismissCookieName, dismissCookieExpire } = el.dataset;
|
||||
|
||||
return new Vue({
|
||||
el,
|
||||
render(h) {
|
||||
return h(DismissibleAlert, { props, attrs });
|
||||
render(createElement) {
|
||||
return createElement(DismissibleAlert, {
|
||||
props,
|
||||
attrs,
|
||||
on: {
|
||||
alertDismissed() {
|
||||
if (!dismissCookieName) {
|
||||
return;
|
||||
}
|
||||
Cookies.set(dismissCookieName, true, {
|
||||
expires: getCookieExpirationPeriod(dismissCookieExpire),
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -24,6 +24,7 @@ export default {
|
|||
methods: {
|
||||
dismiss() {
|
||||
this.isDismissed = true;
|
||||
this.$emit('alertDismissed');
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -159,7 +159,7 @@ at the bottom of the editor.
|
|||
|
||||
You can use policy alerts to track your policy's impact. Alerts are only available if you've
|
||||
[installed](../../clusters/agent/repository.md)
|
||||
and [configured](../../clusters/agent/install/index.md#create-an-agent-record-in-gitlab)
|
||||
and [configured](../../clusters/agent/install/index.md#register-an-agent-with-gitlab)
|
||||
an agent for this project.
|
||||
|
||||
There are two ways to create policy alerts:
|
||||
|
|
|
@ -20,10 +20,10 @@ Only CI/CD jobs set in the configuration project can access one of the configure
|
|||
## Prerequisites
|
||||
|
||||
- A running [`kas` instance](install/index.md#set-up-the-agent-server).
|
||||
- A [configuration repository](install/index.md#define-a-configuration-repository) with an Agent config file
|
||||
- A [configuration repository](install/index.md#define-a-configuration-repository) with an agent config file
|
||||
installed (`.gitlab/agents/<agent-name>/config.yaml`).
|
||||
- An [Agent record](install/index.md#create-an-agent-record-in-gitlab).
|
||||
- The Agent [installed in the cluster](install/index.md#install-the-agent-into-the-cluster).
|
||||
- A [registered agent](install/index.md#register-an-agent-with-gitlab).
|
||||
- The agent [installed in the cluster](install/index.md#install-the-agent-into-the-cluster).
|
||||
|
||||
## Use the CI/CD Tunnel to run Kubernetes commands from GitLab CI/CD
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ To install the [Agent](../index.md) in your cluster:
|
|||
|
||||
1. [Set up the Agent Server](#set-up-the-agent-server) for your GitLab instance.
|
||||
1. [Define a configuration repository](#define-a-configuration-repository).
|
||||
1. [Create an Agent record in GitLab](#create-an-agent-record-in-gitlab).
|
||||
1. [Install the Agent into the cluster](#install-the-agent-into-the-cluster).
|
||||
1. [Generate and copy a Secret token used to connect to the Agent](#create-the-kubernetes-secret).
|
||||
1. [Register an agent with GitLab](#register-an-agent-with-gitlab).
|
||||
1. [Install the agent into the cluster](#install-the-agent-into-the-cluster).
|
||||
1. [Generate and copy a Secret token used to connect to the agent](#create-the-kubernetes-secret).
|
||||
1. [Create manifest files](#create-manifest-files).
|
||||
|
||||
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i> Watch a GitLab 14.2 [walking-through video](https://www.youtube.com/watch?v=XuBpKtsgGkE) with this process.
|
||||
|
@ -75,7 +75,7 @@ To see all the settings available, read the [Agent configuration repository docu
|
|||
|
||||
Use the [CI/CD Tunnel](../ci_cd_tunnel.md#example-for-a-kubectl-command-using-the-cicd-tunnel) to access your cluster from GitLab CI/CD.
|
||||
|
||||
### Create an Agent record in GitLab
|
||||
### Register an agent with GitLab
|
||||
|
||||
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/5786) in GitLab 14.1, you can create a new Agent record directly from the GitLab UI.
|
||||
|
||||
|
@ -88,7 +88,7 @@ In GitLab:
|
|||
1. Ensure that [GitLab CI/CD is enabled in your project](../../../../ci/enable_or_disable_ci.md#enable-cicd-in-a-project).
|
||||
1. From your project's sidebar, select **Infrastructure > Kubernetes clusters**.
|
||||
1. Select **Actions**.
|
||||
1. From the **Select an Agent** dropdown, select the Agent you want to connect and select **Register Agent** to access the installation form.
|
||||
1. From the **Select an agent** dropdown, select the agent you want to connect and select **Register an agent** to access the installation form.
|
||||
1. The form reveals your registration token. Securely store this secret token as you cannot view it again.
|
||||
1. Copy the command under **Recommended installation method**.
|
||||
|
||||
|
@ -97,7 +97,7 @@ In your computer:
|
|||
1. Open your local terminal and connect to your cluster.
|
||||
1. Run the command you copied from the installation form.
|
||||
|
||||
### Install the Agent into the cluster
|
||||
### Install the agent into the cluster
|
||||
|
||||
To install the in-cluster component of the Agent, first you need to define a namespace. To create a new namespace,
|
||||
for example, `gitlab-kubernetes-agent`, run:
|
||||
|
|
|
@ -43,6 +43,10 @@ describe('vue_shared/components/dismissible_alert', () => {
|
|||
it('hides the alert', () => {
|
||||
expect(findAlert().exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('emmits alertDismissed', () => {
|
||||
expect(wrapper.emitted('alertDismissed')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue